@kubb/plugin-client 4.8.0 → 4.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/dist/{Operations-BCvft948.js → Operations-B6I1tCOx.js} +118 -5
  2. package/dist/Operations-B6I1tCOx.js.map +1 -0
  3. package/dist/{Operations-CP_QErFp.cjs → Operations-BVIrtQ0H.cjs} +122 -3
  4. package/dist/Operations-BVIrtQ0H.cjs.map +1 -0
  5. package/dist/components.cjs +2 -1
  6. package/dist/components.d.cts +53 -2
  7. package/dist/components.d.ts +53 -2
  8. package/dist/components.js +2 -2
  9. package/dist/generators-CsFgdAtO.js +424 -0
  10. package/dist/generators-CsFgdAtO.js.map +1 -0
  11. package/dist/{generators-9lVWKcq3.cjs → generators-dDr1GP7q.cjs} +198 -2
  12. package/dist/generators-dDr1GP7q.cjs.map +1 -0
  13. package/dist/generators.cjs +3 -2
  14. package/dist/generators.d.cts +5 -2
  15. package/dist/generators.d.ts +5 -2
  16. package/dist/generators.js +3 -3
  17. package/dist/index.cjs +11 -7
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +1 -1
  20. package/dist/index.d.ts +1 -1
  21. package/dist/index.js +11 -7
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-CRHoY-hv.d.ts → types-DDd1VM_Z.d.ts} +9 -1
  24. package/dist/{types-DxXfO6iR.d.cts → types-MSth0FPg.d.cts} +9 -1
  25. package/package.json +6 -6
  26. package/src/components/ClassClient.tsx +235 -0
  27. package/src/components/Client.tsx +3 -2
  28. package/src/components/index.ts +1 -0
  29. package/src/generators/__snapshots__/Pet.ts +186 -0
  30. package/src/generators/__snapshots__/Store.ts +109 -0
  31. package/src/generators/__snapshots__/User.ts +147 -0
  32. package/src/generators/classClientGenerator.tsx +231 -0
  33. package/src/generators/index.ts +1 -0
  34. package/src/plugin.ts +10 -2
  35. package/src/types.ts +8 -0
  36. package/dist/Operations-BCvft948.js.map +0 -1
  37. package/dist/Operations-CP_QErFp.cjs.map +0 -1
  38. package/dist/generators-9lVWKcq3.cjs.map +0 -1
  39. package/dist/generators-BQlm15sh.js +0 -234
  40. package/dist/generators-BQlm15sh.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- const require_Operations = require('./Operations-CP_QErFp.cjs');
2
+ const require_Operations = require('./Operations-BVIrtQ0H.cjs');
3
3
  let node_path = require("node:path");
4
4
  node_path = require_chunk.__toESM(node_path);
5
5
  let __kubb_core_transformers = require("@kubb/core/transformers");
@@ -12,6 +12,196 @@ let __kubb_plugin_ts = require("@kubb/plugin-ts");
12
12
  let __kubb_react_fabric = require("@kubb/react-fabric");
13
13
  let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
14
14
 
