@kubb/plugin-client 4.34.0 → 4.35.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.
- package/dist/components.d.ts +1 -1
- package/dist/{generators-BEBJMOJC.js → generators-DCnIY6RB.js} +62 -2
- package/dist/generators-DCnIY6RB.js.map +1 -0
- package/dist/{generators-C3x9D8i7.cjs → generators-Dmi0scNT.cjs} +62 -2
- package/dist/generators-Dmi0scNT.cjs.map +1 -0
- package/dist/generators.cjs +1 -1
- package/dist/generators.d.ts +43 -50
- package/dist/generators.js +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/dist/{types-BQVtim8G.d.ts → types-CdM4DK1M.d.ts} +11 -1
- package/package.json +6 -6
- package/src/components/WrapperClient.tsx +29 -0
- package/src/generators/classClientGenerator.tsx +40 -1
- package/src/plugin.ts +2 -0
- package/src/types.ts +10 -0
- package/dist/generators-BEBJMOJC.js.map +0 -1
- package/dist/generators-C3x9D8i7.cjs.map +0 -1
package/dist/components.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { r as PluginClient } from "./types-
|
|
2
|
+
import { r as PluginClient } from "./types-CdM4DK1M.js";
|
|
3
3
|
import { OperationSchemas } from "@kubb/plugin-oas";
|
|
4
4
|
import { FunctionParams } from "@kubb/react-fabric";
|
|
5
5
|
import { Operation } from "@kubb/oas";
|
|
@@ -9,6 +9,23 @@ import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
|
|
|
9
9
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
10
10
|
import { File, Function } from "@kubb/react-fabric";
|
|
11
11
|
import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
12
|
+
//#region src/components/WrapperClient.tsx
|
|
13
|
+
function WrapperClient({ name, classNames, isExportable = true, isIndexable = true }) {
|
|
14
|
+
const classCode = `export class ${name} {
|
|
15
|
+
${classNames.map((className) => ` readonly ${camelCase(className)}: ${className}`).join("\n")}
|
|
16
|
+
|
|
17
|
+
constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
18
|
+
${classNames.map((className) => ` this.${camelCase(className)} = new ${className}(config)`).join("\n")}
|
|
19
|
+
}
|
|
20
|
+
}`;
|
|
21
|
+
return /* @__PURE__ */ jsx(File.Source, {
|
|
22
|
+
name,
|
|
23
|
+
isExportable,
|
|
24
|
+
isIndexable,
|
|
25
|
+
children: classCode
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
12
29
|
//#region src/generators/classClientGenerator.tsx
|
|
13
30
|
const classClientGenerator = createReactGenerator({
|
|
14
31
|
name: "classClient",
|
|
@@ -116,7 +133,7 @@ const classClientGenerator = createReactGenerator({
|
|
|
116
133
|
zodFilesByPath
|
|
117
134
|
};
|
|
118
135
|
}
|
|
119
|
-
|
|
136
|
+
const files = controllers.map(({ name, file, operations: ops }) => {
|
|
120
137
|
const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops);
|
|
121
138
|
const { zodImportsByFile, zodFilesByPath } = options.parser === "zod" ? collectZodImports(ops) : {
|
|
122
139
|
zodImportsByFile: /* @__PURE__ */ new Map(),
|
|
@@ -218,6 +235,49 @@ const classClientGenerator = createReactGenerator({
|
|
|
218
235
|
]
|
|
219
236
|
}, file.path);
|
|
220
237
|
});
|
|
238
|
+
if (options.wrapper) {
|
|
239
|
+
const wrapperFile = pluginManager.getFile({
|
|
240
|
+
name: options.wrapper.className,
|
|
241
|
+
extname: ".ts",
|
|
242
|
+
pluginKey
|
|
243
|
+
});
|
|
244
|
+
files.push(/* @__PURE__ */ jsxs(File, {
|
|
245
|
+
baseName: wrapperFile.baseName,
|
|
246
|
+
path: wrapperFile.path,
|
|
247
|
+
meta: wrapperFile.meta,
|
|
248
|
+
banner: getBanner({
|
|
249
|
+
oas,
|
|
250
|
+
output: options.output,
|
|
251
|
+
config: pluginManager.config
|
|
252
|
+
}),
|
|
253
|
+
footer: getFooter({
|
|
254
|
+
oas,
|
|
255
|
+
output: options.output
|
|
256
|
+
}),
|
|
257
|
+
children: [
|
|
258
|
+
options.importPath ? /* @__PURE__ */ jsx(File.Import, {
|
|
259
|
+
name: ["Client", "RequestConfig"],
|
|
260
|
+
path: options.importPath,
|
|
261
|
+
isTypeOnly: true
|
|
262
|
+
}) : /* @__PURE__ */ jsx(File.Import, {
|
|
263
|
+
name: ["Client", "RequestConfig"],
|
|
264
|
+
root: wrapperFile.path,
|
|
265
|
+
path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
266
|
+
isTypeOnly: true
|
|
267
|
+
}),
|
|
268
|
+
controllers.map(({ name, file }) => /* @__PURE__ */ jsx(File.Import, {
|
|
269
|
+
name: [name],
|
|
270
|
+
root: wrapperFile.path,
|
|
271
|
+
path: file.path
|
|
272
|
+
}, name)),
|
|
273
|
+
/* @__PURE__ */ jsx(WrapperClient, {
|
|
274
|
+
name: options.wrapper.className,
|
|
275
|
+
classNames: controllers.map(({ name }) => name)
|
|
276
|
+
})
|
|
277
|
+
]
|
|
278
|
+
}, wrapperFile.path));
|
|
279
|
+
}
|
|
280
|
+
return files;
|
|
221
281
|
}
|
|
222
282
|
});
|
|
223
283
|
//#endregion
|
|
@@ -660,4 +720,4 @@ const staticClassClientGenerator = createReactGenerator({
|
|
|
660
720
|
//#endregion
|
|
661
721
|
export { classClientGenerator as a, clientGenerator as i, operationsGenerator as n, groupedClientGenerator as r, staticClassClientGenerator as t };
|
|
662
722
|
|
|
663
|
-
//# sourceMappingURL=generators-
|
|
723
|
+
//# sourceMappingURL=generators-DCnIY6RB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-DCnIY6RB.js","names":[],"sources":["../src/components/WrapperClient.tsx","../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.tsx","../src/generators/staticClassClientGenerator.tsx"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n classNames: Array<string>\n isExportable?: boolean\n isIndexable?: boolean\n}\n\nexport function WrapperClient({ name, classNames, isExportable = true, isIndexable = true }: Props): FabricReactNode {\n const properties = classNames.map((className) => ` readonly ${camelCase(className)}: ${className}`).join('\\n')\n const assignments = classNames.map((className) => ` this.${camelCase(className)} = new ${className}(config)`).join('\\n')\n\n const classCode = `export class ${name} {\n${properties}\n\n constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {\n${assignments}\n }\n}`\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n {classCode}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { ClassClient } from '../components/ClassClient'\nimport { WrapperClient } from '../components/WrapperClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const classClientGenerator = createReactGenerator<PluginClient>({\n name: 'classClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n const files = controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['mergeConfig']} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <ClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n\n if (options.wrapper) {\n const wrapperFile = pluginManager.getFile({\n name: options.wrapper.className,\n extname: '.ts',\n pluginKey,\n })\n\n files.push(\n <File\n key={wrapperFile.path}\n baseName={wrapperFile.baseName}\n path={wrapperFile.path}\n meta={wrapperFile.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <File.Import name={['Client', 'RequestConfig']} path={options.importPath} isTypeOnly />\n ) : (\n <File.Import\n name={['Client', 'RequestConfig']}\n root={wrapperFile.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n\n {controllers.map(({ name, file }) => (\n <File.Import key={name} name={[name]} root={wrapperFile.path} path={file.path} />\n ))}\n\n <WrapperClient name={options.wrapper.className} classNames={controllers.map(({ name }) => name)} />\n </File>,\n )\n }\n\n return files\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Client } from '../components/Client'\nimport { Url } from '../components/Url.tsx'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ config, plugin, operation, generator }) {\n const pluginManager = usePluginManager()\n const {\n options,\n options: { output, urlType },\n } = plugin\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const url = {\n name: getName(operation, { type: 'function', suffix: 'url', prefix: 'get' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const isFormData = operation.getContentType() === 'multipart/form-data'\n\n return (\n <File\n baseName={client.file.baseName}\n path={client.file.path}\n meta={client.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={client.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {isFormData && type.schemas.request?.name && (\n <File.Import name={['buildFormData']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n {options.parser === 'zod' && (\n <File.Import\n name={[zod.schemas.response.name, zod.schemas.request?.name].filter((x): x is string => Boolean(x))}\n root={client.file.path}\n path={zod.file.path}\n />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter((x): x is string => Boolean(x))}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Url\n name={url.name}\n baseURL={options.baseURL}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n isIndexable={urlType === 'export'}\n isExportable={urlType === 'export'}\n />\n\n <Client\n name={client.name}\n urlName={url.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, Function } from '@kubb/react-fabric'\nimport type { PluginClient } from '../types'\n\nexport const groupedClientGenerator = createReactGenerator<PluginClient>({\n name: 'groupedClient',\n Operations({ operations, generator, plugin }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup } = useOperationManager(generator)\n\n const controllers = operations.reduce(\n (acc, operation) => {\n if (options.group?.type === 'tag') {\n const group = getGroup(operation)\n const name = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) : undefined\n\n if (!group?.tag || !name) {\n return acc\n }\n\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.clients.push(client)\n } else {\n acc.push({ name, file, clients: [client] })\n }\n }\n\n return acc\n },\n [] as Array<{ name: string; file: KubbFile.File; clients: Array<{ name: string; file: KubbFile.File }> }>,\n )\n\n return controllers.map(({ name, file, clients }) => {\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {clients.map((client) => (\n <File.Import key={client.name} name={[client.name]} root={file.path} path={client.file.path} />\n ))}\n\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name}>\n {`return { ${clients.map((client) => client.name).join(', ')} }`}\n </Function>\n </File.Source>\n </File>\n )\n })\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations, plugin }) {\n const {\n key: pluginKey,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { StaticClassClient } from '../components/StaticClassClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const staticClassClientGenerator = createReactGenerator<PluginClient>({\n name: 'staticClassClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n return controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['mergeConfig']} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <StaticClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n"],"mappings":";;;;;;;;;;;;AAWA,SAAgB,cAAc,EAAE,MAAM,YAAY,eAAe,MAAM,cAAc,QAAgC;CAInH,MAAM,YAAY,gBAAgB,KAAK;EAHpB,WAAW,KAAK,cAAc,cAAc,UAAU,UAAU,CAAC,IAAI,YAAY,CAAC,KAAK,KAAK,CAIpG;;;EAHS,WAAW,KAAK,cAAc,YAAY,UAAU,UAAU,CAAC,SAAS,UAAU,UAAU,CAAC,KAAK,KAAK,CAM/G;;;AAIZ,QACE,oBAAC,KAAK,QAAN;EAAmB;EAAoB;EAA2B;YAC/D;EACW,CAAA;;;;ACKlB,MAAa,uBAAuB,qBAAmC;CACrE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,QAAQ,UAAU;EACpD,MAAM,EAAE,SAAS,KAAK,cAAc;EACpC,MAAM,g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C,mBAAD;MACQ;MACN,YAAY;MACZ,SAAS,QAAQ;MACjB,gBAAgB,QAAQ;MACxB,gBAAgB,QAAQ;MACxB,cAAc,QAAQ;MACtB,YAAY,QAAQ;MACpB,QAAQ,QAAQ;MAChB,CAAA;KACG;MAhEA,KAAK,KAgEL;IAET;;CAEL,CAAC"}
|
|
@@ -10,6 +10,23 @@ let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
|
10
10
|
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
11
11
|
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
12
12
|
let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
13
|
+
//#region src/components/WrapperClient.tsx
|
|
14
|
+
function WrapperClient({ name, classNames, isExportable = true, isIndexable = true }) {
|
|
15
|
+
const classCode = `export class ${name} {
|
|
16
|
+
${classNames.map((className) => ` readonly ${require_StaticClassClient.camelCase(className)}: ${className}`).join("\n")}
|
|
17
|
+
|
|
18
|
+
constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
19
|
+
${classNames.map((className) => ` this.${require_StaticClassClient.camelCase(className)} = new ${className}(config)`).join("\n")}
|
|
20
|
+
}
|
|
21
|
+
}`;
|
|
22
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
23
|
+
name,
|
|
24
|
+
isExportable,
|
|
25
|
+
isIndexable,
|
|
26
|
+
children: classCode
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
13
30
|
//#region src/generators/classClientGenerator.tsx
|
|
14
31
|
const classClientGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
15
32
|
name: "classClient",
|
|
@@ -117,7 +134,7 @@ const classClientGenerator = (0, _kubb_plugin_oas_generators.createReactGenerato
|
|
|
117
134
|
zodFilesByPath
|
|
118
135
|
};
|
|
119
136
|
}
|
|
120
|
-
|
|
137
|
+
const files = controllers.map(({ name, file, operations: ops }) => {
|
|
121
138
|
const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops);
|
|
122
139
|
const { zodImportsByFile, zodFilesByPath } = options.parser === "zod" ? collectZodImports(ops) : {
|
|
123
140
|
zodImportsByFile: /* @__PURE__ */ new Map(),
|
|
@@ -219,6 +236,49 @@ const classClientGenerator = (0, _kubb_plugin_oas_generators.createReactGenerato
|
|
|
219
236
|
]
|
|
220
237
|
}, file.path);
|
|
221
238
|
});
|
|
239
|
+
if (options.wrapper) {
|
|
240
|
+
const wrapperFile = pluginManager.getFile({
|
|
241
|
+
name: options.wrapper.className,
|
|
242
|
+
extname: ".ts",
|
|
243
|
+
pluginKey
|
|
244
|
+
});
|
|
245
|
+
files.push(/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
246
|
+
baseName: wrapperFile.baseName,
|
|
247
|
+
path: wrapperFile.path,
|
|
248
|
+
meta: wrapperFile.meta,
|
|
249
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
250
|
+
oas,
|
|
251
|
+
output: options.output,
|
|
252
|
+
config: pluginManager.config
|
|
253
|
+
}),
|
|
254
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
255
|
+
oas,
|
|
256
|
+
output: options.output
|
|
257
|
+
}),
|
|
258
|
+
children: [
|
|
259
|
+
options.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
260
|
+
name: ["Client", "RequestConfig"],
|
|
261
|
+
path: options.importPath,
|
|
262
|
+
isTypeOnly: true
|
|
263
|
+
}) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
264
|
+
name: ["Client", "RequestConfig"],
|
|
265
|
+
root: wrapperFile.path,
|
|
266
|
+
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
267
|
+
isTypeOnly: true
|
|
268
|
+
}),
|
|
269
|
+
controllers.map(({ name, file }) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
270
|
+
name: [name],
|
|
271
|
+
root: wrapperFile.path,
|
|
272
|
+
path: file.path
|
|
273
|
+
}, name)),
|
|
274
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(WrapperClient, {
|
|
275
|
+
name: options.wrapper.className,
|
|
276
|
+
classNames: controllers.map(({ name }) => name)
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
}, wrapperFile.path));
|
|
280
|
+
}
|
|
281
|
+
return files;
|
|
222
282
|
}
|
|
223
283
|
});
|
|
224
284
|
//#endregion
|
|
@@ -690,4 +750,4 @@ Object.defineProperty(exports, "staticClassClientGenerator", {
|
|
|
690
750
|
}
|
|
691
751
|
});
|
|
692
752
|
|
|
693
|
-
//# sourceMappingURL=generators-
|
|
753
|
+
//# sourceMappingURL=generators-Dmi0scNT.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-Dmi0scNT.cjs","names":["camelCase","File","pluginTsName","pluginZodName","camelCase","pascalCase","File","path","ClassClient","pluginTsName","pluginZodName","File","path","Url","Client","camelCase","File","Function","File","Operations","pluginTsName","pluginZodName","camelCase","pascalCase","File","path","StaticClassClient"],"sources":["../src/components/WrapperClient.tsx","../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.tsx","../src/generators/staticClassClientGenerator.tsx"],"sourcesContent":["import { camelCase } from '@internals/utils'\nimport { File } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n classNames: Array<string>\n isExportable?: boolean\n isIndexable?: boolean\n}\n\nexport function WrapperClient({ name, classNames, isExportable = true, isIndexable = true }: Props): FabricReactNode {\n const properties = classNames.map((className) => ` readonly ${camelCase(className)}: ${className}`).join('\\n')\n const assignments = classNames.map((className) => ` this.${camelCase(className)} = new ${className}(config)`).join('\\n')\n\n const classCode = `export class ${name} {\n${properties}\n\n constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {\n${assignments}\n }\n}`\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n {classCode}\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { ClassClient } from '../components/ClassClient'\nimport { WrapperClient } from '../components/WrapperClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const classClientGenerator = createReactGenerator<PluginClient>({\n name: 'classClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n const files = controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['mergeConfig']} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <ClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n\n if (options.wrapper) {\n const wrapperFile = pluginManager.getFile({\n name: options.wrapper.className,\n extname: '.ts',\n pluginKey,\n })\n\n files.push(\n <File\n key={wrapperFile.path}\n baseName={wrapperFile.baseName}\n path={wrapperFile.path}\n meta={wrapperFile.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <File.Import name={['Client', 'RequestConfig']} path={options.importPath} isTypeOnly />\n ) : (\n <File.Import\n name={['Client', 'RequestConfig']}\n root={wrapperFile.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n )}\n\n {controllers.map(({ name, file }) => (\n <File.Import key={name} name={[name]} root={wrapperFile.path} path={file.path} />\n ))}\n\n <WrapperClient name={options.wrapper.className} classNames={controllers.map(({ name }) => name)} />\n </File>,\n )\n }\n\n return files\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Client } from '../components/Client'\nimport { Url } from '../components/Url.tsx'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ config, plugin, operation, generator }) {\n const pluginManager = usePluginManager()\n const {\n options,\n options: { output, urlType },\n } = plugin\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const url = {\n name: getName(operation, { type: 'function', suffix: 'url', prefix: 'get' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const isFormData = operation.getContentType() === 'multipart/form-data'\n\n return (\n <File\n baseName={client.file.baseName}\n path={client.file.path}\n meta={client.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={client.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {isFormData && type.schemas.request?.name && (\n <File.Import name={['buildFormData']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n {options.parser === 'zod' && (\n <File.Import\n name={[zod.schemas.response.name, zod.schemas.request?.name].filter((x): x is string => Boolean(x))}\n root={client.file.path}\n path={zod.file.path}\n />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter((x): x is string => Boolean(x))}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Url\n name={url.name}\n baseURL={options.baseURL}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n isIndexable={urlType === 'export'}\n isExportable={urlType === 'export'}\n />\n\n <Client\n name={client.name}\n urlName={url.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, Function } from '@kubb/react-fabric'\nimport type { PluginClient } from '../types'\n\nexport const groupedClientGenerator = createReactGenerator<PluginClient>({\n name: 'groupedClient',\n Operations({ operations, generator, plugin }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup } = useOperationManager(generator)\n\n const controllers = operations.reduce(\n (acc, operation) => {\n if (options.group?.type === 'tag') {\n const group = getGroup(operation)\n const name = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) : undefined\n\n if (!group?.tag || !name) {\n return acc\n }\n\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.clients.push(client)\n } else {\n acc.push({ name, file, clients: [client] })\n }\n }\n\n return acc\n },\n [] as Array<{ name: string; file: KubbFile.File; clients: Array<{ name: string; file: KubbFile.File }> }>,\n )\n\n return controllers.map(({ name, file, clients }) => {\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {clients.map((client) => (\n <File.Import key={client.name} name={[client.name]} root={file.path} path={client.file.path} />\n ))}\n\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name}>\n {`return { ${clients.map((client) => client.name).join(', ')} }`}\n </Function>\n </File.Source>\n </File>\n )\n })\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations, plugin }) {\n const {\n key: pluginKey,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { StaticClassClient } from '../components/StaticClassClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const staticClassClientGenerator = createReactGenerator<PluginClient>({\n name: 'staticClassClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n return controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['mergeConfig']} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <StaticClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n"],"mappings":";;;;;;;;;;;;;AAWA,SAAgB,cAAc,EAAE,MAAM,YAAY,eAAe,MAAM,cAAc,QAAgC;CAInH,MAAM,YAAY,gBAAgB,KAAK;EAHpB,WAAW,KAAK,cAAc,cAAcA,0BAAAA,UAAU,UAAU,CAAC,IAAI,YAAY,CAAC,KAAK,KAAK,CAIpG;;;EAHS,WAAW,KAAK,cAAc,YAAYA,0BAAAA,UAAU,UAAU,CAAC,SAAS,UAAU,UAAU,CAAC,KAAK,KAAK,CAM/G;;;AAIZ,QACE,iBAAA,GAAA,+BAAA,KAACC,mBAAAA,KAAK,QAAN;EAAmB;EAAoB;EAA2B;YAC/D;EACW,CAAA;;;;ACKlB,MAAa,wBAAA,GAAA,4BAAA,sBAA0D;CACrE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,QAAQ,UAAU;EACpD,MAAM,EAAE,SAAS,KAAK,cAAc;EACpC,MAAM,iBAAA,GAAA,iBAAA,mBAAkC;EAExC,MAAM,OAAA,GAAA,uBAAA,SAAc;EACpB,MAAM,EAAE,SAAS,SAAS,UAAU,gBAAA,GAAA,uBAAA,qBAAmC,UAAU;EAEjF,SAAS,mBAAmB,WAAqC;GAC/D,MAAM,OAAO;IACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACC,gBAAAA,aAAa,E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AM;OAAa,MAAM,KAAK;OAAM,MAAM,SAAS;OAAM,YAAA;OAAa,EAAhF,SAAgF;OACzG;KAED,QAAQ,WAAW,SAClB,MAAM,KAAK,iBAAiB,SAAS,CAAC,CAAC,KAAK,CAAC,UAAU,aAAa;MAClE,MAAM,UAAU,eAAe,IAAI,SAAS;AAC5C,UAAI,CAAC,QACH,QAAO;MAET,MAAM,cAAc,MAAM,KAAK,QAAQ,CAAC,OAAO,QAAQ;AACvD,UAAI,YAAY,WAAW,EACzB,QAAO;AAGT,aAAO,iBAAA,GAAA,+BAAA,KAACA,mBAAAA,KAAK,QAAN;OAA4B,MAAM;OAAa,MAAM,KAAK;OAAM,MAAM,QAAQ;OAAQ,EAApE,SAAoE;OAC7F;KAEJ,iBAAA,GAAA,+BAAA,KAACE,0BAAAA,mBAAD;MACQ;MACN,YAAY;MACZ,SAAS,QAAQ;MACjB,gBAAgB,QAAQ;MACxB,gBAAgB,QAAQ;MACxB,cAAc,QAAQ;MACtB,YAAY,QAAQ;MACpB,QAAQ,QAAQ;MAChB,CAAA;KACG;MAhEA,KAAK,KAgEL;IAET;;CAEL,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generators = require("./generators-
|
|
2
|
+
const require_generators = require("./generators-Dmi0scNT.cjs");
|
|
3
3
|
exports.classClientGenerator = require_generators.classClientGenerator;
|
|
4
4
|
exports.clientGenerator = require_generators.clientGenerator;
|
|
5
5
|
exports.groupedClientGenerator = require_generators.groupedClientGenerator;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,40 +1,12 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { r as PluginClient } from "./types-
|
|
3
|
-
import { Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
2
|
+
import { r as PluginClient } from "./types-CdM4DK1M.js";
|
|
3
|
+
import { AsyncEventEmitter, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
4
4
|
import { Fabric } from "@kubb/react-fabric";
|
|
5
5
|
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
6
6
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
7
|
+
import { OperationNode, SchemaNode } from "@kubb/ast/types";
|
|
7
8
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
8
9
|
|
|
9
|
-
//#region ../../internals/utils/src/asyncEventEmitter.d.ts
|
|
10
|
-
/** A function that can be registered as an event listener, synchronous or async. */
|
|
11
|
-
type AsyncListener<TArgs extends unknown[]> = (...args: TArgs) => void | Promise<void>;
|
|
12
|
-
/**
|
|
13
|
-
* A typed EventEmitter that awaits all async listeners before resolving.
|
|
14
|
-
* Wraps Node's `EventEmitter` with full TypeScript event-map inference.
|
|
15
|
-
*/
|
|
16
|
-
declare class AsyncEventEmitter<TEvents extends { [K in keyof TEvents]: unknown[] }> {
|
|
17
|
-
#private;
|
|
18
|
-
/**
|
|
19
|
-
* `maxListener` controls the maximum number of listeners per event before Node emits a memory-leak warning.
|
|
20
|
-
* @default 10
|
|
21
|
-
*/
|
|
22
|
-
constructor(maxListener?: number);
|
|
23
|
-
/**
|
|
24
|
-
* Emits an event and awaits all registered listeners in parallel.
|
|
25
|
-
* Throws if any listener rejects, wrapping the cause with the event name and serialized arguments.
|
|
26
|
-
*/
|
|
27
|
-
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
|
|
28
|
-
/** Registers a persistent listener for the given event. */
|
|
29
|
-
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
|
|
30
|
-
/** Registers a one-shot listener that removes itself after the first invocation. */
|
|
31
|
-
onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
|
|
32
|
-
/** Removes a previously registered listener. */
|
|
33
|
-
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: AsyncListener<TEvents[TEventName]>): void;
|
|
34
|
-
/** Removes all listeners from every event channel. */
|
|
35
|
-
removeAll(): void;
|
|
36
|
-
}
|
|
37
|
-
//#endregion
|
|
38
10
|
//#region ../plugin-oas/src/types.d.ts
|
|
39
11
|
type GetOasOptions = {
|
|
40
12
|
validate?: boolean;
|
|
@@ -161,7 +133,7 @@ declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = P
|
|
|
161
133
|
method: HttpMethod;
|
|
162
134
|
operation: Operation;
|
|
163
135
|
}>>;
|
|
164
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
136
|
+
build(...generators: Array<Generator<TPluginOptions, Version>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
165
137
|
}
|
|
166
138
|
//#endregion
|
|
167
139
|
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
@@ -451,32 +423,46 @@ declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGe
|
|
|
451
423
|
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
452
424
|
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
453
425
|
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
454
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
426
|
+
build(...generators: Array<Generator<TPluginOptions, Version>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
455
427
|
}
|
|
456
428
|
//#endregion
|
|
457
429
|
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
458
|
-
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
430
|
+
type CoreGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
|
|
459
431
|
name: string;
|
|
460
432
|
type: 'core';
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
433
|
+
version: TVersion;
|
|
434
|
+
operations: (props: OperationsProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
|
|
435
|
+
operation: (props: OperationProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
|
|
436
|
+
schema: (props: SchemaProps<TOptions, TVersion>) => Promise<KubbFile.File[]>;
|
|
464
437
|
};
|
|
465
438
|
//#endregion
|
|
466
439
|
//#region ../plugin-oas/src/generators/types.d.ts
|
|
467
|
-
type
|
|
440
|
+
type Version = '1' | '2';
|
|
441
|
+
type OperationsV1Props<TOptions extends PluginFactoryOptions> = {
|
|
468
442
|
config: Config;
|
|
469
443
|
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
470
444
|
plugin: Plugin<TOptions>;
|
|
471
445
|
operations: Array<Operation>;
|
|
472
446
|
};
|
|
473
|
-
type
|
|
447
|
+
type OperationsV2Props<TOptions extends PluginFactoryOptions> = {
|
|
448
|
+
config: Config;
|
|
449
|
+
plugin: Plugin<TOptions>;
|
|
450
|
+
nodes: Array<OperationNode>;
|
|
451
|
+
};
|
|
452
|
+
type OperationV1Props<TOptions extends PluginFactoryOptions> = {
|
|
474
453
|
config: Config;
|
|
475
454
|
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
476
455
|
plugin: Plugin<TOptions>;
|
|
477
456
|
operation: Operation;
|
|
478
457
|
};
|
|
479
|
-
type
|
|
458
|
+
type OperationV2Props<TOptions extends PluginFactoryOptions> = {
|
|
459
|
+
config: Config;
|
|
460
|
+
plugin: Plugin<TOptions>;
|
|
461
|
+
node: OperationNode;
|
|
462
|
+
};
|
|
463
|
+
type OperationsProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? OperationsV2Props<TOptions> : OperationsV1Props<TOptions>;
|
|
464
|
+
type OperationProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? OperationV2Props<TOptions> : OperationV1Props<TOptions>;
|
|
465
|
+
type SchemaV1Props<TOptions extends PluginFactoryOptions> = {
|
|
480
466
|
config: Config;
|
|
481
467
|
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
482
468
|
plugin: Plugin<TOptions>;
|
|
@@ -486,31 +472,38 @@ type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
|
486
472
|
value: SchemaObject;
|
|
487
473
|
};
|
|
488
474
|
};
|
|
489
|
-
type
|
|
475
|
+
type SchemaV2Props<TOptions extends PluginFactoryOptions> = {
|
|
476
|
+
config: Config;
|
|
477
|
+
plugin: Plugin<TOptions>;
|
|
478
|
+
node: SchemaNode;
|
|
479
|
+
};
|
|
480
|
+
type SchemaProps<TOptions extends PluginFactoryOptions, TVersion extends Version = '1'> = TVersion extends '2' ? SchemaV2Props<TOptions> : SchemaV1Props<TOptions>;
|
|
481
|
+
type Generator<TOptions extends PluginFactoryOptions, TVersion extends Version = Version> = CoreGenerator<TOptions, TVersion> | ReactGenerator<TOptions, TVersion>;
|
|
490
482
|
//#endregion
|
|
491
483
|
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
492
|
-
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
484
|
+
type ReactGenerator<TOptions extends PluginFactoryOptions, TVersion extends Version> = {
|
|
493
485
|
name: string;
|
|
494
486
|
type: 'react';
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
487
|
+
version: TVersion;
|
|
488
|
+
Operations: (props: OperationsProps<TOptions, TVersion>) => FabricReactNode;
|
|
489
|
+
Operation: (props: OperationProps<TOptions, TVersion>) => FabricReactNode;
|
|
490
|
+
Schema: (props: SchemaProps<TOptions, TVersion>) => FabricReactNode;
|
|
498
491
|
};
|
|
499
492
|
//#endregion
|
|
500
493
|
//#region src/generators/classClientGenerator.d.ts
|
|
501
|
-
declare const classClientGenerator: ReactGenerator<PluginClient>;
|
|
494
|
+
declare const classClientGenerator: ReactGenerator<PluginClient, "1">;
|
|
502
495
|
//#endregion
|
|
503
496
|
//#region src/generators/clientGenerator.d.ts
|
|
504
|
-
declare const clientGenerator: ReactGenerator<PluginClient>;
|
|
497
|
+
declare const clientGenerator: ReactGenerator<PluginClient, "1">;
|
|
505
498
|
//#endregion
|
|
506
499
|
//#region src/generators/groupedClientGenerator.d.ts
|
|
507
|
-
declare const groupedClientGenerator: ReactGenerator<PluginClient>;
|
|
500
|
+
declare const groupedClientGenerator: ReactGenerator<PluginClient, "1">;
|
|
508
501
|
//#endregion
|
|
509
502
|
//#region src/generators/operationsGenerator.d.ts
|
|
510
|
-
declare const operationsGenerator: ReactGenerator<PluginClient>;
|
|
503
|
+
declare const operationsGenerator: ReactGenerator<PluginClient, "1">;
|
|
511
504
|
//#endregion
|
|
512
505
|
//#region src/generators/staticClassClientGenerator.d.ts
|
|
513
|
-
declare const staticClassClientGenerator: ReactGenerator<PluginClient>;
|
|
506
|
+
declare const staticClassClientGenerator: ReactGenerator<PluginClient, "1">;
|
|
514
507
|
//#endregion
|
|
515
508
|
export { classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator, staticClassClientGenerator };
|
|
516
509
|
//# sourceMappingURL=generators.d.ts.map
|
package/dist/generators.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as classClientGenerator, i as clientGenerator, n as operationsGenerator, r as groupedClientGenerator, t as staticClassClientGenerator } from "./generators-
|
|
1
|
+
import { a as classClientGenerator, i as clientGenerator, n as operationsGenerator, r as groupedClientGenerator, t as staticClassClientGenerator } from "./generators-DCnIY6RB.js";
|
|
2
2
|
export { classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator, staticClassClientGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-ByKO4r7w.cjs");
|
|
3
3
|
const require_StaticClassClient = require("./StaticClassClient-By-aMAe4.cjs");
|
|
4
|
-
const require_generators = require("./generators-
|
|
4
|
+
const require_generators = require("./generators-Dmi0scNT.cjs");
|
|
5
5
|
const require_templates_clients_axios_source = require("./templates/clients/axios.source.cjs");
|
|
6
6
|
const require_templates_clients_fetch_source = require("./templates/clients/fetch.source.cjs");
|
|
7
7
|
const require_templates_config_source = require("./templates/config.source.cjs");
|
|
@@ -16,7 +16,7 @@ const pluginClient = (0, _kubb_core.definePlugin)((options) => {
|
|
|
16
16
|
const { output = {
|
|
17
17
|
path: "clients",
|
|
18
18
|
barrelType: "named"
|
|
19
|
-
}, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, clientType = "function", parser = "client", client = "axios", importPath, contentType, bundle = false } = options;
|
|
19
|
+
}, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, clientType = "function", parser = "client", client = "axios", importPath, contentType, bundle = false, wrapper } = options;
|
|
20
20
|
const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : void 0);
|
|
21
21
|
const defaultGenerators = [
|
|
22
22
|
clientType === "staticClass" ? require_generators.staticClassClientGenerator : clientType === "class" ? require_generators.classClientGenerator : require_generators.clientGenerator,
|
|
@@ -39,7 +39,8 @@ const pluginClient = (0, _kubb_core.definePlugin)((options) => {
|
|
|
39
39
|
paramsCasing,
|
|
40
40
|
pathParamsType,
|
|
41
41
|
baseURL,
|
|
42
|
-
urlType
|
|
42
|
+
urlType,
|
|
43
|
+
wrapper
|
|
43
44
|
},
|
|
44
45
|
pre: [_kubb_plugin_oas.pluginOasName, parser === "zod" ? _kubb_plugin_zod.pluginZodName : void 0].filter(Boolean),
|
|
45
46
|
resolvePath(baseName, pathMode, options) {
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["staticClassClientGenerator","classClientGenerator","clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","path","camelCase","fetchClientSource","axiosClientSource","configSource","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { classClientGenerator, operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport { staticClassClientGenerator } from './generators/staticClassClientGenerator.tsx'\nimport { source as axiosClientSource } from './templates/clients/axios.source.ts'\nimport { source as fetchClientSource } from './templates/clients/fetch.source.ts'\nimport { source as configSource } from './templates/config.source.ts'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = definePlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrelType: 'named' },\n group,\n urlType = false,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n baseURL,\n paramsCasing,\n clientType = 'function',\n parser = 'client',\n client = 'axios',\n importPath,\n contentType,\n bundle = false,\n } = options\n\n const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : undefined)\n\n const defaultGenerators = [\n clientType === 'staticClass' ? staticClassClientGenerator : clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType === 'function' ? groupedClientGenerator : undefined,\n operations ? operationsGenerator : undefined,\n ].filter((x): x is NonNullable<typeof x> => Boolean(x))\n\n const generators = options.generators ?? defaultGenerators\n\n return {\n name: pluginClientName,\n options: {\n client,\n clientType,\n bundle,\n output,\n group,\n parser,\n dataReturnType,\n importPath: resolvedImportPath,\n paramsType,\n paramsCasing,\n pathParamsType,\n baseURL,\n urlType,\n },\n pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].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)}Controller`\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, { isFile: type === 'file' })\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 // pre add bundled fetch\n if (bundle && !this.plugin.options.importPath) {\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n\n const operationGenerator = new OperationGenerator(\n baseURL\n ? {\n ...this.plugin.options,\n baseURL,\n }\n : this.plugin.options,\n {\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\n const files = await operationGenerator.build(...generators)\n\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":";;;;;;;;;;;;;AAcA,MAAa,mBAAmB;AAEhC,MAAa,gBAAA,GAAA,WAAA,eAA2C,YAAY;CAClE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,UAAU,OACV,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,iBAAiB,QACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,aAAa,OACb,SACA,cACA,aAAa,YACb,SAAS,UACT,SAAS,SACT,YACA,aACA,SAAS,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["staticClassClientGenerator","classClientGenerator","clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","path","camelCase","fetchClientSource","axiosClientSource","configSource","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { classClientGenerator, operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport { staticClassClientGenerator } from './generators/staticClassClientGenerator.tsx'\nimport { source as axiosClientSource } from './templates/clients/axios.source.ts'\nimport { source as fetchClientSource } from './templates/clients/fetch.source.ts'\nimport { source as configSource } from './templates/config.source.ts'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = definePlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrelType: 'named' },\n group,\n urlType = false,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n baseURL,\n paramsCasing,\n clientType = 'function',\n parser = 'client',\n client = 'axios',\n importPath,\n contentType,\n bundle = false,\n wrapper,\n } = options\n\n const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : undefined)\n\n const defaultGenerators = [\n clientType === 'staticClass' ? staticClassClientGenerator : clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType === 'function' ? groupedClientGenerator : undefined,\n operations ? operationsGenerator : undefined,\n ].filter((x): x is NonNullable<typeof x> => Boolean(x))\n\n const generators = options.generators ?? defaultGenerators\n\n return {\n name: pluginClientName,\n options: {\n client,\n clientType,\n bundle,\n output,\n group,\n parser,\n dataReturnType,\n importPath: resolvedImportPath,\n paramsType,\n paramsCasing,\n pathParamsType,\n baseURL,\n urlType,\n wrapper,\n },\n pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].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)}Controller`\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, { isFile: type === 'file' })\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 // pre add bundled fetch\n if (bundle && !this.plugin.options.importPath) {\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n\n const operationGenerator = new OperationGenerator(\n baseURL\n ? {\n ...this.plugin.options,\n baseURL,\n }\n : this.plugin.options,\n {\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\n const files = await operationGenerator.build(...generators)\n\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":";;;;;;;;;;;;;AAcA,MAAa,mBAAmB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,SAAS,EAAE;IACZ,CAAC;GAuBF,MAAM,QAAQ,MArBa,IAAIC,iBAAAA,mBAC7B,UACI;IACE,GAAG,KAAK,OAAO;IACf;IACD,GACD,KAAK,OAAO,SAChB;IACE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CACF,CAEsC,MAAM,GAAG,WAAW;AAE3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,OAAA,GAAA,WAAA,gBAAqB,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"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { n as Options, r as PluginClient, t as ClientImportPath } from "./types-
|
|
2
|
+
import { n as Options, r as PluginClient, t as ClientImportPath } from "./types-CdM4DK1M.js";
|
|
3
3
|
import * as _kubb_core0 from "@kubb/core";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { o as camelCase } from "./StaticClassClient-CCn9g9eF.js";
|
|
3
|
-
import { a as classClientGenerator, i as clientGenerator, n as operationsGenerator, r as groupedClientGenerator, t as staticClassClientGenerator } from "./generators-
|
|
3
|
+
import { a as classClientGenerator, i as clientGenerator, n as operationsGenerator, r as groupedClientGenerator, t as staticClassClientGenerator } from "./generators-DCnIY6RB.js";
|
|
4
4
|
import { source } from "./templates/clients/axios.source.js";
|
|
5
5
|
import { source as source$1 } from "./templates/clients/fetch.source.js";
|
|
6
6
|
import { source as source$2 } from "./templates/config.source.js";
|
|
@@ -14,7 +14,7 @@ const pluginClient = definePlugin((options) => {
|
|
|
14
14
|
const { output = {
|
|
15
15
|
path: "clients",
|
|
16
16
|
barrelType: "named"
|
|
17
|
-
}, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, clientType = "function", parser = "client", client = "axios", importPath, contentType, bundle = false } = options;
|
|
17
|
+
}, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, clientType = "function", parser = "client", client = "axios", importPath, contentType, bundle = false, wrapper } = options;
|
|
18
18
|
const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : void 0);
|
|
19
19
|
const defaultGenerators = [
|
|
20
20
|
clientType === "staticClass" ? staticClassClientGenerator : clientType === "class" ? classClientGenerator : clientGenerator,
|
|
@@ -37,7 +37,8 @@ const pluginClient = definePlugin((options) => {
|
|
|
37
37
|
paramsCasing,
|
|
38
38
|
pathParamsType,
|
|
39
39
|
baseURL,
|
|
40
|
-
urlType
|
|
40
|
+
urlType,
|
|
41
|
+
wrapper
|
|
41
42
|
},
|
|
42
43
|
pre: [pluginOasName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
|
|
43
44
|
resolvePath(baseName, pathMode, options) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { classClientGenerator, operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport { staticClassClientGenerator } from './generators/staticClassClientGenerator.tsx'\nimport { source as axiosClientSource } from './templates/clients/axios.source.ts'\nimport { source as fetchClientSource } from './templates/clients/fetch.source.ts'\nimport { source as configSource } from './templates/config.source.ts'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = definePlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrelType: 'named' },\n group,\n urlType = false,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n baseURL,\n paramsCasing,\n clientType = 'function',\n parser = 'client',\n client = 'axios',\n importPath,\n contentType,\n bundle = false,\n } = options\n\n const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : undefined)\n\n const defaultGenerators = [\n clientType === 'staticClass' ? staticClassClientGenerator : clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType === 'function' ? groupedClientGenerator : undefined,\n operations ? operationsGenerator : undefined,\n ].filter((x): x is NonNullable<typeof x> => Boolean(x))\n\n const generators = options.generators ?? defaultGenerators\n\n return {\n name: pluginClientName,\n options: {\n client,\n clientType,\n bundle,\n output,\n group,\n parser,\n dataReturnType,\n importPath: resolvedImportPath,\n paramsType,\n paramsCasing,\n pathParamsType,\n baseURL,\n urlType,\n },\n pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].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)}Controller`\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, { isFile: type === 'file' })\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 // pre add bundled fetch\n if (bundle && !this.plugin.options.importPath) {\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n\n const operationGenerator = new OperationGenerator(\n baseURL\n ? {\n ...this.plugin.options,\n baseURL,\n }\n : this.plugin.options,\n {\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\n const files = await operationGenerator.build(...generators)\n\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":";;;;;;;;;;;AAcA,MAAa,mBAAmB;AAEhC,MAAa,eAAe,cAA4B,YAAY;CAClE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,UAAU,OACV,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,iBAAiB,QACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,aAAa,OACb,SACA,cACA,aAAa,YACb,SAAS,UACT,SAAS,SACT,YACA,aACA,SAAS,
|
|
1
|
+
{"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { camelCase } from '@internals/utils'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { classClientGenerator, operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport { staticClassClientGenerator } from './generators/staticClassClientGenerator.tsx'\nimport { source as axiosClientSource } from './templates/clients/axios.source.ts'\nimport { source as fetchClientSource } from './templates/clients/fetch.source.ts'\nimport { source as configSource } from './templates/config.source.ts'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = definePlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrelType: 'named' },\n group,\n urlType = false,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n baseURL,\n paramsCasing,\n clientType = 'function',\n parser = 'client',\n client = 'axios',\n importPath,\n contentType,\n bundle = false,\n wrapper,\n } = options\n\n const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : undefined)\n\n const defaultGenerators = [\n clientType === 'staticClass' ? staticClassClientGenerator : clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType === 'function' ? groupedClientGenerator : undefined,\n operations ? operationsGenerator : undefined,\n ].filter((x): x is NonNullable<typeof x> => Boolean(x))\n\n const generators = options.generators ?? defaultGenerators\n\n return {\n name: pluginClientName,\n options: {\n client,\n clientType,\n bundle,\n output,\n group,\n parser,\n dataReturnType,\n importPath: resolvedImportPath,\n paramsType,\n paramsCasing,\n pathParamsType,\n baseURL,\n urlType,\n wrapper,\n },\n pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].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)}Controller`\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, { isFile: type === 'file' })\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 // pre add bundled fetch\n if (bundle && !this.plugin.options.importPath) {\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n\n const operationGenerator = new OperationGenerator(\n baseURL\n ? {\n ...this.plugin.options,\n baseURL,\n }\n : this.plugin.options,\n {\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\n const files = await operationGenerator.build(...generators)\n\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":";;;;;;;;;;;AAcA,MAAa,mBAAmB;AAEhC,MAAa,eAAe,cAA4B,YAAY;CAClE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,UAAU,OACV,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,iBAAiB,QACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,aAAa,OACb,SACA,cACA,aAAa,YACb,SAAS,UACT,SAAS,SACT,YACA,aACA,SAAS,OACT,YACE;CAEJ,MAAM,qBAAqB,eAAe,CAAC,SAAS,+BAA+B,WAAW,KAAA;CAE9F,MAAM,oBAAoB;EACxB,eAAe,gBAAgB,6BAA6B,eAAe,UAAU,uBAAuB;EAC5G,SAAS,eAAe,aAAa,yBAAyB,KAAA;EAC9D,aAAa,sBAAsB,KAAA;EACpC,CAAC,QAAQ,MAAkC,QAAQ,EAAE,CAAC;CAEvD,MAAM,aAAa,QAAQ,cAAc;AAEzC,QAAO;EACL,MAAM;EACN,SA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AQ;IACjB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,OAAO,KAAK,OAAO,QAAQ,WAAW,UAAUA,WAAoBC;KACpE,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;AAGJ,SAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,OAAOC;KACP,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAuBF,MAAM,QAAQ,MArBa,IAAI,mBAC7B,UACI;IACE,GAAG,KAAK,OAAO;IACf;IACD,GACD,KAAK,OAAO,SAChB;IACE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CACF,CAEsC,MAAM,GAAG,WAAW;AAE3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,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"}
|
|
@@ -127,6 +127,15 @@ type Options = {
|
|
|
127
127
|
* In version 5 of Kubb this is by default true
|
|
128
128
|
*/
|
|
129
129
|
bundle?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Generate a wrapper class that composes all tag-based client classes into a single entry point.
|
|
132
|
+
*/
|
|
133
|
+
wrapper?: {
|
|
134
|
+
/**
|
|
135
|
+
* Name of the wrapper class.
|
|
136
|
+
*/
|
|
137
|
+
className: string;
|
|
138
|
+
};
|
|
130
139
|
transformers?: {
|
|
131
140
|
/**
|
|
132
141
|
* Customize the names based on the type that is provided by the plugin.
|
|
@@ -152,8 +161,9 @@ type ResolvedOptions = {
|
|
|
152
161
|
pathParamsType: NonNullable<Options['pathParamsType']>;
|
|
153
162
|
paramsType: NonNullable<Options['paramsType']>;
|
|
154
163
|
paramsCasing: Options['paramsCasing'];
|
|
164
|
+
wrapper: Options['wrapper'];
|
|
155
165
|
};
|
|
156
166
|
type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
157
167
|
//#endregion
|
|
158
168
|
export { Options as n, PluginClient as r, ClientImportPath as t };
|
|
159
|
-
//# sourceMappingURL=types-
|
|
169
|
+
//# sourceMappingURL=types-CdM4DK1M.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-client",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.35.1",
|
|
4
4
|
"description": "API client generator plugin for Kubb, creating type-safe HTTP clients (Axios, Fetch) from OpenAPI specifications for making API requests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
@@ -110,11 +110,11 @@
|
|
|
110
110
|
"dependencies": {
|
|
111
111
|
"@kubb/fabric-core": "0.13.3",
|
|
112
112
|
"@kubb/react-fabric": "0.13.3",
|
|
113
|
-
"@kubb/core": "4.
|
|
114
|
-
"@kubb/oas": "4.
|
|
115
|
-
"@kubb/plugin-oas": "4.
|
|
116
|
-
"@kubb/plugin-ts": "4.
|
|
117
|
-
"@kubb/plugin-zod": "4.
|
|
113
|
+
"@kubb/core": "4.35.1",
|
|
114
|
+
"@kubb/oas": "4.35.1",
|
|
115
|
+
"@kubb/plugin-oas": "4.35.1",
|
|
116
|
+
"@kubb/plugin-ts": "4.35.1",
|
|
117
|
+
"@kubb/plugin-zod": "4.35.1"
|
|
118
118
|
},
|
|
119
119
|
"devDependencies": {
|
|
120
120
|
"axios": "^1.13.6",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { camelCase } from '@internals/utils'
|
|
2
|
+
import { File } from '@kubb/react-fabric'
|
|
3
|
+
import type { FabricReactNode } from '@kubb/react-fabric/types'
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
name: string
|
|
7
|
+
classNames: Array<string>
|
|
8
|
+
isExportable?: boolean
|
|
9
|
+
isIndexable?: boolean
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function WrapperClient({ name, classNames, isExportable = true, isIndexable = true }: Props): FabricReactNode {
|
|
13
|
+
const properties = classNames.map((className) => ` readonly ${camelCase(className)}: ${className}`).join('\n')
|
|
14
|
+
const assignments = classNames.map((className) => ` this.${camelCase(className)} = new ${className}(config)`).join('\n')
|
|
15
|
+
|
|
16
|
+
const classCode = `export class ${name} {
|
|
17
|
+
${properties}
|
|
18
|
+
|
|
19
|
+
constructor(config: Partial<RequestConfig> & { client?: Client } = {}) {
|
|
20
|
+
${assignments}
|
|
21
|
+
}
|
|
22
|
+
}`
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>
|
|
26
|
+
{classCode}
|
|
27
|
+
</File.Source>
|
|
28
|
+
)
|
|
29
|
+
}
|
|
@@ -11,6 +11,7 @@ import { pluginTsName } from '@kubb/plugin-ts'
|
|
|
11
11
|
import { pluginZodName } from '@kubb/plugin-zod'
|
|
12
12
|
import { File } from '@kubb/react-fabric'
|
|
13
13
|
import { ClassClient } from '../components/ClassClient'
|
|
14
|
+
import { WrapperClient } from '../components/WrapperClient'
|
|
14
15
|
import type { PluginClient } from '../types'
|
|
15
16
|
|
|
16
17
|
type OperationData = {
|
|
@@ -152,7 +153,7 @@ export const classClientGenerator = createReactGenerator<PluginClient>({
|
|
|
152
153
|
return { zodImportsByFile, zodFilesByPath }
|
|
153
154
|
}
|
|
154
155
|
|
|
155
|
-
|
|
156
|
+
const files = controllers.map(({ name, file, operations: ops }) => {
|
|
156
157
|
const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)
|
|
157
158
|
const { zodImportsByFile, zodFilesByPath } =
|
|
158
159
|
options.parser === 'zod'
|
|
@@ -229,5 +230,43 @@ export const classClientGenerator = createReactGenerator<PluginClient>({
|
|
|
229
230
|
</File>
|
|
230
231
|
)
|
|
231
232
|
})
|
|
233
|
+
|
|
234
|
+
if (options.wrapper) {
|
|
235
|
+
const wrapperFile = pluginManager.getFile({
|
|
236
|
+
name: options.wrapper.className,
|
|
237
|
+
extname: '.ts',
|
|
238
|
+
pluginKey,
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
files.push(
|
|
242
|
+
<File
|
|
243
|
+
key={wrapperFile.path}
|
|
244
|
+
baseName={wrapperFile.baseName}
|
|
245
|
+
path={wrapperFile.path}
|
|
246
|
+
meta={wrapperFile.meta}
|
|
247
|
+
banner={getBanner({ oas, output: options.output, config: pluginManager.config })}
|
|
248
|
+
footer={getFooter({ oas, output: options.output })}
|
|
249
|
+
>
|
|
250
|
+
{options.importPath ? (
|
|
251
|
+
<File.Import name={['Client', 'RequestConfig']} path={options.importPath} isTypeOnly />
|
|
252
|
+
) : (
|
|
253
|
+
<File.Import
|
|
254
|
+
name={['Client', 'RequestConfig']}
|
|
255
|
+
root={wrapperFile.path}
|
|
256
|
+
path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}
|
|
257
|
+
isTypeOnly
|
|
258
|
+
/>
|
|
259
|
+
)}
|
|
260
|
+
|
|
261
|
+
{controllers.map(({ name, file }) => (
|
|
262
|
+
<File.Import key={name} name={[name]} root={wrapperFile.path} path={file.path} />
|
|
263
|
+
))}
|
|
264
|
+
|
|
265
|
+
<WrapperClient name={options.wrapper.className} classNames={controllers.map(({ name }) => name)} />
|
|
266
|
+
</File>,
|
|
267
|
+
)
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
return files
|
|
232
271
|
},
|
|
233
272
|
})
|
package/src/plugin.ts
CHANGED
|
@@ -35,6 +35,7 @@ export const pluginClient = definePlugin<PluginClient>((options) => {
|
|
|
35
35
|
importPath,
|
|
36
36
|
contentType,
|
|
37
37
|
bundle = false,
|
|
38
|
+
wrapper,
|
|
38
39
|
} = options
|
|
39
40
|
|
|
40
41
|
const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : undefined)
|
|
@@ -63,6 +64,7 @@ export const pluginClient = definePlugin<PluginClient>((options) => {
|
|
|
63
64
|
pathParamsType,
|
|
64
65
|
baseURL,
|
|
65
66
|
urlType,
|
|
67
|
+
wrapper,
|
|
66
68
|
},
|
|
67
69
|
pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),
|
|
68
70
|
resolvePath(baseName, pathMode, options) {
|
package/src/types.ts
CHANGED
|
@@ -129,6 +129,15 @@ export type Options = {
|
|
|
129
129
|
* In version 5 of Kubb this is by default true
|
|
130
130
|
*/
|
|
131
131
|
bundle?: boolean
|
|
132
|
+
/**
|
|
133
|
+
* Generate a wrapper class that composes all tag-based client classes into a single entry point.
|
|
134
|
+
*/
|
|
135
|
+
wrapper?: {
|
|
136
|
+
/**
|
|
137
|
+
* Name of the wrapper class.
|
|
138
|
+
*/
|
|
139
|
+
className: string
|
|
140
|
+
}
|
|
132
141
|
transformers?: {
|
|
133
142
|
/**
|
|
134
143
|
* Customize the names based on the type that is provided by the plugin.
|
|
@@ -155,6 +164,7 @@ type ResolvedOptions = {
|
|
|
155
164
|
pathParamsType: NonNullable<Options['pathParamsType']>
|
|
156
165
|
paramsType: NonNullable<Options['paramsType']>
|
|
157
166
|
paramsCasing: Options['paramsCasing']
|
|
167
|
+
wrapper: Options['wrapper']
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
export type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-BEBJMOJC.js","names":[],"sources":["../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.tsx","../src/generators/staticClassClientGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { ClassClient } from '../components/ClassClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const classClientGenerator = createReactGenerator<PluginClient>({\n name: 'classClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n return controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['mergeConfig']} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <ClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Client } from '../components/Client'\nimport { Url } from '../components/Url.tsx'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ config, plugin, operation, generator }) {\n const pluginManager = usePluginManager()\n const {\n options,\n options: { output, urlType },\n } = plugin\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const url = {\n name: getName(operation, { type: 'function', suffix: 'url', prefix: 'get' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const isFormData = operation.getContentType() === 'multipart/form-data'\n\n return (\n <File\n baseName={client.file.baseName}\n path={client.file.path}\n meta={client.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={client.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {isFormData && type.schemas.request?.name && (\n <File.Import name={['buildFormData']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n {options.parser === 'zod' && (\n <File.Import\n name={[zod.schemas.response.name, zod.schemas.request?.name].filter((x): x is string => Boolean(x))}\n root={client.file.path}\n path={zod.file.path}\n />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter((x): x is string => Boolean(x))}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Url\n name={url.name}\n baseURL={options.baseURL}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n isIndexable={urlType === 'export'}\n isExportable={urlType === 'export'}\n />\n\n <Client\n name={client.name}\n urlName={url.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, Function } from '@kubb/react-fabric'\nimport type { PluginClient } from '../types'\n\nexport const groupedClientGenerator = createReactGenerator<PluginClient>({\n name: 'groupedClient',\n Operations({ operations, generator, plugin }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup } = useOperationManager(generator)\n\n const controllers = operations.reduce(\n (acc, operation) => {\n if (options.group?.type === 'tag') {\n const group = getGroup(operation)\n const name = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) : undefined\n\n if (!group?.tag || !name) {\n return acc\n }\n\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.clients.push(client)\n } else {\n acc.push({ name, file, clients: [client] })\n }\n }\n\n return acc\n },\n [] as Array<{ name: string; file: KubbFile.File; clients: Array<{ name: string; file: KubbFile.File }> }>,\n )\n\n return controllers.map(({ name, file, clients }) => {\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {clients.map((client) => (\n <File.Import key={client.name} name={[client.name]} root={file.path} path={client.file.path} />\n ))}\n\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name}>\n {`return { ${clients.map((client) => client.name).join(', ')} }`}\n </Function>\n </File.Source>\n </File>\n )\n })\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations, plugin }) {\n const {\n key: pluginKey,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { StaticClassClient } from '../components/StaticClassClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const staticClassClientGenerator = createReactGenerator<PluginClient>({\n name: 'staticClassClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n return controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['mergeConfig']} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <StaticClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n"],"mappings":";;;;;;;;;;;;AA8BA,MAAa,uBAAuB,qBAAmC;CACrE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,QAAQ,UAAU;EACpD,MAAM,EAAE,SAAS,KAAK,cAAc;EACpC,MAAM,gBAAgB,kBAAkB;EAExC,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,SAAS,SAAS,UAAU,eAAe,oBAAoB,UAAU;EAEjF,SAAS,mBAAmB,WAAqC;GAC/D,MAAM,OAAO;IACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,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AO;AAGT,aAAO,oBAAC,KAAK,QAAN;OAA4B,MAAM;OAAa,MAAM,KAAK;OAAM,MAAM,QAAQ;OAAQ,EAApE,SAAoE;OAC7F;KAEJ,oBAAC,mBAAD;MACQ;MACN,YAAY;MACZ,SAAS,QAAQ;MACjB,gBAAgB,QAAQ;MACxB,gBAAgB,QAAQ;MACxB,cAAc,QAAQ;MACtB,YAAY,QAAQ;MACpB,QAAQ,QAAQ;MAChB,CAAA;KACG;MAhEA,KAAK,KAgEL;IAET;;CAEL,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-C3x9D8i7.cjs","names":["pluginTsName","pluginZodName","camelCase","pascalCase","File","path","ClassClient","pluginTsName","pluginZodName","File","path","Url","Client","camelCase","File","Function","File","Operations","pluginTsName","pluginZodName","camelCase","pascalCase","File","path","StaticClassClient"],"sources":["../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.tsx","../src/generators/staticClassClientGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { ClassClient } from '../components/ClassClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const classClientGenerator = createReactGenerator<PluginClient>({\n name: 'classClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n return controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['mergeConfig']} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <ClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Client } from '../components/Client'\nimport { Url } from '../components/Url.tsx'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ config, plugin, operation, generator }) {\n const pluginManager = usePluginManager()\n const {\n options,\n options: { output, urlType },\n } = plugin\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const url = {\n name: getName(operation, { type: 'function', suffix: 'url', prefix: 'get' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const isFormData = operation.getContentType() === 'multipart/form-data'\n\n return (\n <File\n baseName={client.file.baseName}\n path={client.file.path}\n meta={client.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={client.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {isFormData && type.schemas.request?.name && (\n <File.Import name={['buildFormData']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n {options.parser === 'zod' && (\n <File.Import\n name={[zod.schemas.response.name, zod.schemas.request?.name].filter((x): x is string => Boolean(x))}\n root={client.file.path}\n path={zod.file.path}\n />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter((x): x is string => Boolean(x))}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Url\n name={url.name}\n baseURL={options.baseURL}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n isIndexable={urlType === 'export'}\n isExportable={urlType === 'export'}\n />\n\n <Client\n name={client.name}\n urlName={url.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, Function } from '@kubb/react-fabric'\nimport type { PluginClient } from '../types'\n\nexport const groupedClientGenerator = createReactGenerator<PluginClient>({\n name: 'groupedClient',\n Operations({ operations, generator, plugin }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup } = useOperationManager(generator)\n\n const controllers = operations.reduce(\n (acc, operation) => {\n if (options.group?.type === 'tag') {\n const group = getGroup(operation)\n const name = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) : undefined\n\n if (!group?.tag || !name) {\n return acc\n }\n\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.clients.push(client)\n } else {\n acc.push({ name, file, clients: [client] })\n }\n }\n\n return acc\n },\n [] as Array<{ name: string; file: KubbFile.File; clients: Array<{ name: string; file: KubbFile.File }> }>,\n )\n\n return controllers.map(({ name, file, clients }) => {\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {clients.map((client) => (\n <File.Import key={client.name} name={[client.name]} root={file.path} path={client.file.path} />\n ))}\n\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name}>\n {`return { ${clients.map((client) => client.name).join(', ')} }`}\n </Function>\n </File.Source>\n </File>\n )\n })\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations, plugin }) {\n const {\n key: pluginKey,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { camelCase, pascalCase } from '@internals/utils'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { StaticClassClient } from '../components/StaticClassClient'\nimport type { PluginClient } from '../types'\n\ntype OperationData = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n typeFile: KubbFile.File\n zodFile: KubbFile.File\n}\n\ntype Controller = {\n name: string\n file: KubbFile.File\n operations: Array<OperationData>\n}\n\nexport const staticClassClientGenerator = createReactGenerator<PluginClient>({\n name: 'staticClassClient',\n Operations({ operations, generator, plugin, config }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup, getSchemas } = useOperationManager(generator)\n\n function buildOperationData(operation: Operation): OperationData {\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n return {\n operation,\n name: getName(operation, { type: 'function' }),\n typeSchemas: type.schemas,\n zodSchemas: zod.schemas,\n typeFile: type.file,\n zodFile: zod.file,\n }\n }\n\n // Group operations by tag\n const controllers = operations.reduce(\n (acc, operation) => {\n const group = getGroup(operation)\n const groupName = group?.tag ? (options.group?.name?.({ group: camelCase(group.tag) }) ?? pascalCase(group.tag)) : 'Client'\n\n if (!group?.tag && !options.group) {\n // If no grouping, put all operations in a single class\n const name = 'ApiClient'\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n } else if (group?.tag) {\n // Group by tag\n const name = groupName\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const operationData = buildOperationData(operation)\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.operations.push(operationData)\n } else {\n acc.push({ name, file, operations: [operationData] })\n }\n }\n\n return acc\n },\n [] as Array<Controller>,\n )\n\n function collectTypeImports(ops: Array<OperationData>) {\n const typeImportsByFile = new Map<string, Set<string>>()\n const typeFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { typeSchemas, typeFile } = op\n\n if (!typeImportsByFile.has(typeFile.path)) {\n typeImportsByFile.set(typeFile.path, new Set())\n }\n const typeImports = typeImportsByFile.get(typeFile.path)!\n\n if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name)\n if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name)\n if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name)\n if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name)\n if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name)\n typeSchemas.statusCodes?.forEach((item) => {\n if (item?.name) typeImports.add(item.name)\n })\n typeFilesByPath.set(typeFile.path, typeFile)\n })\n\n return { typeImportsByFile, typeFilesByPath }\n }\n\n function collectZodImports(ops: Array<OperationData>) {\n const zodImportsByFile = new Map<string, Set<string>>()\n const zodFilesByPath = new Map<string, KubbFile.File>()\n\n ops.forEach((op) => {\n const { zodSchemas, zodFile } = op\n\n if (!zodImportsByFile.has(zodFile.path)) {\n zodImportsByFile.set(zodFile.path, new Set())\n }\n const zodImports = zodImportsByFile.get(zodFile.path)!\n\n if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name)\n if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name)\n zodFilesByPath.set(zodFile.path, zodFile)\n })\n\n return { zodImportsByFile, zodFilesByPath }\n }\n\n return controllers.map(({ name, file, operations: ops }) => {\n const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops)\n const { zodImportsByFile, zodFilesByPath } =\n options.parser === 'zod'\n ? collectZodImports(ops)\n : { zodImportsByFile: new Map<string, Set<string>>(), zodFilesByPath: new Map<string, KubbFile.File>() }\n const hasFormData = ops.some((op) => op.operation.getContentType() === 'multipart/form-data')\n\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['mergeConfig']} path={options.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import name={['mergeConfig']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <StaticClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n"],"mappings":";;;;;;;;;;;;;AA8BA,MAAa,wBAAA,GAAA,4BAAA,sBAA0D;CACrE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,QAAQ,UAAU;EACpD,MAAM,EAAE,SAAS,KAAK,cAAc;EACpC,MAAM,iBAAA,GAAA,iBAAA,mBAAkC;EAExC,MAAM,OAAA,GAAA,uBAAA,SAAc;EACpB,MAAM,EAAE,SAAS,SAAS,UAAU,gBAAA,GAAA,uBAAA,qBAAmC,UAAU;EAEjF,SAAS,mBAAmB,WAAqC;GAC/D,MAAM,OAAO;IACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,gBAAAA,aAAa,EAAE,CAAC;IACvD,SAAS,WAAW,WAAW;KAAE,WAAW,CAACA,gBAAAA,aAAa;KAAE,MAAM;KAAQ,CAAC;IAC5E;GAED,MAAM,MAAM;IACV,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACC,iBAAAA,cAAc,EAAE,CAAC;IACxD,SAAS,WAAW,WAAW;KAAE,WAAW,CAACA,iBAAAA,cAAc;KAAE,MAAM;KAAY,CAAC;IACjF;AAED,UAAO;IACL;IACA,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;IAC9C,aAAa,KAAK;IAClB,YAAY,IAAI;IAChB,UAAU,KAAK;IACf,SAAS,IAAI;IACd;;EAIH,MAAM,cAAc,WAAW,QAC5B,KAAK,cAAc;GAClB,MAAM,QAAQ,SAAS,UAAU;GACjC,MAAM,YAAY,OAAO,MAAO,QAAQ,OAAO,OAAO,EAAE,OAAOC,0BAAAA,UAAU,MAAM,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