@kubb/plugin-client 3.0.0-alpha.13 → 3.0.0-alpha.15

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 (41) hide show
  1. package/dist/{chunk-QBFKND4S.js → chunk-BAX6ZFGY.js} +3 -3
  2. package/dist/chunk-BAX6ZFGY.js.map +1 -0
  3. package/dist/chunk-H2OOHGK2.js +147 -0
  4. package/dist/chunk-H2OOHGK2.js.map +1 -0
  5. package/dist/chunk-TNO4CNBR.cjs +156 -0
  6. package/dist/chunk-TNO4CNBR.cjs.map +1 -0
  7. package/dist/{chunk-PO22ZUSH.cjs → chunk-XDWPA5EL.cjs} +3 -3
  8. package/dist/chunk-XDWPA5EL.cjs.map +1 -0
  9. package/dist/components.cjs +3 -4
  10. package/dist/components.d.cts +10 -2
  11. package/dist/components.d.ts +10 -2
  12. package/dist/components.js +1 -2
  13. package/dist/generators.cjs +8 -4
  14. package/dist/generators.d.cts +5 -3
  15. package/dist/generators.d.ts +5 -3
  16. package/dist/generators.js +2 -2
  17. package/dist/index.cjs +9 -107
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +2 -2
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +2 -106
  22. package/dist/index.js.map +1 -1
  23. package/dist/{types-DETYKDFZ.d.cts → types-CzL-44IA.d.cts} +18 -34
  24. package/dist/{types-DETYKDFZ.d.ts → types-CzL-44IA.d.ts} +18 -34
  25. package/package.json +12 -12
  26. package/src/components/Client.tsx +2 -2
  27. package/src/generators/{axiosGenerator.tsx → clientGenerator.tsx} +9 -26
  28. package/src/generators/index.ts +2 -1
  29. package/src/generators/operationsGenerator.tsx +21 -0
  30. package/src/plugin.ts +8 -15
  31. package/src/types.ts +17 -28
  32. package/dist/chunk-3NQF7BGA.cjs +0 -58
  33. package/dist/chunk-3NQF7BGA.cjs.map +0 -1
  34. package/dist/chunk-AZDWYBLW.cjs +0 -4
  35. package/dist/chunk-AZDWYBLW.cjs.map +0 -1
  36. package/dist/chunk-PO22ZUSH.cjs.map +0 -1
  37. package/dist/chunk-QBFKND4S.js.map +0 -1
  38. package/dist/chunk-QLVGX3VO.js +0 -56
  39. package/dist/chunk-QLVGX3VO.js.map +0 -1
  40. package/dist/chunk-YJOVLRSC.js +0 -3
  41. package/dist/chunk-YJOVLRSC.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -1,115 +1,17 @@
1
1
  'use strict';
2
2
 
3
- require('./chunk-AZDWYBLW.cjs');
4
- var chunk3NQF7BGA_cjs = require('./chunk-3NQF7BGA.cjs');
5
- var chunkPO22ZUSH_cjs = require('./chunk-PO22ZUSH.cjs');
6
- var path = require('path');
7
- var core = require('@kubb/core');
8
- var transformers = require('@kubb/core/transformers');
9
- var utils = require('@kubb/core/utils');
10
- var pluginOas = require('@kubb/plugin-oas');
3
+ var chunkTNO4CNBR_cjs = require('./chunk-TNO4CNBR.cjs');
4
+ require('./chunk-XDWPA5EL.cjs');
11
5
 
12
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
6
 
14
- var path__default = /*#__PURE__*/_interopDefault(path);
15
7
 
