@kubb/plugin-client 4.28.1 → 4.29.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.
Files changed (72) hide show
  1. package/dist/{StaticClassClient-zUX04A4W.cjs → StaticClassClient-Bo3oBys6.cjs} +2 -2
  2. package/dist/{StaticClassClient-zUX04A4W.cjs.map → StaticClassClient-Bo3oBys6.cjs.map} +1 -1
  3. package/dist/{StaticClassClient-uqlvmwoJ.js → StaticClassClient-DGIMTS_f.js} +15 -15
  4. package/dist/StaticClassClient-DGIMTS_f.js.map +1 -0
  5. package/dist/{chunk-C1_xRkKa.cjs → chunk-CNbaEX1y.cjs} +1 -1
  6. package/dist/{chunk-Cd3iupn7.js → chunk-DKWOrOAv.js} +1 -1
  7. package/dist/clients/axios.cjs +3 -4
  8. package/dist/clients/axios.cjs.map +1 -1
  9. package/dist/clients/axios.d.ts +3 -3
  10. package/dist/clients/axios.js +2 -3
  11. package/dist/clients/axios.js.map +1 -1
  12. package/dist/clients/fetch.cjs +3 -4
  13. package/dist/clients/fetch.cjs.map +1 -1
  14. package/dist/clients/fetch.d.ts +1 -1
  15. package/dist/clients/fetch.js +2 -3
  16. package/dist/clients/fetch.js.map +1 -1
  17. package/dist/components.cjs +2 -1
  18. package/dist/components.d.ts +2 -2
  19. package/dist/components.js +1 -1
  20. package/dist/generators.cjs +7 -6
  21. package/dist/generators.d.ts +2 -2
  22. package/dist/generators.js +1 -1
  23. package/dist/index.cjs +17 -16
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.ts +2 -2
  26. package/dist/index.js +11 -11
  27. package/dist/index.js.map +1 -1
  28. package/dist/{generators-C3iBxAkk.js → staticClassClientGenerator-BUGBMkNO.js} +3 -3
  29. package/dist/staticClassClientGenerator-BUGBMkNO.js.map +1 -0
  30. package/dist/{generators-C4H4RSpu.cjs → staticClassClientGenerator-Ca37etaY.cjs} +3 -3
  31. package/dist/staticClassClientGenerator-Ca37etaY.cjs.map +1 -0
  32. package/dist/templates/clients/axios.source.cjs +7 -2
  33. package/dist/templates/clients/axios.source.cjs.map +1 -0
  34. package/dist/templates/clients/axios.source.d.ts +1 -1
  35. package/dist/templates/clients/axios.source.js +5 -2
  36. package/dist/templates/clients/axios.source.js.map +1 -0
  37. package/dist/templates/clients/fetch.source.cjs +7 -2
  38. package/dist/templates/clients/fetch.source.cjs.map +1 -0
  39. package/dist/templates/clients/fetch.source.d.ts +1 -1
  40. package/dist/templates/clients/fetch.source.js +5 -2
  41. package/dist/templates/clients/fetch.source.js.map +1 -0
  42. package/dist/templates/config.source.cjs +7 -2
  43. package/dist/templates/config.source.cjs.map +1 -0
  44. package/dist/templates/config.source.d.ts +1 -1
  45. package/dist/templates/config.source.js +5 -2
  46. package/dist/templates/config.source.js.map +1 -0
  47. package/dist/{types-BCu9gRSm.d.ts → types-DGWXyUI0.d.ts} +4 -5
  48. package/dist/{types-B-chJOb6.d.cts → types-nY6q8qQK.d.ts} +4 -5
  49. package/package.json +22 -23
  50. package/dist/StaticClassClient-uqlvmwoJ.js.map +0 -1
  51. package/dist/axios.source-CDcg9aL-.js +0 -6
  52. package/dist/axios.source-CDcg9aL-.js.map +0 -1
  53. package/dist/axios.source-CRSmc9GC.cjs +0 -12
  54. package/dist/axios.source-CRSmc9GC.cjs.map +0 -1
  55. package/dist/clients/axios.d.cts +0 -43
  56. package/dist/clients/fetch.d.cts +0 -43
  57. package/dist/components.d.cts +0 -216
  58. package/dist/config.source-CiegvD_s.cjs +0 -12
  59. package/dist/config.source-CiegvD_s.cjs.map +0 -1
  60. package/dist/config.source-VWEtFolK.js +0 -6
  61. package/dist/config.source-VWEtFolK.js.map +0 -1
  62. package/dist/fetch.source-BVpZ9vJe.cjs +0 -12
  63. package/dist/fetch.source-BVpZ9vJe.cjs.map +0 -1
  64. package/dist/fetch.source-DkBhuGC1.js +0 -6
  65. package/dist/fetch.source-DkBhuGC1.js.map +0 -1
  66. package/dist/generators-C3iBxAkk.js.map +0 -1
  67. package/dist/generators-C4H4RSpu.cjs.map +0 -1
  68. package/dist/generators.d.cts +0 -480
  69. package/dist/index.d.cts +0 -10
  70. package/dist/templates/clients/axios.source.d.cts +0 -7
  71. package/dist/templates/clients/fetch.source.d.cts +0 -7
  72. package/dist/templates/config.source.d.cts +0 -7