15
+ //#region src/generators/classClientGenerator.tsx
16
+ const classClientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
17
+ name: "classClient",
18
+ Operations({ operations, generator, plugin, config }) {
19
+ const { options, key: pluginKey } = plugin;
20
+ const pluginManager = (0, __kubb_core_hooks.usePluginManager)();
21
+ const oas = (0, __kubb_plugin_oas_hooks.useOas)();
22
+ const { getName, getFile, getGroup, getSchemas } = (0, __kubb_plugin_oas_hooks.useOperationManager)(generator);
23
+ function buildOperationData(operation) {
24
+ const type = {
25
+ file: getFile(operation, { pluginKey: [__kubb_plugin_ts.pluginTsName] }),
26
+ schemas: getSchemas(operation, {
27
+ pluginKey: [__kubb_plugin_ts.pluginTsName],
28
+ type: "type"
29
+ })
30
+ };
31
+ const zod = {
32
+ file: getFile(operation, { pluginKey: [__kubb_plugin_zod.pluginZodName] }),
33
+ schemas: getSchemas(operation, {
34
+ pluginKey: [__kubb_plugin_zod.pluginZodName],
35
+ type: "function"
36
+ })
37
+ };
38
+ return {
39
+ operation,
40
+ name: getName(operation, { type: "function" }),
41
+ typeSchemas: type.schemas,
42
+ zodSchemas: zod.schemas,
43
+ typeFile: type.file,
44
+ zodFile: zod.file
45
+ };
46
+ }
47
+ const controllers = operations.reduce((acc, operation) => {
48
+ const group = getGroup(operation);
49
+ const groupName = group?.tag ? options.group?.name?.({ group: (0, __kubb_core_transformers.camelCase)(group.tag) }) ?? (0, __kubb_core_transformers.pascalCase)(group.tag) : "Client";
50
+ if (!group?.tag && !options.group) {
51
+ const name = "ApiClient";
52
+ const file = pluginManager.getFile({
53
+ name,
54
+ extname: ".ts",
55
+ pluginKey
56
+ });
57
+ const operationData = buildOperationData(operation);
58
+ const previousFile = acc.find((item) => item.file.path === file.path);
59
+ if (previousFile) previousFile.operations.push(operationData);
60
+ else acc.push({
61
+ name,
62
+ file,
63
+ operations: [operationData]
64
+ });
65
+ } else if (group?.tag) {
66
+ const name = groupName;
67
+ const file = pluginManager.getFile({
68
+ name,
69
+ extname: ".ts",
70
+ pluginKey,
71
+ options: { group }
72
+ });
73
+ const operationData = buildOperationData(operation);
74
+ const previousFile = acc.find((item) => item.file.path === file.path);
75
+ if (previousFile) previousFile.operations.push(operationData);
76
+ else acc.push({
77
+ name,
78
+ file,
79
+ operations: [operationData]
80
+ });
81
+ }
82
+ return acc;
83
+ }, []);
84
+ function collectTypeImports(ops) {
85
+ const typeImportsByFile = /* @__PURE__ */ new Map();
86
+ const typeFilesByPath = /* @__PURE__ */ new Map();
87
+ ops.forEach((op) => {
88
+ const { typeSchemas, typeFile } = op;
89
+ if (!typeImportsByFile.has(typeFile.path)) typeImportsByFile.set(typeFile.path, /* @__PURE__ */ new Set());
90
+ const typeImports = typeImportsByFile.get(typeFile.path);
91
+ if (typeSchemas.request?.name) typeImports.add(typeSchemas.request.name);
92
+ if (typeSchemas.response?.name) typeImports.add(typeSchemas.response.name);
93
+ if (typeSchemas.pathParams?.name) typeImports.add(typeSchemas.pathParams.name);
94
+ if (typeSchemas.queryParams?.name) typeImports.add(typeSchemas.queryParams.name);
95
+ if (typeSchemas.headerParams?.name) typeImports.add(typeSchemas.headerParams.name);
96
+ typeSchemas.statusCodes?.forEach((item) => {
97
+ if (item?.name) typeImports.add(item.name);
98
+ });
99
+ typeFilesByPath.set(typeFile.path, typeFile);
100
+ });
101
+ return {
102
+ typeImportsByFile,
103
+ typeFilesByPath
104
+ };
105
+ }
106
+ function collectZodImports(ops) {
107
+ const zodImportsByFile = /* @__PURE__ */ new Map();
108
+ const zodFilesByPath = /* @__PURE__ */ new Map();
109
+ ops.forEach((op) => {
110
+ const { zodSchemas, zodFile } = op;
111
+ if (!zodImportsByFile.has(zodFile.path)) zodImportsByFile.set(zodFile.path, /* @__PURE__ */ new Set());
112
+ const zodImports = zodImportsByFile.get(zodFile.path);
113
+ if (zodSchemas?.response?.name) zodImports.add(zodSchemas.response.name);
114
+ if (zodSchemas?.request?.name) zodImports.add(zodSchemas.request.name);
115
+ zodFilesByPath.set(zodFile.path, zodFile);
116
+ });
117
+ return {
118
+ zodImportsByFile,
119
+ zodFilesByPath
120
+ };
121
+ }
122
+ return controllers.map(({ name, file, operations: ops }) => {
123
+ const { typeImportsByFile, typeFilesByPath } = collectTypeImports(ops);
124
+ const { zodImportsByFile, zodFilesByPath } = options.parser === "zod" ? collectZodImports(ops) : {
125
+ zodImportsByFile: /* @__PURE__ */ new Map(),
126
+ zodFilesByPath: /* @__PURE__ */ new Map()
127
+ };
128
+ const hasFormData = ops.some((op) => op.operation.getContentType() === "multipart/form-data");
129
+ return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
130
+ baseName: file.baseName,
131
+ path: file.path,
132
+ meta: file.meta,
133
+ banner: (0, __kubb_plugin_oas_utils.getBanner)({
134
+ oas,
135
+ output: options.output,
136
+ config: pluginManager.config
137
+ }),
138
+ footer: (0, __kubb_plugin_oas_utils.getFooter)({
139
+ oas,
140
+ output: options.output
141
+ }),
142
+ children: [
143
+ options.importPath ? /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
144
+ name: "fetch",
145
+ path: options.importPath
146
+ }), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
147
+ name: ["RequestConfig", "ResponseErrorConfig"],
148
+ path: options.importPath,
149
+ isTypeOnly: true
150
+ })] }) : /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
151
+ name: ["fetch"],
152
+ root: file.path,
153
+ path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
154
+ }), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
155
+ name: ["RequestConfig", "ResponseErrorConfig"],
156
+ root: file.path,
157
+ path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
158
+ isTypeOnly: true
159
+ })] }),
160
+ hasFormData && /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
161
+ name: ["buildFormData"],
162
+ root: file.path,
163
+ path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
164
+ }),
165
+ Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {
166
+ const typeFile = typeFilesByPath.get(filePath);
167
+ if (!typeFile) return null;
168
+ const importNames = Array.from(imports).filter(Boolean);
169
+ if (importNames.length === 0) return null;
170
+ return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
171
+ name: importNames,
172
+ root: file.path,
173
+ path: typeFile.path,
174
+ isTypeOnly: true
175
+ }, filePath);
176
+ }),
177
+ options.parser === "zod" && Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {
178
+ const zodFile = zodFilesByPath.get(filePath);
179
+ if (!zodFile) return null;
180
+ const importNames = Array.from(imports).filter(Boolean);
181
+ if (importNames.length === 0) return null;
182
+ return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
183
+ name: importNames,
184
+ root: file.path,
185
+ path: zodFile.path
186
+ }, filePath);
187
+ }),
188
+ /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_Operations.ClassClient, {
189
+ name,
190
+ operations: ops,
191
+ baseURL: options.baseURL,
192
+ dataReturnType: options.dataReturnType,
193
+ pathParamsType: options.pathParamsType,
194
+ paramsCasing: options.paramsCasing,
195
+ paramsType: options.paramsType,
196
+ parser: options.parser
197
+ })
198
+ ]
199
+ }, file.path);
200
+ });
201
+ }
202
+ });
203
+
204
+ //#endregion
15
205
  //#region src/generators/clientGenerator.tsx