16
- var pluginClientName = "plugin-client";
17
- var pluginClient = core.createPlugin((options) => {
18
- const {
19
- output = { path: "clients" },
20
- group,
21
- exclude = [],
22
- include,
23
- override = [],
24
- transformers: transformers$1 = {},
25
- dataReturnType = "data",
26
- pathParamsType = "inline",
27
- templates
28
- } = options;
29
- const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`;
30
- return {
31
- name: pluginClientName,
32
- output: {
33
- exportType: "barrelNamed",
34
- ...output
35
- },
36
- options: {
37
- extName: output.extName,
38
- dataReturnType,
39
- client: {
40
- importPath: "@kubb/plugin-client/client",
41
- methods: ["get", "post", "delete", "put"],
42
- ...options.client
43
- },
44
- pathParamsType,
45
- templates: {
46
- operations: chunkPO22ZUSH_cjs.Operations,
47
- client: chunkPO22ZUSH_cjs.Client,
48
- ...templates
49
- },
50
- baseURL: void 0
51
- },
52
- pre: [pluginOas.pluginOasName],
53
- resolvePath(baseName, pathMode, options2) {
54
- const root = path__default.default.resolve(this.config.root, this.config.output.path);
55
- const mode = pathMode ?? core.FileManager.getMode(path__default.default.resolve(root, output.path));
56
- if (mode === "single") {
57
- return path__default.default.resolve(root, output.path);
58
- }
59
- if (options2?.tag && group?.type === "tag") {
60
- const tag = transformers.camelCase(options2.tag);
61
- return path__default.default.resolve(root, utils.renderTemplate(template, { tag }), baseName);
62
- }
63
- return path__default.default.resolve(root, output.path, baseName);
64
- },
65
- resolveName(name, type) {
66
- const resolvedName = transformers.camelCase(name, { isFile: type === "file" });
67
- if (type) {
68
- return transformers$1?.name?.(resolvedName, type) || resolvedName;
69
- }
70
- return resolvedName;
71
- },
72
- async buildStart() {
73
- const [swaggerPlugin] = core.PluginManager.getDependedPlugins(this.plugins, [pluginOas.pluginOasName]);
74
- const oas = await swaggerPlugin.context.getOas();
75
- const root = path__default.default.resolve(this.config.root, this.config.output.path);
76
- const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path));
77
- const baseURL = await swaggerPlugin.context.getBaseURL();
78
- const operationGenerator = new pluginOas.OperationGenerator(
79
- {
80
- ...this.plugin.options,
81
- baseURL
82
- },
83
- {
84
- oas,
85
- pluginManager: this.pluginManager,
86
- plugin: this.plugin,
87
- contentType: swaggerPlugin.context.contentType,
88
- exclude,
89
- include,
90
- override,
91
- mode
92
- }
93
- );
94
- const files = await operationGenerator.build(chunk3NQF7BGA_cjs.axiosGenerator);
95
- await this.addFile(...files);
96
- if (this.config.output.exportType) {
97
- const barrelFiles = await this.fileManager.getBarrelFiles({
98
- root,
99
- output,
100
- files: this.fileManager.files,
101
- meta: {
102
- pluginKey: this.plugin.key
103
- },
104
- logger: this.logger
105
- });
106
- await this.addFile(...barrelFiles);
107
- }
108
- }
109
- };
8
+ Object.defineProperty(exports, "pluginClient", {
9
+ enumerable: true,
10
+ get: function () { return chunkTNO4CNBR_cjs.pluginClient; }
11
+ });
12
+ Object.defineProperty(exports, "pluginClientName", {
13
+ enumerable: true,
14
+ get: function () { return chunkTNO4CNBR_cjs.pluginClientName; }
110
15
  });
111
-
112
- exports.pluginClient = pluginClient;
113
- exports.pluginClientName = pluginClientName;
114
16
  //# sourceMappingURL=index.cjs.map
115
17
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/plugin.ts"],"names":["createPlugin","transformers","Operations","Client","pluginOasName","options","path","FileManager","camelCase","renderTemplate","PluginManager","OperationGenerator","axiosGenerator"],"mappings":";;;;;;;;;;;;;;;AAcO,IAAM,gBAAmB,GAAA,gBAAA;AAEnB,IAAA,YAAA,GAAeA,iBAA2B,CAAA,CAAC,OAAY,KAAA;AAClE,EAAM,MAAA;AAAA,IACJ,MAAA,GAAS,EAAE,IAAA,EAAM,SAAU,EAAA;AAAA,IAC3B,KAAA;AAAA,IACA,UAAU,EAAC;AAAA,IACX,OAAA;AAAA,IACA,WAAW,EAAC;AAAA,kBACZC,iBAAe,EAAC;AAAA,IAChB,cAAiB,GAAA,MAAA;AAAA,IACjB,cAAiB,GAAA,QAAA;AAAA,IACjB,SAAA;AAAA,GACE,GAAA,OAAA,CAAA;AAEJ,EAAA,MAAM,WAAW,KAAO,EAAA,MAAA,GAAS,MAAM,MAAS,GAAA,CAAA,EAAG,OAAO,IAAI,CAAA,kBAAA,CAAA,CAAA;AAE9D,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,gBAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,UAAY,EAAA,aAAA;AAAA,MACZ,GAAG,MAAA;AAAA,KACL;AAAA,IACA,OAAS,EAAA;AAAA,MACP,SAAS,MAAO,CAAA,OAAA;AAAA,MAChB,cAAA;AAAA,MACA,MAAQ,EAAA;AAAA,QACN,UAAY,EAAA,4BAAA;AAAA,QACZ,OAAS,EAAA,CAAC,KAAO,EAAA,MAAA,EAAQ,UAAU,KAAK,CAAA;AAAA,QACxC,GAAG,OAAQ,CAAA,MAAA;A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K,OAAQ,CAAA,GAAG,KAAK,CAAA,CAAA;AAE3B,MAAI,IAAA,IAAA,CAAK,MAAO,CAAA,MAAA,CAAO,UAAY,EAAA;AACjC,QAAA,MAAM,WAAc,GAAA,MAAM,IAAK,CAAA,WAAA,CAAY,cAAe,CAAA;AAAA,UACxD,IAAA;AAAA,UACA,MAAA;AAAA,UACA,KAAA,EAAO,KAAK,WAAY,CAAA,KAAA;AAAA,UACxB,IAAM,EAAA;AAAA,YACJ,SAAA,EAAW,KAAK,MAAO,CAAA,GAAA;AAAA,WACzB;AAAA,UACA,QAAQ,IAAK,CAAA,MAAA;AAAA,SACd,CAAA,CAAA;AAED,QAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAAA,OACnC;AAAA,KACF;AAAA,GACF,CAAA;AACF,CAAC","file":"index.cjs","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { Client, Operations } from './components/index.ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { axiosGenerator } from './generators/axiosGenerator.tsx'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = createPlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n pathParamsType = 'inline',\n templates,\n } = options\n\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginClientName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n extName: output.extName,\n dataReturnType,\n client: {\n importPath: '@kubb/plugin-client/client',\n methods: ['get', 'post', 'delete', 'put'],\n ...options.client,\n },\n pathParamsType,\n templates: {\n operations: Operations,\n client: Client,\n ...templates,\n },\n baseURL: undefined,\n },\n pre: [pluginOasName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(axiosGenerator)\n\n await this.addFile(...files)\n\n if (this.config.output.exportType) {\n const barrelFiles = await this.fileManager.getBarrelFiles({\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n }\n },\n }\n})\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
package/dist/index.d.cts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginClient } from './types-DETYKDFZ.cjs';
2
+ import { O as Options, P as PluginClient } from './types-CzL-44IA.cjs';
3
3
  import '@kubb/fs/types';
4
- import '@kubb/oas';
5
4
  import '@kubb/plugin-oas';
5
+ import '@kubb/oas';
6
6
  import '@kubb/react/types';
7
7
 
8
8
  declare const pluginClientName = "plugin-client";
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import * as _kubb_core from '@kubb/core';
2
- import { O as Options, P as PluginClient } from './types-DETYKDFZ.js';
2
+ import { O as Options, P as PluginClient } from './types-CzL-44IA.js';
3
3
  import '@kubb/fs/types';
4
- import '@kubb/oas';
5
4
  import '@kubb/plugin-oas';
5
+ import '@kubb/oas';
6
6
  import '@kubb/react/types';
7
7
 
8
8
  declare const pluginClientName = "plugin-client";
package/dist/index.js CHANGED
@@ -1,108 +1,4 @@
1
- import './chunk-YJOVLRSC.js';
2
- import { axiosGenerator } from './chunk-QLVGX3VO.js';
3
- import { Operations, Client } from './chunk-QBFKND4S.js';
4
- import path from 'node:path';
5
- import { createPlugin, FileManager, PluginManager } from '@kubb/core';
6
- import { camelCase } from '@kubb/core/transformers';
7
- import { renderTemplate } from '@kubb/core/utils';
8
- import { pluginOasName, OperationGenerator } from '@kubb/plugin-oas';
9
-
10
- var pluginClientName = "plugin-client";
11
- var pluginClient = createPlugin((options) => {
12
- const {
13
- output = { path: "clients" },
14
- group,
15
- exclude = [],
16
- include,
17
- override = [],
18
- transformers = {},
19
- dataReturnType = "data",
20
- pathParamsType = "inline",
21
- templates
22
- } = options;
23
- const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`;
24
- return {
25
- name: pluginClientName,
26
- output: {
27
- exportType: "barrelNamed",
28
- ...output
29
- },
30
- options: {
31
- extName: output.extName,
32
- dataReturnType,
33
- client: {
34
- importPath: "@kubb/plugin-client/client",
35
- methods: ["get", "post", "delete", "put"],
36
- ...options.client
37
- },
38
- pathParamsType,
39
- templates: {
40
- operations: Operations,
41
- client: Client,
42
- ...templates
43
- },
44
- baseURL: void 0
45
- },
46
- pre: [pluginOasName],
47
- resolvePath(baseName, pathMode, options2) {
48
- const root = path.resolve(this.config.root, this.config.output.path);
49
- const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path));
50
- if (mode === "single") {
51
- return path.resolve(root, output.path);
52
- }
53
- if (options2?.tag && group?.type === "tag") {
54
- const tag = camelCase(options2.tag);
55
- return path.resolve(root, renderTemplate(template, { tag }), baseName);
56
- }
57
- return path.resolve(root, output.path, baseName);
58
- },
59
- resolveName(name, type) {
60
- const resolvedName = camelCase(name, { isFile: type === "file" });
61
- if (type) {
62
- return transformers?.name?.(resolvedName, type) || resolvedName;
63
- }
64
- return resolvedName;
65
- },
66
- async buildStart() {
67
- const [swaggerPlugin] = PluginManager.getDependedPlugins(this.plugins, [pluginOasName]);
68
- const oas = await swaggerPlugin.context.getOas();
69
- const root = path.resolve(this.config.root, this.config.output.path);
70
- const mode = FileManager.getMode(path.resolve(root, output.path));
71
- const baseURL = await swaggerPlugin.context.getBaseURL();
72
- const operationGenerator = new OperationGenerator(
73
- {
74
- ...this.plugin.options,
75
- baseURL
76
- },
77
- {
78
- oas,
79
- pluginManager: this.pluginManager,
80
- plugin: this.plugin,
81
- contentType: swaggerPlugin.context.contentType,
82
- exclude,
83
- include,
84
- override,
85
- mode
86
- }
87
- );
88
- const files = await operationGenerator.build(axiosGenerator);
89
- await this.addFile(...files);
90
- if (this.config.output.exportType) {
91
- const barrelFiles = await this.fileManager.getBarrelFiles({
92
- root,
93
- output,
94
- files: this.fileManager.files,
95
- meta: {
96
- pluginKey: this.plugin.key
97
- },
98
- logger: this.logger
99
- });
100
- await this.addFile(...barrelFiles);
101
- }
102
- }
103
- };
104
- });
105
-
106
- export { pluginClient, pluginClientName };
1
+ export { pluginClient, pluginClientName } from './chunk-H2OOHGK2.js';
2
+ import './chunk-BAX6ZFGY.js';
107
3
  //# sourceMappingURL=index.js.map