@@ -1,5 +1,5 @@
1
- import { t as __name } from "./chunk-Cd3iupn7.js";
2
- import { r as PluginClient } from "./types-BCu9gRSm.js";
1
+ import { t as __name } from "./chunk-DKWOrOAv.js";
2
+ import { r as PluginClient } from "./types-nY6q8qQK.js";
3
3
  import { OperationSchemas } from "@kubb/plugin-oas";
4
4
  import { FunctionParams } from "@kubb/react-fabric";
5
5
  import { Operation } from "@kubb/oas";
@@ -1,3 +1,3 @@
1
- import { a as Url, i as Client, n as Operations, r as ClassClient, t as StaticClassClient } from "./StaticClassClient-uqlvmwoJ.js";
1
+ import { a as Url, i as Client, n as Operations, r as ClassClient, t as StaticClassClient } from "./StaticClassClient-DGIMTS_f.js";
2
2
 
3
3
  export { ClassClient, Client, Operations, StaticClassClient, Url };
@@ -1,7 +1,8 @@
1
- const require_generators = require('./generators-C4H4RSpu.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_staticClassClientGenerator = require('./staticClassClientGenerator-Ca37etaY.cjs');
2
3
 
3
- exports.classClientGenerator = require_generators.classClientGenerator;
4
- exports.clientGenerator = require_generators.clientGenerator;
5
- exports.groupedClientGenerator = require_generators.groupedClientGenerator;
6
- exports.operationsGenerator = require_generators.operationsGenerator;
7
- exports.staticClassClientGenerator = require_generators.staticClassClientGenerator;
4
+ exports.classClientGenerator = require_staticClassClientGenerator.classClientGenerator;
5
+ exports.clientGenerator = require_staticClassClientGenerator.clientGenerator;
6
+ exports.groupedClientGenerator = require_staticClassClientGenerator.groupedClientGenerator;
7
+ exports.operationsGenerator = require_staticClassClientGenerator.operationsGenerator;
8
+ exports.staticClassClientGenerator = require_staticClassClientGenerator.staticClassClientGenerator;
@@ -1,5 +1,5 @@
1
- import { t as __name } from "./chunk-Cd3iupn7.js";
2
- import { r as PluginClient } from "./types-BCu9gRSm.js";
1
+ import { t as __name } from "./chunk-DKWOrOAv.js";
2
+ import { r as PluginClient } from "./types-nY6q8qQK.js";
3
3
  import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
4
4
  import { Fabric } from "@kubb/react-fabric";
5
5
  import { AsyncEventEmitter } from "@kubb/core/utils";
@@ -1,3 +1,3 @@
1
- import { a as classClientGenerator, i as clientGenerator, n as operationsGenerator, r as groupedClientGenerator, t as staticClassClientGenerator } from "./generators-C3iBxAkk.js";
1
+ import { a as classClientGenerator, i as clientGenerator, n as operationsGenerator, r as groupedClientGenerator, t as staticClassClientGenerator } from "./staticClassClientGenerator-BUGBMkNO.js";
2
2
 
3
3
  export { classClientGenerator, clientGenerator, groupedClientGenerator, operationsGenerator, staticClassClientGenerator };
package/dist/index.cjs CHANGED
@@ -1,8 +1,9 @@
1
- const require_chunk = require('./chunk-C1_xRkKa.cjs');
2
- const require_generators = require('./generators-C4H4RSpu.cjs');
3
- const require_axios_source = require('./axios.source-CRSmc9GC.cjs');
4
- const require_fetch_source = require('./fetch.source-BVpZ9vJe.cjs');
5
- const require_config_source = require('./config.source-CiegvD_s.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_chunk = require('./chunk-CNbaEX1y.cjs');
3
+ const require_staticClassClientGenerator = require('./staticClassClientGenerator-Ca37etaY.cjs');
4
+ const require_templates_clients_axios_source = require('./templates/clients/axios.source.cjs');
5
+ const require_templates_clients_fetch_source = require('./templates/clients/fetch.source.cjs');
6
+ const require_templates_config_source = require('./templates/config.source.cjs');
6
7
  let node_path = require("node:path");
7
8
  node_path = require_chunk.__toESM(node_path);
8
9
  let _kubb_core = require("@kubb/core");
@@ -19,9 +20,9 @@ const pluginClient = (0, _kubb_core.definePlugin)((options) => {
19
20
  }, 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;
20
21
  const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : void 0);
21
22
  const defaultGenerators = [
22
- clientType === "staticClass" ? require_generators.staticClassClientGenerator : clientType === "class" ? require_generators.classClientGenerator : require_generators.clientGenerator,
23
- group && clientType === "function" ? require_generators.groupedClientGenerator : void 0,
24
- operations ? require_generators.operationsGenerator : void 0
23
+ clientType === "staticClass" ? require_staticClassClientGenerator.staticClassClientGenerator : clientType === "class" ? require_staticClassClientGenerator.classClientGenerator : require_staticClassClientGenerator.clientGenerator,
24
+ group && clientType === "function" ? require_staticClassClientGenerator.groupedClientGenerator : void 0,
25
+ operations ? require_staticClassClientGenerator.operationsGenerator : void 0
25
26
  ].filter(Boolean);
26
27
  const generators = options.generators ?? defaultGenerators;
27
28
  return {
@@ -42,7 +43,7 @@ const pluginClient = (0, _kubb_core.definePlugin)((options) => {
42
43
  urlType
43
44
  },
44
45
  pre: [_kubb_plugin_oas.pluginOasName, parser === "zod" ? _kubb_plugin_zod.pluginZodName : void 0].filter(Boolean),
45
- resolvePath(baseName, pathMode, options$1) {
46
+ resolvePath(baseName, pathMode, options) {
46
47
  const root = node_path.default.resolve(this.config.root, this.config.output.path);
47
48
  if ((pathMode ?? (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
48
49
  /**
@@ -50,12 +51,12 @@ const pluginClient = (0, _kubb_core.definePlugin)((options) => {
50
51
  * Other plugins then need to call addOrAppend instead of just add from the fileManager class
51
52
  */
52
53
  return node_path.default.resolve(root, output.path);
53
- if (group && (options$1?.group?.path || options$1?.group?.tag)) {
54
+ if (group && (options?.group?.path || options?.group?.tag)) {
54
55
  const groupName = group?.name ? group.name : (ctx) => {
55
56
  if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
56
57
  return `${(0, _kubb_core_transformers.camelCase)(ctx.group)}Controller`;
57
58
  };
58
- return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options$1.group.path : options$1.group.tag }), baseName);
59
+ return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
59
60
  }
60
61
  return node_path.default.resolve(root, output.path, baseName);
61
62
  },
@@ -68,13 +69,13 @@ const pluginClient = (0, _kubb_core.definePlugin)((options) => {
68
69
  const root = node_path.default.resolve(this.config.root, this.config.output.path);
69
70
  const mode = (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path));
70
71
  const oas = await this.getOas();
71
- const baseURL$1 = await this.getBaseURL();
72
+ const baseURL = await this.getBaseURL();
72
73
  if (bundle && !this.plugin.options.importPath) await this.addFile({
73
74
  baseName: "fetch.ts",
74
75
  path: node_path.default.resolve(root, ".kubb/fetch.ts"),
75
76
  sources: [{
76
77
  name: "fetch",
77
- value: this.plugin.options.client === "fetch" ? require_fetch_source.source : require_axios_source.source,
78
+ value: this.plugin.options.client === "fetch" ? require_templates_clients_fetch_source.source : require_templates_clients_axios_source.source,
78
79
  isExportable: true,
79
80
  isIndexable: true
80
81
  }],
@@ -86,16 +87,16 @@ const pluginClient = (0, _kubb_core.definePlugin)((options) => {
86
87
  path: node_path.default.resolve(root, ".kubb/config.ts"),
87
88
  sources: [{
88
89
  name: "config",
89
- value: require_config_source.source,
90
+ value: require_templates_config_source.source,
90
91
  isExportable: false,
91
92
  isIndexable: false
92
93
  }],
93
94
  imports: [],
94
95
  exports: []
95
96
  });
96
- const files = await new _kubb_plugin_oas.OperationGenerator(baseURL$1 ? {
97
+ const files = await new _kubb_plugin_oas.OperationGenerator(baseURL ? {
97
98
  ...this.plugin.options,
98
- baseURL: baseURL$1
99
+ baseURL
99
100
  } : this.plugin.options, {
100
101
  fabric: this.fabric,
101
102
  oas,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["staticClassClientGenerator","classClientGenerator","clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","path","options","baseURL","fetchClientSource","axiosClientSource","configSource","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 { 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(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: 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,6CAA2C,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;CAE9F,MAAM,oBAAoB;EACxB,eAAe,gBAAgBA,gDAA6B,eAAe,UAAUC,0CAAuBC;EAC5G,SAAS,eAAe,aAAaC,4CAAyB;EAC9D,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,gCAAe,WAAW,QAAQC,iCAAgB,OAAU,CAAC,OAAO,QAAQ;EAClF,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,oCAAoBA,kBAAK,QAAQ,MAA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AAS,CACP;KACE,MAAM;KACN,OAAOK;KACP,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAuBF,MAAM,QAAQ,MArBa,IAAIC,oCAC7BJ,YACI;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,qCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["staticClassClientGenerator","classClientGenerator","clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","path","fetchClientSource","axiosClientSource","configSource","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 { 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(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: 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,6CAA2C,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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OA,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,+BAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACrD,MAAM,MAAM,MAAM,KAAK,QAAQ;GAC/B,MAAM,UAAU,MAAM,KAAK,YAAY;AAGvC,OAAI,UAAU,CAAC,KAAK,OAAO,QAAQ,WACjC,OAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMA,kBAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACP;KACE,MAAM;KACN,OAAO,KAAK,OAAO,QAAQ,WAAW,UAAUC,gDAAoBC;KACpE,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;AAGJ,SAAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMF,kBAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,OAAOG;KACP,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAuBF,MAAM,QAAQ,MArBa,IAAIC,oCAC7B,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,qCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { t as __name } from "./chunk-Cd3iupn7.js";
2
- import { n as Options, r as PluginClient, t as ClientImportPath } from "./types-BCu9gRSm.js";
1
+ import { t as __name } from "./chunk-DKWOrOAv.js";
2
+ import { n as Options, r as PluginClient, t as ClientImportPath } from "./types-nY6q8qQK.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,8 +1,8 @@
1
- import { t as __name } from "./chunk-Cd3iupn7.js";
2
- import { a as classClientGenerator, i as clientGenerator, n as operationsGenerator, r as groupedClientGenerator, t as staticClassClientGenerator } from "./generators-C3iBxAkk.js";
3
- import { t as source } from "./axios.source-CDcg9aL-.js";
4
- import { t as source$1 } from "./fetch.source-DkBhuGC1.js";
5
- import { t as source$2 } from "./config.source-VWEtFolK.js";
1
+ import { t as __name } from "./chunk-DKWOrOAv.js";
2
+ import { a as classClientGenerator, i as clientGenerator, n as operationsGenerator, r as groupedClientGenerator, t as staticClassClientGenerator } from "./staticClassClientGenerator-BUGBMkNO.js";
3
+ import { source } from "./templates/clients/axios.source.js";
4
+ import { source as source$1 } from "./templates/clients/fetch.source.js";
5
+ import { source as source$2 } from "./templates/config.source.js";
6
6
  import path from "node:path";
7
7
  import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
8
8
  import { camelCase } from "@kubb/core/transformers";
@@ -41,7 +41,7 @@ const pluginClient = definePlugin((options) => {
41
41
  urlType
42
42
  },
43
43
  pre: [pluginOasName, parser === "zod" ? pluginZodName : void 0].filter(Boolean),
44
- resolvePath(baseName, pathMode, options$1) {
44
+ resolvePath(baseName, pathMode, options) {
45
45
  const root = path.resolve(this.config.root, this.config.output.path);
46
46
  if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
47
47
  /**
@@ -49,12 +49,12 @@ const pluginClient = definePlugin((options) => {
49
49
  * Other plugins then need to call addOrAppend instead of just add from the fileManager class
50
50
  */
51
51
  return path.resolve(root, output.path);
52
- if (group && (options$1?.group?.path || options$1?.group?.tag)) {
52
+ if (group && (options?.group?.path || options?.group?.tag)) {
53
53
  const groupName = group?.name ? group.name : (ctx) => {
54
54
  if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
55
55
  return `${camelCase(ctx.group)}Controller`;
56
56
  };
57
- return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options$1.group.path : options$1.group.tag }), baseName);
57
+ return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
58
58
  }
59
59
  return path.resolve(root, output.path, baseName);
60
60
  },
@@ -67,7 +67,7 @@ const pluginClient = definePlugin((options) => {
67
67
  const root = path.resolve(this.config.root, this.config.output.path);
68
68
  const mode = getMode(path.resolve(root, output.path));
69
69
  const oas = await this.getOas();
70
- const baseURL$1 = await this.getBaseURL();
70
+ const baseURL = await this.getBaseURL();
71
71
  if (bundle && !this.plugin.options.importPath) await this.addFile({
72
72
  baseName: "fetch.ts",
73
73
  path: path.resolve(root, ".kubb/fetch.ts"),
@@ -92,9 +92,9 @@ const pluginClient = definePlugin((options) => {
92
92
  imports: [],
93
93
  exports: []
94
94
  });
95
- const files = await new OperationGenerator(baseURL$1 ? {
95
+ const files = await new OperationGenerator(baseURL ? {
96
96
  ...this.plugin.options,
97
- baseURL: baseURL$1
97
+ baseURL
98
98
  } : this.plugin.options, {
99
99
  fabric: this.fabric,
100
100
  oas,
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["options","baseURL","fetchClientSource","axiosClientSource","configSource"],"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 { 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(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: 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,S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,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"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 { 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(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: 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,UACP;CAEJ,MAAM,qBAAqB,eAAe,CAAC,SAAS,+BAA+B,WAAW;CAE9F,MAAM,oBAAoB;EACxB,eAAe,gBAAgB,6BAA6B,eAAe,UAAU,uBAAuB;EAC5G,SAAS,eAAe,aAAa,yBAAyB;EAC9D,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,SAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO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,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"}
@@ -1,5 +1,5 @@
1
- import { t as __name } from "./chunk-Cd3iupn7.js";
2
- import { a as Url, i as Client, n as Operations, r as ClassClient, t as StaticClassClient } from "./StaticClassClient-uqlvmwoJ.js";
1
+ import { t as __name } from "./chunk-DKWOrOAv.js";
2
+ import { a as Url, i as Client, n as Operations, r as ClassClient, t as StaticClassClient } from "./StaticClassClient-DGIMTS_f.js";
3
3
  import path from "node:path";
4
4
  import { camelCase, pascalCase } from "@kubb/core/transformers";
5
5
  import { pluginZodName } from "@kubb/plugin-zod";
@@ -666,4 +666,4 @@ const staticClassClientGenerator = createReactGenerator({
666
666
 
667
667
  //#endregion
668
668
  export { classClientGenerator as a, clientGenerator as i, operationsGenerator as n, groupedClientGenerator as r, staticClassClientGenerator as t };
669
- //# sourceMappingURL=generators-C3iBxAkk.js.map
669
+ //# sourceMappingURL=staticClassClientGenerator-BUGBMkNO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staticClassClientGenerator-BUGBMkNO.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 { 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 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 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","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 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,EAA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AAC9C,UAAI,CAAC,SACH,QAAO;MAET,MAAM,cAAc,MAAM,KAAK,QAAQ,CAAC,OAAO,QAAQ;AACvD,UAAI,YAAY,WAAW,EACzB,QAAO;AAET,aAAO,oBAAC,KAAK;OAAsB,MAAM;OAAa,MAAM,KAAK;OAAM,MAAM,SAAS;OAAM;SAAnE,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,oBAAC,KAAK;OAAsB,MAAM;OAAa,MAAM,KAAK;OAAM,MAAM,QAAQ;SAA5D,SAAoE;OAC7F;KAEJ,oBAAC;MACO;MACN,YAAY;MACZ,SAAS,QAAQ;MACjB,gBAAgB,QAAQ;MACxB,gBAAgB,QAAQ;MACxB,cAAc,QAAQ;MACtB,YAAY,QAAQ;MACpB,QAAQ,QAAQ;OAChB;;MA/DG,KAAK,KAgEL;IAET;;CAEL,CAAC"}
@@ -1,5 +1,5 @@
1
- const require_chunk = require('./chunk-C1_xRkKa.cjs');
2
- const require_StaticClassClient = require('./StaticClassClient-zUX04A4W.cjs');
1
+ const require_chunk = require('./chunk-CNbaEX1y.cjs');
2
+ const require_StaticClassClient = require('./StaticClassClient-Bo3oBys6.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");
@@ -696,4 +696,4 @@ Object.defineProperty(exports, 'staticClassClientGenerator', {
696
696
  return staticClassClientGenerator;
697
697
  }
698
698
  });
699
- //# sourceMappingURL=generators-C4H4RSpu.cjs.map
699
+ //# sourceMappingURL=staticClassClientGenerator-Ca37etaY.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"staticClassClientGenerator-Ca37etaY.cjs","names":["pluginTsName","pluginZodName","File","path","ClassClient","pluginTsName","pluginZodName","File","path","Url","Client","File","Function","File","Operations","pluginTsName","pluginZodName","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 { 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 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 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","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 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,6EAA0D;CACrE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,QAAQ,UAAU;EACpD,MAAM,EAAE,SAAS,KAAK,cAAc;EACpC,MAAM,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C,CAAC,KAAK,CAAC,UAAU,aAAa;MACpE,MAAM,WAAW,gBAAgB,IAAI,SAAS;AAC9C,UAAI,CAAC,SACH,QAAO;MAET,MAAM,cAAc,MAAM,KAAK,QAAQ,CAAC,OAAO,QAAQ;AACvD,UAAI,YAAY,WAAW,EACzB,QAAO;AAET,aAAO,wDAACD,wBAAK;OAAsB,MAAM;OAAa,MAAM,KAAK;OAAM,MAAM,SAAS;OAAM;SAAnE,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,wDAACA,wBAAK;OAAsB,MAAM;OAAa,MAAM,KAAK;OAAM,MAAM,QAAQ;SAA5D,SAAoE;OAC7F;KAEJ,wDAACE;MACO;MACN,YAAY;MACZ,SAAS,QAAQ;MACjB,gBAAgB,QAAQ;MACxB,gBAAgB,QAAQ;MACxB,cAAc,QAAQ;MACtB,YAAY,QAAQ;MACpB,QAAQ,QAAQ;OAChB;;MA/DG,KAAK,KAgEL;IAET;;CAEL,CAAC"}
@@ -1,3 +1,8 @@
1
- const require_axios_source = require('../../axios.source-CRSmc9GC.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- exports.source = require_axios_source.source;
3
+ //#region src/templates/clients/axios.source.ts
4
+ const source = "import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport axios from 'axios'\n\ndeclare const AXIOS_BASE: string\ndeclare const AXIOS_HEADERS: string\n\n/**\n * Subset of AxiosRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method?: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD'\n params?: unknown\n data?: TData | FormData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n validateStatus?: (status: number) => boolean\n headers?: AxiosRequestConfig['headers']\n}\n\n/**\n * Subset of AxiosResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers: AxiosResponse['headers']\n}\n\nexport type ResponseErrorConfig<TError = unknown> = AxiosError<TError>\n\nexport type Client = <TData, _TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>) => Promise<ResponseConfig<TData>>\n\nlet _config: Partial<RequestConfig> = {\n baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,\n headers: typeof AXIOS_HEADERS !== 'undefined' ? JSON.parse(AXIOS_HEADERS) : undefined,\n}\n\nexport const getConfig = () => _config\n\nexport const setConfig = (config: RequestConfig) => {\n _config = config\n return getConfig()\n}\n\nexport const mergeConfig = <T extends RequestConfig>(...configs: Array<Partial<T>>): Partial<T> => {\n return configs.reduce<Partial<T>>((merged, config) => {\n return {\n ...merged,\n ...config,\n headers: {\n ...merged.headers,\n ...config.headers,\n },\n }\n }, {})\n}\n\nexport const axiosInstance = axios.create(getConfig())\n\nexport const fetch = async <TData, TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>): Promise<ResponseConfig<TData>> => {\n return axiosInstance.request<TData, ResponseConfig<TData>>(mergeConfig(getConfig(), config)).catch((e: AxiosError<TError>) => {\n throw e\n })\n}\n\nfetch.getConfig = getConfig\nfetch.setConfig = setConfig\n";
5
+
6
+ //#endregion
7
+ exports.source = source;
8
+ //# sourceMappingURL=axios.source.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios.source.cjs","names":[],"sources":["../../../src/templates/clients/axios.source.ts"],"sourcesContent":["// @ts-expect-error - import attributes are handled at build time by importAttributeTextPlugin\nimport content from '../../../templates/clients/axios.ts' with { type: 'text' }\n\nexport const source = content as string\n"],"mappings":";;;AAAA,MAAa,SAAS"}
@@ -1,4 +1,4 @@
1
- import { t as __name } from "../../chunk-Cd3iupn7.js";
1
+ import { t as __name } from "../../chunk-DKWOrOAv.js";
2
2
 
3
3
  //#region src/templates/clients/axios.source.d.ts
4
4
  declare const source: string;
@@ -1,3 +1,6 @@
1
- import { t as source } from "../../axios.source-CDcg9aL-.js";
1
+ //#region src/templates/clients/axios.source.ts
2
+ const source = "import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'\nimport axios from 'axios'\n\ndeclare const AXIOS_BASE: string\ndeclare const AXIOS_HEADERS: string\n\n/**\n * Subset of AxiosRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method?: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD'\n params?: unknown\n data?: TData | FormData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n validateStatus?: (status: number) => boolean\n headers?: AxiosRequestConfig['headers']\n}\n\n/**\n * Subset of AxiosResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers: AxiosResponse['headers']\n}\n\nexport type ResponseErrorConfig<TError = unknown> = AxiosError<TError>\n\nexport type Client = <TData, _TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>) => Promise<ResponseConfig<TData>>\n\nlet _config: Partial<RequestConfig> = {\n baseURL: typeof AXIOS_BASE !== 'undefined' ? AXIOS_BASE : undefined,\n headers: typeof AXIOS_HEADERS !== 'undefined' ? JSON.parse(AXIOS_HEADERS) : undefined,\n}\n\nexport const getConfig = () => _config\n\nexport const setConfig = (config: RequestConfig) => {\n _config = config\n return getConfig()\n}\n\nexport const mergeConfig = <T extends RequestConfig>(...configs: Array<Partial<T>>): Partial<T> => {\n return configs.reduce<Partial<T>>((merged, config) => {\n return {\n ...merged,\n ...config,\n headers: {\n ...merged.headers,\n ...config.headers,\n },\n }\n }, {})\n}\n\nexport const axiosInstance = axios.create(getConfig())\n\nexport const fetch = async <TData, TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>): Promise<ResponseConfig<TData>> => {\n return axiosInstance.request<TData, ResponseConfig<TData>>(mergeConfig(getConfig(), config)).catch((e: AxiosError<TError>) => {\n throw e\n })\n}\n\nfetch.getConfig = getConfig\nfetch.setConfig = setConfig\n";
2
3
 
3
- export { source };
4
+ //#endregion
5
+ export { source };
6
+ //# sourceMappingURL=axios.source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axios.source.js","names":[],"sources":["../../../src/templates/clients/axios.source.ts"],"sourcesContent":["// @ts-expect-error - import attributes are handled at build time by importAttributeTextPlugin\nimport content from '../../../templates/clients/axios.ts' with { type: 'text' }\n\nexport const source = content as string\n"],"mappings":";AAAA,MAAa,SAAS"}
@@ -1,3 +1,8 @@
1
- const require_fetch_source = require('../../fetch.source-BVpZ9vJe.cjs');
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
 
3
- exports.source = require_fetch_source.source;
3
+ //#region src/templates/clients/fetch.source.ts
4
+ const source = "/**\n * RequestCredentials\n */\nexport type RequestCredentials = 'omit' | 'same-origin' | 'include'\n\n/**\n * Subset of FetchRequestConfig\n */\nexport type RequestConfig<TData = unknown> = {\n baseURL?: string\n url?: string\n method?: 'GET' | 'PUT' | 'PATCH' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD'\n params?: unknown\n data?: TData | FormData\n responseType?: 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream'\n signal?: AbortSignal\n headers?: [string, string][] | Record<string, string>\n credentials?: RequestCredentials\n}\n\n/**\n * Subset of FetchResponse\n */\nexport type ResponseConfig<TData = unknown> = {\n data: TData\n status: number\n statusText: string\n headers: Headers\n}\n\nlet _config: Partial<RequestConfig> = {}\n\nexport const getConfig = () => _config\n\nexport const setConfig = (config: Partial<RequestConfig>) => {\n _config = config\n return getConfig()\n}\n\nexport const mergeConfig = <T extends RequestConfig>(...configs: Array<Partial<T>>): Partial<T> => {\n return configs.reduce<Partial<T>>((merged, config) => {\n return {\n ...merged,\n ...config,\n headers: {\n ...(Array.isArray(merged.headers) ? Object.fromEntries(merged.headers) : merged.headers),\n ...(Array.isArray(config.headers) ? Object.fromEntries(config.headers) : config.headers),\n },\n }\n }, {})\n}\n\nexport type ResponseErrorConfig<TError = unknown> = TError\n\nexport type Client = <TData, _TError = unknown, TVariables = unknown>(config: RequestConfig<TVariables>) => Promise<ResponseConfig<TData>>\n\nexport const fetch = async <TData, _TError = unknown, TVariables = unknown>(paramsConfig: RequestConfig<TVariables>): Promise<ResponseConfig<TData>> => {\n const normalizedParams = new URLSearchParams()\n\n const config = mergeConfig(getConfig(), paramsConfig)\n\n Object.entries(config.params || {}).forEach(([key, value]) => {\n if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : value.toString())\n }\n })\n\n let targetUrl = [config.baseURL, config.url].filter(Boolean).join('')\n\n if (config.params) {\n targetUrl += `?${normalizedParams}`\n }\n\n const response = await globalThis.fetch(targetUrl, {\n credentials: config.credentials || 'same-origin',\n method: config.method?.toUpperCase(),\n body: config.data instanceof FormData ? config.data : JSON.stringify(config.data),\n signal: config.signal,\n headers: config.headers,\n })\n\n const data = [204, 205, 304].includes(response.status) || !response.body ? {} : await response.json()\n\n return {\n data: data as TData,\n status: response.status,\n statusText: response.statusText,\n headers: response.headers as Headers,\n }\n}\n\nfetch.getConfig = getConfig\nfetch.setConfig = setConfig\n";
5
+
6
+ //#endregion
7
+ exports.source = source;
8
+ //# sourceMappingURL=fetch.source.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.source.cjs","names":[],"sources":["../../../src/templates/clients/fetch.source.ts"],"sourcesContent":["// @ts-expect-error - import attributes are handled at build time by importAttributeTextPlugin\nimport content from '../../../templates/clients/fetch.ts' with { type: 'text' }\n\nexport const source = content as string\n"],"mappings":";;;AAAA,MAAa,SAAS"}