16
206
  const clientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
17
207
  name: "client",
@@ -232,6 +422,12 @@ const operationsGenerator = (0, __kubb_plugin_oas_generators.createReactGenerato
232
422
  });
233
423
 
234
424
  //#endregion
425
+ Object.defineProperty(exports, 'classClientGenerator', {
426
+ enumerable: true,
427
+ get: function () {
428
+ return classClientGenerator;
429
+ }
430
+ });
235
431
  Object.defineProperty(exports, 'clientGenerator', {
236
432
  enumerable: true,
237
433
  get: function () {
@@ -250,4 +446,4 @@ Object.defineProperty(exports, 'operationsGenerator', {
250
446
  return operationsGenerator;
251
447
  }
252
448
  });
253
- //# sourceMappingURL=generators-9lVWKcq3.cjs.map
449
+ //# sourceMappingURL=generators-dDr1GP7q.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-dDr1GP7q.cjs","names":["pluginTsName","pluginZodName","File","path","ClassClient","pluginTsName","pluginZodName","File","path","Url","Client","File","Function","File","Operations"],"sources":["../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\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={['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\n name={['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={['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={['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 name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={client.file.path} path={zod.file.path} />\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(Boolean)}\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 { usePluginManager } from '@kubb/core/hooks'\nimport { camelCase } from '@kubb/core/transformers'\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"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAa,8EAA0D;CACrE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,QAAQ,UAAU;EACpD,MAAM,EAAE,SAAS,KAAK,cAAc;EACpC,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,SAAS,SAAS,UAAU,gEAAmC,UAAU;EAEjF,SAAS,mBAAmB,WAAqC;GAC/D,MAAM,OAAO;IACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,8BAAa,EAAE,CAAC;IACvD,SAAS,WAAW,WAAW;KAAE,WAAW,CAACA,8BAAa;KAAE,MAAM;KAAQ,CAAC;IAC5E;GAED,MAAM,MAAM;IACV,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACC,gCAAc,EAAE,CAAC;IACxD,SAAS,WAAW,WAAW;KAAE,WAAW,CAACA,gCAAc;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,+CAAiB,MAAM,IAAI,EAAE,CAAC,6CAAe,MAAM,IAAI,GAAI;AAEnH,OAAI,CAAC,OAAO,OAAO,CAAC,QAAQ,OAAO;IAEj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;IACX,+CAAkB;KAAE;KAAK,QAAQ,QAAQ;KAAQ,QAAQ,cAAc;KAAQ,CAAC;IAChF,+CAAkB;KAAE;KAAK,QAAQ,QAAQ;KAAQ,CAAC;eAEjD,QAAQ,KAAK,WACZ,yDAACA,yBAAK;KAAyB,MAAM,CAAC,OAAO,KAAK;KAAE,MAAM,KAAK;KAAM,MAAM,OAAO,KAAK;OAArE,OAAO,KAAsE,CAC/F,EAEF,yDAACA,yBAAK;KAAa;KAAM;KAAa;eACpC,yDAACC;MAAS;MAAa;gBACpB,YAAY,QAAQ,KAAK,WAAW,OAAO,KAAK,CAAC,KAAK,KAAK,CAAC;OACpD;MACC;MAfT,KAAK,KAgBL;IAET;;CAEL,CAAC;;;;ACrEF,MAAa,6EAAyD;CACpE,MAAM;CACN,WAAW,EAAE,YAAY,UAAU;EACjC,MAAM,EACJ,KAAK,WACL,SAAS,EAAE,aACT;EACJ,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EAEpB,MAAM,OAAO;EACb,MAAM,OAAO,cAAc,QAAQ;GAAE;GAAM,SAAS;GAAO;GAAW,CAAC;AAEvE,SACE,yDAACC;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,+CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,+CAAkB;IAAE;IAAK;IAAQ,CAAC;aAElC,yDAACC;IAAiB;IAAkB;KAAc;IAC7C;;CAGZ,CAAC"}
@@ -1,6 +1,7 @@
1
- require('./Operations-CP_QErFp.cjs');
2
- const require_generators = require('./generators-9lVWKcq3.cjs');
1
+ require('./Operations-BVIrtQ0H.cjs');
2
+ const require_generators = require('./generators-dDr1GP7q.cjs');
3
3
 
4
+ exports.classClientGenerator = require_generators.classClientGenerator;
4
5
  exports.clientGenerator = require_generators.clientGenerator;
5
6
  exports.groupedClientGenerator = require_generators.groupedClientGenerator;
6
7
  exports.operationsGenerator = require_generators.operationsGenerator;
@@ -1,5 +1,8 @@
1
- import { n as PluginClient, r as ReactGenerator } from "./types-DxXfO6iR.cjs";
1
+ import { n as PluginClient, r as ReactGenerator } from "./types-MSth0FPg.cjs";
2
2
 
3
+ //#region src/generators/classClientGenerator.d.ts
4
+ declare const classClientGenerator: ReactGenerator<PluginClient>;
5
+ //#endregion
3
6
  //#region src/generators/clientGenerator.d.ts
4
7
  declare const clientGenerator: ReactGenerator<PluginClient>;
5
8
  //#endregion
@@ -9,5 +12,5 @@ declare const groupedClientGenerator: ReactGenerator<PluginClient>;
9
12
  //#region src/generators/operationsGenerator.d.ts
10
13
  declare const operationsGenerator: ReactGenerator<PluginClient>;
11
14
  //#endregion
12
- export { clientGenerator, groupedClientGenerator, operationsGenerator };
15
+ export { classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator };
13
16
  //# sourceMappingURL=generators.d.cts.map
@@ -1,5 +1,8 @@
1
- import { n as PluginClient, r as ReactGenerator } from "./types-CRHoY-hv.js";
1
+ import { n as PluginClient, r as ReactGenerator } from "./types-DDd1VM_Z.js";
2
2
 
3
+ //#region src/generators/classClientGenerator.d.ts
4
+ declare const classClientGenerator: ReactGenerator<PluginClient>;
5
+ //#endregion
3
6
  //#region src/generators/clientGenerator.d.ts
4
7
  declare const clientGenerator: ReactGenerator<PluginClient>;
5
8
  //#endregion
@@ -9,5 +12,5 @@ declare const groupedClientGenerator: ReactGenerator<PluginClient>;
9
12
  //#region src/generators/operationsGenerator.d.ts
10
13
  declare const operationsGenerator: ReactGenerator<PluginClient>;
11
14
  //#endregion
12
- export { clientGenerator, groupedClientGenerator, operationsGenerator };
15
+ export { classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator };
13
16
  //# sourceMappingURL=generators.d.ts.map
@@ -1,4 +1,4 @@
1
- import "./Operations-BCvft948.js";
2
- import { n as groupedClientGenerator, r as clientGenerator, t as operationsGenerator } from "./generators-BQlm15sh.js";
1
+ import "./Operations-B6I1tCOx.js";
2
+ import { i as classClientGenerator, n as groupedClientGenerator, r as clientGenerator, t as operationsGenerator } from "./generators-CsFgdAtO.js";
3
3
 
4
- export { clientGenerator, groupedClientGenerator, operationsGenerator };
4
+ export { classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator };
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require('./chunk-CbDLau6x.cjs');
2
- require('./Operations-CP_QErFp.cjs');
3
- const require_generators = require('./generators-9lVWKcq3.cjs');
2
+ require('./Operations-BVIrtQ0H.cjs');
3
+ const require_generators = require('./generators-dDr1GP7q.cjs');
4
4
  let node_path = require("node:path");
5
5
  node_path = require_chunk.__toESM(node_path);
6
6
  let __kubb_core = require("@kubb/core");
@@ -15,21 +15,25 @@ const pluginClient = (0, __kubb_core.definePlugin)((options) => {
15
15
  const { output = {
16
16
  path: "clients",
17
17
  barrelType: "named"
18
- }, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, generators = [
19
- require_generators.clientGenerator,
20
- group ? require_generators.groupedClientGenerator : void 0,
18
+ }, 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
+ const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : void 0);
20
+ const defaultGenerators = [
21
+ clientType === "class" ? require_generators.classClientGenerator : require_generators.clientGenerator,
22
+ group && clientType !== "class" ? require_generators.groupedClientGenerator : void 0,
21
23
  operations ? require_generators.operationsGenerator : void 0
22
- ].filter(Boolean), parser = "client", client = "axios", importPath, contentType, bundle = false } = options;
24
+ ].filter(Boolean);
25
+ const generators = options.generators ?? defaultGenerators;
23
26
  return {
24
27
  name: pluginClientName,
25
28
  options: {
26
29
  client,
30
+ clientType,
27
31
  bundle,
28
32
  output,
29
33
  group,
30
34
  parser,
31
35
  dataReturnType,
32
- importPath: importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : void 0),
36
+ importPath: resolvedImportPath,
33
37
  paramsType,
34
38
  paramsCasing,
35
39
  pathParamsType,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","path","options","groupName: Group['name']","baseURL","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\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 generators = [clientGenerator, group ? groupedClientGenerator : undefined, operations ? operationsGenerator : undefined].filter(Boolean),\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 return {\n name: pluginClientName,\n options: {\n client,\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: resolveModuleSource(\n this.plugin.options.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\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: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\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 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 logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,mBAAmB;AAEhC,MAAa,8CAA2C,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;EAACA;EAAiB,QAAQC,4CAAyB;EAAW,aAAaC,yCAAsB;EAAU,CAAC,OAAO,QAAQ,EACxI,SAAS,UACT,SAAS,SACT,YACA,aACA,SAAS,UACP;AAIJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA,YAXuB,eAAe,CAAC,SAAS,+BAA+B,WAAW;GAY1F;GACA;GACA;GACA;GACA;GACD;EACD,KAAK,CAACC,iCAAe,WAAW,QAAQC,kCAAgB,OAAU,CAAC,OAAO,QAAQ;EAClF,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;A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IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CACF,CAEsC,MAAM,GAAG,WAAW;AAE3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,sCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["classClientGenerator","clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","path","options","groupName: Group['name']","baseURL","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { 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 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 const defaultGenerators = [\n clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType !== 'class' ? groupedClientGenerator : undefined,\n operations ? operationsGenerator : undefined,\n ].filter(Boolean)\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: resolveModuleSource(\n this.plugin.options.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\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: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\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 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 logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,mBAAmB;AAEhC,MAAa,8CAA2C,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,UACP;CAEJ,MAAM,qBAAqB,eAAe,CAAC,SAAS,+BAA+B,WAAW;CAC9F,MAAM,oBAAoB;EACxB,eAAe,UAAUA,0CAAuBC;EAChD,SAAS,eAAe,UAAUC,4CAAyB;EAC3D,aAAaC,yCAAsB;EACpC,CAAC,OAAO,QAAQ;CAEjB,MAAM,aAAa,QAAQ,cAAc;AAEzC,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA,YAAY;GACZ;GACA;GACA;GACA;GACA;GACD;EACD,KAAK,CAACC,iCAAe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QAAQ,WAAW,UAAU,gDAAgD,8CAC1F,CAAC;KACF,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;AAGJ,SAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMA,kBAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,kDAA2B,uCAAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAsBF,MAAM,QAAQ,MApBa,IAAII,qCAC7BD,YACI;IACE,GAAG,KAAK,OAAO;IACf;IACD,GACD,KAAK,OAAO,SAChB;IACE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CACF,CAEsC,MAAM,GAAG,WAAW;AAE3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,sCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginClient, t as Options } from "./types-DxXfO6iR.cjs";
1
+ import { a as UserPluginWithLifeCycle, n as PluginClient, t as Options } from "./types-MSth0FPg.cjs";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginClientName = "plugin-client";
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { a as UserPluginWithLifeCycle, n as PluginClient, t as Options } from "./types-CRHoY-hv.js";
1
+ import { a as UserPluginWithLifeCycle, n as PluginClient, t as Options } from "./types-DDd1VM_Z.js";
2
2
 
3
3
  //#region src/plugin.d.ts
4
4
  declare const pluginClientName = "plugin-client";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import "./Operations-BCvft948.js";
2
- import { n as groupedClientGenerator, r as clientGenerator, t as operationsGenerator } from "./generators-BQlm15sh.js";
1
+ import "./Operations-B6I1tCOx.js";
2
+ import { i as classClientGenerator, n as groupedClientGenerator, r as clientGenerator, t as operationsGenerator } from "./generators-CsFgdAtO.js";
3
3
  import path from "node:path";
4
4
  import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
5
5
  import { camelCase } from "@kubb/core/transformers";
@@ -13,21 +13,25 @@ const pluginClient = definePlugin((options) => {
13
13
  const { output = {
14
14
  path: "clients",
15
15
  barrelType: "named"
16
- }, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, generators = [
17
- clientGenerator,
18
- group ? groupedClientGenerator : void 0,
16
+ }, 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
+ const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : void 0);
18
+ const defaultGenerators = [
19
+ clientType === "class" ? classClientGenerator : clientGenerator,
20
+ group && clientType !== "class" ? groupedClientGenerator : void 0,
19
21
  operations ? operationsGenerator : void 0
20
- ].filter(Boolean), parser = "client", client = "axios", importPath, contentType, bundle = false } = options;
22
+ ].filter(Boolean);
23
+ const generators = options.generators ?? defaultGenerators;
21
24
  return {
22
25
  name: pluginClientName,
23
26
  options: {
24
27
  client,
28
+ clientType,
25
29
  bundle,
26
30
  output,
27
31
  group,
28
32
  parser,
29
33
  dataReturnType,
30
- importPath: importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : void 0),
34
+ importPath: resolvedImportPath,
31
35
  paramsType,
32
36
  paramsCasing,
33
37
  pathParamsType,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["options","groupName: Group['name']","baseURL"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\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 generators = [clientGenerator, group ? groupedClientGenerator : undefined, operations ? operationsGenerator : undefined].filter(Boolean),\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 return {\n name: pluginClientName,\n options: {\n client,\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: resolveModuleSource(\n this.plugin.options.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\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: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\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 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 logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\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W,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.js","names":["options","groupName: Group['name']","baseURL"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { 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 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 const defaultGenerators = [\n clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType !== 'class' ? groupedClientGenerator : undefined,\n operations ? operationsGenerator : undefined,\n ].filter(Boolean)\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: resolveModuleSource(\n this.plugin.options.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\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: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\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 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 logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAWA,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,UACP;CAEJ,MAAM,qBAAqB,eAAe,CAAC,SAAS,+BAA+B,WAAW;CAC9F,MAAM,oBAAoB;EACxB,eAAe,UAAU,uBAAuB;EAChD,SAAS,eAAe,UAAU,yBAAyB;EAC3D,aAAa,sBAAsB;EACpC,CAAC,OAAO,QAAQ;CAEjB,MAAM,aAAa,QAAQ,cAAc;AAEzC,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA;GACA;GACA;GACA;GACA,YAAY;GACZ;GACA;GACA;GACA;GACA;GACD;EACD,KAAK,CAAC,eAAe,WAAW,QAAQ,gBAAgB,OAAU,CAAC,OAAO,QAAQ;EAClF,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS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ACI;IACE,GAAG,KAAK,OAAO;IACf;IACD,GACD,KAAK,OAAO,SAChB;IACE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,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;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
@@ -1094,6 +1094,13 @@ type Options$1 = {
1094
1094
  * @default 'axios'
1095
1095
  */
1096
1096
  client?: 'axios' | 'fetch';
1097
+ /**
1098
+ * How to generate the client code
1099
+ * - 'function' will generate standalone functions for each operation.
1100
+ * - 'class' will generate a class with methods for each operation.
1101
+ * @default 'function'
1102
+ */
1103
+ clientType?: 'function' | 'class';
1097
1104
  /**
1098
1105
  * Bundle the selected client into the generated `.kubb` directory.
1099
1106
  * When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
@@ -1117,6 +1124,7 @@ type ResolvedOptions = {
1117
1124
  group?: Options$1['group'];
1118
1125
  baseURL: string | undefined;
1119
1126
  client: Options$1['client'];
1127
+ clientType: NonNullable<Options$1['clientType']>;
1120
1128
  bundle: NonNullable<Options$1['bundle']>;
1121
1129
  parser: NonNullable<Options$1['parser']>;
1122
1130
  urlType: NonNullable<Options$1['urlType']>;
@@ -1129,4 +1137,4 @@ type ResolvedOptions = {
1129
1137
  type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1130
1138
  //#endregion
1131
1139
  export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginClient as n, Operation$1 as o, ReactGenerator as r, Options$1 as t };
1132
- //# sourceMappingURL=types-CRHoY-hv.d.ts.map
1140
+ //# sourceMappingURL=types-DDd1VM_Z.d.ts.map
@@ -1094,6 +1094,13 @@ type Options$1 = {
1094
1094
  * @default 'axios'
1095
1095
  */
1096
1096
  client?: 'axios' | 'fetch';
1097
+ /**
1098
+ * How to generate the client code
1099
+ * - 'function' will generate standalone functions for each operation.
1100
+ * - 'class' will generate a class with methods for each operation.
1101
+ * @default 'function'
1102
+ */
1103
+ clientType?: 'function' | 'class';
1097
1104
  /**
1098
1105
  * Bundle the selected client into the generated `.kubb` directory.
1099
1106
  * When disabled the generated clients will import the shared runtime from `@kubb/plugin-client/clients/*`.
@@ -1117,6 +1124,7 @@ type ResolvedOptions = {
1117
1124
  group?: Options$1['group'];
1118
1125
  baseURL: string | undefined;
1119
1126
  client: Options$1['client'];
1127
+ clientType: NonNullable<Options$1['clientType']>;
1120
1128
  bundle: NonNullable<Options$1['bundle']>;
1121
1129
  parser: NonNullable<Options$1['parser']>;
1122
1130
  urlType: NonNullable<Options$1['urlType']>;
@@ -1129,4 +1137,4 @@ type ResolvedOptions = {
1129
1137
  type PluginClient = PluginFactoryOptions<'plugin-client', Options$1, ResolvedOptions, never, ResolvePathOptions>;
1130
1138
  //#endregion
1131
1139
  export { UserPluginWithLifeCycle as a, OperationSchemas as i, PluginClient as n, Operation$1 as o, ReactGenerator as r, Options$1 as t };
1132
- //# sourceMappingURL=types-DxXfO6iR.d.cts.map
1140
+ //# sourceMappingURL=types-MSth0FPg.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "4.8.0",
3
+ "version": "4.9.0",
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",
@@ -88,11 +88,11 @@
88
88
  "dependencies": {
89
89
  "@kubb/react-fabric": "0.5.4",
90
90
  "jiti": "^2.6.1",
91
- "@kubb/core": "4.8.0",
92
- "@kubb/oas": "4.8.0",
93
- "@kubb/plugin-oas": "4.8.0",
94
- "@kubb/plugin-ts": "4.8.0",
95
- "@kubb/plugin-zod": "4.8.0"
91
+ "@kubb/core": "4.9.0",
92
+ "@kubb/oas": "4.9.0",
93
+ "@kubb/plugin-oas": "4.9.0",
94
+ "@kubb/plugin-ts": "4.9.0",
95
+ "@kubb/plugin-zod": "4.9.0"
96
96
  },
97
97
  "devDependencies": {
98
98
  "axios": "^1.13.2"