108
4
  //# sourceMappingURL=index.js.map
package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AK,MAAO,CAAA,GAAA;AAAA,WACzB;AAAA,UACA,QAAQ,IAAK,CAAA,MAAA;AAAA,SACd,CAAA,CAAA;AAED,QAAM,MAAA,IAAA,CAAK,OAAQ,CAAA,GAAG,WAAW,CAAA,CAAA;AAAA,OACnC;AAAA,KACF;AAAA,GACF,CAAA;AACF,CAAC","file":"index.js","sourcesContent":["import path from 'node:path'\n\nimport { FileManager, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { renderTemplate } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport { Client, Operations } from './components/index.ts'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { axiosGenerator } from './generators/axiosGenerator.tsx'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = createPlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n pathParamsType = 'inline',\n templates,\n } = options\n\n const template = group?.output ? group.output : `${output.path}/{{tag}}Controller`\n\n return {\n name: pluginClientName,\n output: {\n exportType: 'barrelNamed',\n ...output,\n },\n options: {\n extName: output.extName,\n dataReturnType,\n client: {\n importPath: '@kubb/plugin-client/client',\n methods: ['get', 'post', 'delete', 'put'],\n ...options.client,\n },\n pathParamsType,\n templates: {\n operations: Operations,\n client: Client,\n ...templates,\n },\n baseURL: undefined,\n },\n pre: [pluginOasName],\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (options?.tag && group?.type === 'tag') {\n const tag = camelCase(options.tag)\n\n return path.resolve(root, renderTemplate(template, { tag }), baseName)\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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n {\n ...this.plugin.options,\n baseURL,\n },\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType: swaggerPlugin.context.contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(axiosGenerator)\n\n await this.addFile(...files)\n\n if (this.config.output.exportType) {\n const barrelFiles = await this.fileManager.getBarrelFiles({\n root,\n output,\n files: this.fileManager.files,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n }\n },\n }\n})\n"]}
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -1,7 +1,7 @@
1
1
  import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
2
2
  import * as KubbFile from '@kubb/fs/types';
3
- import { Operation, HttpMethod } from '@kubb/oas';
4
3
  import { OperationSchemas, ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
4
+ import { Operation } from '@kubb/oas';
5
5
  import { KubbNode } from '@kubb/react/types';
6
6
 
7
7
  type Props = {
@@ -15,16 +15,6 @@ type Props = {
15
15
  };
16
16
  declare function Client({ name, options, typedSchemas, operation }: Props): KubbNode;
17
17
 
18
- type OperationsProps = {
19
- name: string;
20
- operations: Array<Operation>;
21
- };
22
- declare function Operations({ name, operations }: OperationsProps): JSX.Element;
23
-
24
- type Templates = {
25
- operations?: typeof Operations | false;
26
- client?: typeof Client | false;
27
- };
28
18
  type Options = {
29
19
  output?: {
30
20
  /**
@@ -80,21 +70,20 @@ type Options = {
80
70
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
81
71
  */
82
72
  override?: Array<Override<ResolvedOptions>>;
83
- client?: {
84
- /**
85
- * Path to the client import path that will be used to do the API calls.
86
- * It will be used as `import client from '${client.importPath}'`.
87
- * It allows both relative and absolute path.
88
- * the path will be applied as is, so relative path should be based on the file being generated.
89
- * @default '@kubb/plugin-client/client'
90
- */
91
- importPath?: string;
92
- /**
93
- * Define which HttpMethods can be used for queries
94
- * @default ['get', 'post', 'put', 'delete']
95
- */
96
- methods?: Array<HttpMethod>;
97
- };
73
+ /**
74
+ * Create `operations.ts` file with all operations grouped by methods.
75
+ * @default `false`
76
+ */
77
+ operations?: boolean;
78
+ /**
79
+ * Path to the client import path that will be used to do the API calls.
80
+ * It will be used as `import client from '${client.importPath}'`.
81
+ * It allows both relative and absolute path.
82
+ * the path will be applied as is, so relative path should be based on the file being generated.
83
+ * @default '@kubb/plugin-client/client'
84
+ */
85
+ importPath?: string;
86
+ template?: typeof Client;
98
87
  /**
99
88
  * ReturnType that needs to be used when calling client().
100
89
  *
@@ -121,19 +110,14 @@ type Options = {
121
110
  */
122
111
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
123
112
  };
124
- /**
125
- * Make it possible to override one of the templates
126
- */
127
- templates?: Partial<Templates>;
128
113
  };
129
114
  type ResolvedOptions = {
130
- extName: KubbFile.Extname | undefined;
131
115
  baseURL: string | undefined;
132
- client: Required<NonNullable<Options['client']>>;
116
+ importPath: NonNullable<Options['importPath']>;
117
+ template: NonNullable<Options['template']>;
133
118
  dataReturnType: NonNullable<Options['dataReturnType']>;
134
119
  pathParamsType: NonNullable<Options['pathParamsType']>;
135
- templates: NonNullable<Templates>;
136
120
  };
137
121
  type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
138
122
 
139
- export { Client as C, type Options as O, type PluginClient as P, Operations as a };
123
+ export { Client as C, type Options as O, type PluginClient as P };
@@ -1,7 +1,7 @@
1
1
  import { PluginFactoryOptions, ResolveNameParams } from '@kubb/core';
2
2
  import * as KubbFile from '@kubb/fs/types';
3
- import { Operation, HttpMethod } from '@kubb/oas';
4
3
  import { OperationSchemas, ResolvePathOptions, Exclude, Include, Override } from '@kubb/plugin-oas';
4
+ import { Operation } from '@kubb/oas';
5
5
  import { KubbNode } from '@kubb/react/types';
6
6
 
7
7
  type Props = {
@@ -15,16 +15,6 @@ type Props = {
15
15
  };
16
16
  declare function Client({ name, options, typedSchemas, operation }: Props): KubbNode;
17
17
 
18
- type OperationsProps = {
19
- name: string;
20
- operations: Array<Operation>;
21
- };
22
- declare function Operations({ name, operations }: OperationsProps): JSX.Element;
23
-
24
- type Templates = {
25
- operations?: typeof Operations | false;
26
- client?: typeof Client | false;
27
- };
28
18
  type Options = {
29
19
  output?: {
30
20
  /**
@@ -80,21 +70,20 @@ type Options = {
80
70
  * Array containing override parameters to override `options` based on tags/operations/methods/paths.
81
71
  */
82
72
  override?: Array<Override<ResolvedOptions>>;
83
- client?: {
84
- /**
85
- * Path to the client import path that will be used to do the API calls.
86
- * It will be used as `import client from '${client.importPath}'`.
87
- * It allows both relative and absolute path.
88
- * the path will be applied as is, so relative path should be based on the file being generated.
89
- * @default '@kubb/plugin-client/client'
90
- */
91
- importPath?: string;
92
- /**
93
- * Define which HttpMethods can be used for queries
94
- * @default ['get', 'post', 'put', 'delete']
95
- */
96
- methods?: Array<HttpMethod>;
97
- };
73
+ /**
74
+ * Create `operations.ts` file with all operations grouped by methods.
75
+ * @default `false`
76
+ */
77
+ operations?: boolean;
78
+ /**
79
+ * Path to the client import path that will be used to do the API calls.
80
+ * It will be used as `import client from '${client.importPath}'`.
81
+ * It allows both relative and absolute path.
82
+ * the path will be applied as is, so relative path should be based on the file being generated.
83
+ * @default '@kubb/plugin-client/client'
84
+ */
85
+ importPath?: string;
86
+ template?: typeof Client;
98
87
  /**
99
88
  * ReturnType that needs to be used when calling client().
100
89
  *
@@ -121,19 +110,14 @@ type Options = {
121
110
  */
122
111
  name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
123
112
  };
124
- /**
125
- * Make it possible to override one of the templates
126
- */
127
- templates?: Partial<Templates>;
128
113
  };
129
114
  type ResolvedOptions = {
130
- extName: KubbFile.Extname | undefined;
131
115
  baseURL: string | undefined;
132
- client: Required<NonNullable<Options['client']>>;
116
+ importPath: NonNullable<Options['importPath']>;
117
+ template: NonNullable<Options['template']>;
133
118
  dataReturnType: NonNullable<Options['dataReturnType']>;
134
119
  pathParamsType: NonNullable<Options['pathParamsType']>;
135
- templates: NonNullable<Templates>;
136
120
  };
137
121
  type PluginClient = PluginFactoryOptions<'plugin-client', Options, ResolvedOptions, never, ResolvePathOptions>;
138
122
 
139
- export { Client as C, type Options as O, type PluginClient as P, Operations as a };
123
+ export { Client as C, type Options as O, type PluginClient as P };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-client",
3
- "version": "3.0.0-alpha.13",
3
+ "version": "3.0.0-alpha.15",
4
4
  "description": "Generator plugin-client",
5
5
  "keywords": [
6
6
  "typescript",
@@ -72,13 +72,13 @@
72
72
  "!/**/__tests__/**"
73
73
  ],
74
74
  "dependencies": {
75
- "@kubb/core": "3.0.0-alpha.13",
76
- "@kubb/fs": "3.0.0-alpha.13",
77
- "@kubb/oas": "3.0.0-alpha.13",
78
- "@kubb/parser-ts": "3.0.0-alpha.13",
79
- "@kubb/plugin-oas": "3.0.0-alpha.13",
80
- "@kubb/plugin-ts": "3.0.0-alpha.13",
81
- "@kubb/react": "3.0.0-alpha.13"
75
+ "@kubb/core": "3.0.0-alpha.15",
76
+ "@kubb/fs": "3.0.0-alpha.15",
77
+ "@kubb/oas": "3.0.0-alpha.15",
78
+ "@kubb/parser-ts": "3.0.0-alpha.15",
79
+ "@kubb/plugin-oas": "3.0.0-alpha.15",
80
+ "@kubb/plugin-ts": "3.0.0-alpha.15",
81
+ "@kubb/react": "3.0.0-alpha.15"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@types/react": "^18.3.5",
@@ -86,13 +86,13 @@
86
86
  "react": "^18.3.1",
87
87
  "tsup": "^8.2.4",
88
88
  "typescript": "^5.5.4",
89
- "@kubb/config-biome": "3.0.0-alpha.13",
90
- "@kubb/config-ts": "3.0.0-alpha.13",
91
- "@kubb/config-tsup": "3.0.0-alpha.13"
89
+ "@kubb/config-biome": "3.0.0-alpha.15",
90
+ "@kubb/config-ts": "3.0.0-alpha.15",
91
+ "@kubb/config-tsup": "3.0.0-alpha.15"
92
92
  },
93
93
  "peerDependencies": {
94
94
  "axios": "^1.7.2",
95
- "@kubb/react": "3.0.0-alpha.13"
95
+ "@kubb/react": "3.0.0-alpha.15"
96
96
  },
97
97
  "peerDependenciesMeta": {
98
98
  "axios": {
@@ -4,7 +4,7 @@ import { type Operation, isOptional } from '@kubb/oas'
4
4
  import type { OperationSchemas } from '@kubb/plugin-oas'
5
5
  import { getComments, getPathParams } from '@kubb/plugin-oas/utils'
6
6
  import { File, Function, createFunctionParams } from '@kubb/react'
7
- import type { KubbNode, Params } from '@kubb/react/types'
7
+ import type { KubbNode } from '@kubb/react/types'
8
8
  import type { PluginClient } from '../types.ts'
9
9
 
10
10
  type Props = {
@@ -19,7 +19,7 @@ type Props = {
19
19
 
20
20
  export function Client({ name, options, typedSchemas, operation }: Props): KubbNode {
21
21
  const contentType = operation.getContentType()
22
- const baseURL = options.client.importPath === '@kubb/plugin-client/client' ? options.baseURL : undefined
22
+ const baseURL = options.baseURL
23
23
  const path = new URLPath(operation.path)
24
24
  const isFormData = contentType === 'multipart/form-data'
25
25
  const headers = [
@@ -3,48 +3,31 @@ import { useOperationManager } from '@kubb/plugin-oas/hooks'
3
3
  import { pluginTsName } from '@kubb/plugin-ts'
4
4
  import { File, useApp } from '@kubb/react'
5
5
  import { Client } from '../components/Client'
6
- import { Operations } from '../components/Operations'
7
6
  import type { PluginClient } from '../types'
8
7
 
9
- export const axiosGenerator = createReactGenerator<PluginClient>({
8
+ export const clientGenerator = createReactGenerator<PluginClient>({
10
9
  name: 'plugin-client',
11
- Operations({ options, operations }) {
12
- const { pluginManager } = useApp<PluginClient>()
13
-
14
- if (!options.templates.operations) {
15
- return null
16
- }
17
-
18
- const Template = options.templates.operations || Operations
19
- const name = 'operations'
20
- const file = pluginManager.getFile({ name, extName: '.ts', pluginKey: ['plugin-client'] })
21
-
22
- return (
23
- <File baseName={file.baseName} path={file.path} meta={file.meta}>
24
- <Template name={name} operations={operations} />
25
- </File>
26
- )
27
- },
28
10
  Operation({ options, operation }) {
11
+ const { plugin } = useApp<PluginClient>()
29
12
  const { getSchemas, getName, getFile } = useOperationManager()
30
13
 
31
14
  const name = getName(operation, { type: 'function' })
32
15
  const typedSchemas = getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' })
33
16
  const file = getFile(operation)
34
- const fileType = getFile(operation, { pluginKey: [pluginTsName] })
17
+ const typedFile = getFile(operation, { pluginKey: [pluginTsName] })
35
18
 
36
- if (!options.templates.client) {
19
+ if (!options.template) {
37
20
  return null
38
21
  }
39
22
 
40
- const Template = options.templates.client || Client
23
+ const Template = options.template || Client
41
24
 
42
25
  return (
43
26
  <File baseName={file.baseName} path={file.path} meta={file.meta}>
44
- <File.Import name={'client'} path={options.client.importPath} />
45
- <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />
27
+ <File.Import name={'client'} path={options.importPath || '@kubb/plugin-client/client'} />
28
+ <File.Import name={['ResponseConfig']} path={options.importPath || '@kubb/plugin-client/client'} isTypeOnly />
46
29
  <File.Import
47
- extName={options.extName}
30
+ extName={plugin.output?.extName}
48
31
  name={[
49
32
  typedSchemas.request?.name,
50
33
  typedSchemas.response.name,
@@ -53,7 +36,7 @@ export const axiosGenerator = createReactGenerator<PluginClient>({
53
36
  typedSchemas.headerParams?.name,
54
37
  ].filter(Boolean)}
55
38
  root={file.path}
56
- path={fileType.path}
39
+ path={typedFile.path}
57
40
  isTypeOnly
58
41
  />
59
42
  <Template name={name} options={options} typedSchemas={typedSchemas} operation={operation} />
@@ -1 +1,2 @@
1
- export { axiosGenerator } from './axiosGenerator.tsx'
1
+ export { clientGenerator } from './clientGenerator.tsx'
2
+ export { operationsGenerator } from './operationsGenerator.tsx'
@@ -0,0 +1,21 @@
1
+ import { pluginClientName } from '@kubb/plugin-client'
2
+ import { createReactGenerator } from '@kubb/plugin-oas'
3
+ import { File, useApp } from '@kubb/react'
4
+ import { Operations } from '../components/Operations'
5
+ import type { PluginClient } from '../types'
6
+
7
+ export const operationsGenerator = createReactGenerator<PluginClient>({
8
+ name: 'plugin-client',
9
+ Operations({ operations }) {
10
+ const { pluginManager } = useApp<PluginClient>()
11
+
12
+ const name = 'operations'
13
+ const file = pluginManager.getFile({ name, extName: '.ts', pluginKey: [pluginClientName] })
14
+
15
+ return (
16
+ <File baseName={file.baseName} path={file.path} meta={file.meta}>
17
+ <Operations name={name} operations={operations} />
18
+ </File>
19
+ )
20
+ },
21
+ })