@kubb/plugin-client 4.12.3 → 4.12.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Operations-DWWtAt0R.cjs → Operations-DmQa1_7x.cjs} +45 -45
- package/dist/{Operations-DWWtAt0R.cjs.map → Operations-DmQa1_7x.cjs.map} +1 -1
- package/dist/components.cjs +1 -1
- package/dist/{generators-iy-47eUM.cjs → generators-CfbdSA-k.cjs} +69 -69
- package/dist/{generators-iy-47eUM.cjs.map → generators-CfbdSA-k.cjs.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/index.cjs +16 -16
- package/dist/index.cjs.map +1 -1
- package/package.json +8 -8
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
let
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
2
|
+
let _kubb_core_utils = require("@kubb/core/utils");
|
|
3
|
+
let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
4
|
+
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
5
|
+
let _kubb_oas = require("@kubb/oas");
|
|
6
|
+
let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
7
7
|
|
|
8
8
|
//#region src/components/Url.tsx
|
|
9
9
|
function getParams$1({ paramsType, paramsCasing, pathParamsType, typeSchemas }) {
|
|
10
|
-
if (paramsType === "object") return
|
|
10
|
+
if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({ data: {
|
|
11
11
|
mode: "object",
|
|
12
|
-
children: { ...(0,
|
|
12
|
+
children: { ...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
13
13
|
typed: true,
|
|
14
14
|
casing: paramsCasing
|
|
15
15
|
}) }
|
|
16
16
|
} });
|
|
17
|
-
return
|
|
17
|
+
return _kubb_react_fabric.FunctionParams.factory({ pathParams: typeSchemas.pathParams?.name ? {
|
|
18
18
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
19
|
-
children: (0,
|
|
19
|
+
children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
20
20
|
typed: true,
|
|
21
21
|
casing: paramsCasing
|
|
22
22
|
}),
|
|
23
|
-
optional: (0,
|
|
23
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
|
|
24
24
|
} : void 0 });
|
|
25
25
|
}
|
|
26
26
|
function Url({ name, isExportable = true, isIndexable = true, typeSchemas, baseURL, paramsType, paramsCasing, pathParamsType, operation }) {
|
|
27
|
-
const path = new
|
|
27
|
+
const path = new _kubb_core_utils.URLPath(operation.path, { casing: paramsCasing });
|
|
28
28
|
const params = getParams$1({
|
|
29
29
|
paramsType,
|
|
30
30
|
paramsCasing,
|
|
31
31
|
pathParamsType,
|
|
32
32
|
typeSchemas
|
|
33
33
|
});
|
|
34
|
-
return /* @__PURE__ */ (0,
|
|
34
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
35
35
|
name,
|
|
36
36
|
isExportable,
|
|
37
37
|
isIndexable,
|
|
38
|
-
children: /* @__PURE__ */ (0,
|
|
38
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.Function, {
|
|
39
39
|
name,
|
|
40
40
|
export: isExportable,
|
|
41
41
|
params: params.toConstructor(),
|
|
42
42
|
children: [
|
|
43
|
-
/* @__PURE__ */ (0,
|
|
43
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Const, {
|
|
44
44
|
name: "res",
|
|
45
45
|
children: `{ method: '${operation.method.toUpperCase()}', url: ${path.toTemplateString({ prefix: baseURL })} as const }`
|
|
46
46
|
}),
|
|
47
|
-
/* @__PURE__ */ (0,
|
|
47
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)("br", {}),
|
|
48
48
|
"return res"
|
|
49
49
|
]
|
|
50
50
|
})
|
|
@@ -55,25 +55,25 @@ Url.getParams = getParams$1;
|
|
|
55
55
|
//#endregion
|
|
56
56
|
//#region src/components/Client.tsx
|
|
57
57
|
function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable }) {
|
|
58
|
-
if (paramsType === "object") return
|
|
58
|
+
if (paramsType === "object") return _kubb_react_fabric.FunctionParams.factory({
|
|
59
59
|
data: {
|
|
60
60
|
mode: "object",
|
|
61
61
|
children: {
|
|
62
|
-
...(0,
|
|
62
|
+
...(0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
63
63
|
typed: true,
|
|
64
64
|
casing: paramsCasing
|
|
65
65
|
}),
|
|
66
66
|
data: typeSchemas.request?.name ? {
|
|
67
67
|
type: typeSchemas.request?.name,
|
|
68
|
-
optional: (0,
|
|
68
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
69
69
|
} : void 0,
|
|
70
70
|
params: typeSchemas.queryParams?.name ? {
|
|
71
71
|
type: typeSchemas.queryParams?.name,
|
|
72
|
-
optional: (0,
|
|
72
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
73
73
|
} : void 0,
|
|
74
74
|
headers: typeSchemas.headerParams?.name ? {
|
|
75
75
|
type: typeSchemas.headerParams?.name,
|
|
76
|
-
optional: (0,
|
|
76
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
77
77
|
} : void 0
|
|
78
78
|
}
|
|
79
79
|
},
|
|
@@ -82,26 +82,26 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isCo
|
|
|
82
82
|
default: "{}"
|
|
83
83
|
} : void 0
|
|
84
84
|
});
|
|
85
|
-
return
|
|
85
|
+
return _kubb_react_fabric.FunctionParams.factory({
|
|
86
86
|
pathParams: typeSchemas.pathParams?.name ? {
|
|
87
87
|
mode: pathParamsType === "object" ? "object" : "inlineSpread",
|
|
88
|
-
children: (0,
|
|
88
|
+
children: (0, _kubb_plugin_oas_utils.getPathParams)(typeSchemas.pathParams, {
|
|
89
89
|
typed: true,
|
|
90
90
|
casing: paramsCasing
|
|
91
91
|
}),
|
|
92
|
-
optional: (0,
|
|
92
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.pathParams?.schema)
|
|
93
93
|
} : void 0,
|
|
94
94
|
data: typeSchemas.request?.name ? {
|
|
95
95
|
type: typeSchemas.request?.name,
|
|
96
|
-
optional: (0,
|
|
96
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.request?.schema)
|
|
97
97
|
} : void 0,
|
|
98
98
|
params: typeSchemas.queryParams?.name ? {
|
|
99
99
|
type: typeSchemas.queryParams?.name,
|
|
100
|
-
optional: (0,
|
|
100
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.queryParams?.schema)
|
|
101
101
|
} : void 0,
|
|
102
102
|
headers: typeSchemas.headerParams?.name ? {
|
|
103
103
|
type: typeSchemas.headerParams?.name,
|
|
104
|
-
optional: (0,
|
|
104
|
+
optional: (0, _kubb_oas.isOptional)(typeSchemas.headerParams?.schema)
|
|
105
105
|
} : void 0,
|
|
106
106
|
config: isConfigurable ? {
|
|
107
107
|
type: typeSchemas.request?.name ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }` : "Partial<RequestConfig> & { client?: typeof fetch }",
|
|
@@ -110,7 +110,7 @@ function getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isCo
|
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
function Client({ name, isExportable = true, isIndexable = true, returnType, typeSchemas, baseURL, dataReturnType, parser, zodSchemas, paramsType, paramsCasing, pathParamsType, operation, urlName, children, isConfigurable = true }) {
|
|
113
|
-
const path = new
|
|
113
|
+
const path = new _kubb_core_utils.URLPath(operation.path, { casing: paramsCasing });
|
|
114
114
|
const contentType = operation.getContentType();
|
|
115
115
|
const isFormData = contentType === "multipart/form-data";
|
|
116
116
|
const headers = [contentType !== "application/json" && contentType !== "multipart/form-data" ? `'Content-Type': '${contentType}'` : void 0, typeSchemas.headerParams?.name ? "...headers" : void 0].filter(Boolean);
|
|
@@ -133,7 +133,7 @@ function Client({ name, isExportable = true, isIndexable = true, returnType, typ
|
|
|
133
133
|
pathParamsType,
|
|
134
134
|
typeSchemas
|
|
135
135
|
});
|
|
136
|
-
const clientParams =
|
|
136
|
+
const clientParams = _kubb_react_fabric.FunctionParams.factory({ config: {
|
|
137
137
|
mode: "object",
|
|
138
138
|
children: {
|
|
139
139
|
method: { value: JSON.stringify(operation.method.toUpperCase()) },
|
|
@@ -145,33 +145,33 @@ function Client({ name, isExportable = true, isIndexable = true, returnType, typ
|
|
|
145
145
|
headers: headers.length ? { value: isConfigurable ? `{ ${headers.join(", ")}, ...requestConfig.headers }` : `{ ${headers.join(", ")} }` } : void 0
|
|
146
146
|
}
|
|
147
147
|
} });
|
|
148
|
-
const childrenElement = children ? children : /* @__PURE__ */ (0,
|
|
148
|
+
const childrenElement = children ? children : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [
|
|
149
149
|
dataReturnType === "full" && parser === "zod" && zodSchemas && `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`,
|
|
150
150
|
dataReturnType === "data" && parser === "zod" && zodSchemas && `return ${zodSchemas.response.name}.parse(res.data)`,
|
|
151
151
|
dataReturnType === "full" && parser === "client" && "return res",
|
|
152
152
|
dataReturnType === "data" && parser === "client" && "return res.data"
|
|
153
153
|
] });
|
|
154
|
-
return /* @__PURE__ */ (0,
|
|
154
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
155
155
|
name,
|
|
156
156
|
isExportable,
|
|
157
157
|
isIndexable,
|
|
158
|
-
children: /* @__PURE__ */ (0,
|
|
158
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.Function, {
|
|
159
159
|
name,
|
|
160
160
|
async: true,
|
|
161
161
|
export: isExportable,
|
|
162
162
|
params: params.toConstructor(),
|
|
163
|
-
JSDoc: { comments: (0,
|
|
163
|
+
JSDoc: { comments: (0, _kubb_plugin_oas_utils.getComments)(operation) },
|
|
164
164
|
returnType,
|
|
165
165
|
children: [
|
|
166
166
|
isConfigurable ? "const { client: request = fetch, ...requestConfig } = config" : "",
|
|
167
|
-
/* @__PURE__ */ (0,
|
|
168
|
-
/* @__PURE__ */ (0,
|
|
167
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)("br", {}),
|
|
168
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)("br", {}),
|
|
169
169
|
parser === "zod" && zodSchemas?.request?.name ? `const requestData = ${zodSchemas.request.name}.parse(data)` : typeSchemas?.request?.name && "const requestData = data",
|
|
170
|
-
/* @__PURE__ */ (0,
|
|
170
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)("br", {}),
|
|
171
171
|
isFormData && typeSchemas?.request?.name && "const formData = buildFormData(requestData)",
|
|
172
|
-
/* @__PURE__ */ (0,
|
|
172
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)("br", {}),
|
|
173
173
|
isConfigurable ? `const res = await request<${generics.join(", ")}>(${clientParams.toCall()})` : `const res = await fetch<${generics.join(", ")}>(${clientParams.toCall()})`,
|
|
174
|
-
/* @__PURE__ */ (0,
|
|
174
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)("br", {}),
|
|
175
175
|
childrenElement
|
|
176
176
|
]
|
|
177
177
|
})
|
|
@@ -193,7 +193,7 @@ function buildGenerics(typeSchemas) {
|
|
|
193
193
|
].filter(Boolean);
|
|
194
194
|
}
|
|
195
195
|
function buildClientParams({ operation, path, baseURL, typeSchemas, isFormData, headers }) {
|
|
196
|
-
return
|
|
196
|
+
return _kubb_react_fabric.FunctionParams.factory({ config: {
|
|
197
197
|
mode: "object",
|
|
198
198
|
children: {
|
|
199
199
|
method: { value: JSON.stringify(operation.method.toUpperCase()) },
|
|
@@ -221,7 +221,7 @@ function buildReturnStatement({ dataReturnType, parser, zodSchemas }) {
|
|
|
221
221
|
return "return res.data";
|
|
222
222
|
}
|
|
223
223
|
function generateMethod({ operation, name, typeSchemas, zodSchemas, baseURL, dataReturnType, parser, paramsType, paramsCasing, pathParamsType }) {
|
|
224
|
-
const path = new
|
|
224
|
+
const path = new _kubb_core_utils.URLPath(operation.path, { casing: paramsCasing });
|
|
225
225
|
const contentType = operation.getContentType();
|
|
226
226
|
const isFormData = contentType === "multipart/form-data";
|
|
227
227
|
const headers = buildHeaders(contentType, !!typeSchemas.headerParams?.name);
|
|
@@ -241,7 +241,7 @@ function generateMethod({ operation, name, typeSchemas, zodSchemas, baseURL, dat
|
|
|
241
241
|
isFormData,
|
|
242
242
|
headers
|
|
243
243
|
});
|
|
244
|
-
const jsdoc = (0,
|
|
244
|
+
const jsdoc = (0, _kubb_core_utils.buildJSDoc)((0, _kubb_plugin_oas_utils.getComments)(operation));
|
|
245
245
|
const requestDataLine = buildRequestDataLine({
|
|
246
246
|
parser,
|
|
247
247
|
zodSchemas,
|
|
@@ -284,7 +284,7 @@ ${operations.map(({ operation, name: methodName, typeSchemas, zodSchemas }) => g
|
|
|
284
284
|
pathParamsType
|
|
285
285
|
})).join("\n\n")}
|
|
286
286
|
}`;
|
|
287
|
-
return /* @__PURE__ */ (0,
|
|
287
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File.Source, {
|
|
288
288
|
name,
|
|
289
289
|
isExportable,
|
|
290
290
|
isIndexable,
|
|
@@ -299,15 +299,15 @@ function Operations({ name, operations }) {
|
|
|
299
299
|
const operationsObject = {};
|
|
300
300
|
operations.forEach((operation) => {
|
|
301
301
|
operationsObject[operation.getOperationId()] = {
|
|
302
|
-
path: new
|
|
302
|
+
path: new _kubb_core_utils.URLPath(operation.path).URL,
|
|
303
303
|
method: operation.method
|
|
304
304
|
};
|
|
305
305
|
});
|
|
306
|
-
return /* @__PURE__ */ (0,
|
|
306
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
307
307
|
name,
|
|
308
308
|
isExportable: true,
|
|
309
309
|
isIndexable: true,
|
|
310
|
-
children: /* @__PURE__ */ (0,
|
|
310
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Const, {
|
|
311
311
|
name,
|
|
312
312
|
export: true,
|
|
313
313
|
children: JSON.stringify(operationsObject, void 0, 2)
|
|
@@ -340,4 +340,4 @@ Object.defineProperty(exports, 'Url', {
|
|
|
340
340
|
return Url;
|
|
341
341
|
}
|
|
342
342
|
});
|
|
343
|
-
//# sourceMappingURL=Operations-
|
|
343
|
+
//# sourceMappingURL=Operations-DmQa1_7x.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operations-DWWtAt0R.cjs","names":["getParams","FunctionParams","URLPath","File","Function","Const","FunctionParams","URLPath","File","Function","FunctionParams","URLPath","File","operationsObject: Record<string, { path: string; method: HttpMethod }>","URLPath","File","Const"],"sources":["../src/components/Url.tsx","../src/components/Client.tsx","../src/components/ClassClient.tsx","../src/components/Operations.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\n\nimport { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { Const, File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginClient } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n\n baseURL: string | undefined\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n operation: Operation\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['paramsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n },\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n })\n}\n\nexport function Url({\n name,\n isExportable = true,\n isIndexable = true,\n typeSchemas,\n baseURL,\n paramsType,\n paramsCasing,\n pathParamsType,\n operation,\n}: Props): KubbNode {\n const path = new URLPath(operation.path, { casing: paramsCasing })\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function name={name} export={isExportable} params={params.toConstructor()}>\n <Const name={'res'}>{`{ method: '${operation.method.toUpperCase()}', url: ${path.toTemplateString({ prefix: baseURL })} as const }`}</Const>\n <br />\n return res\n </Function>\n </File.Source>\n )\n}\n\nUrl.getParams = getParams\n","import { URLPath } from '@kubb/core/utils'\n\nimport { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginClient } from '../types.ts'\nimport { Url } from './Url.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n urlName?: string\n isExportable?: boolean\n isIndexable?: boolean\n isConfigurable?: boolean\n returnType?: string\n\n baseURL: string | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n operation: Operation\n children?: KubbNode\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['paramsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n isConfigurable: boolean\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: isConfigurable\n ? {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n }\n : undefined,\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: isConfigurable\n ? {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n }\n : undefined,\n })\n}\n\nexport function Client({\n name,\n isExportable = true,\n isIndexable = true,\n returnType,\n typeSchemas,\n baseURL,\n dataReturnType,\n parser,\n zodSchemas,\n paramsType,\n paramsCasing,\n pathParamsType,\n operation,\n urlName,\n children,\n isConfigurable = true,\n}: Props): KubbNode {\n const path = new URLPath(operation.path, { casing: paramsCasing })\n const contentType = operation.getContentType()\n const isFormData = contentType === 'multipart/form-data'\n const headers = [\n contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : undefined,\n typeSchemas.headerParams?.name ? '...headers' : undefined,\n ].filter(Boolean)\n\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n\n const generics = [typeSchemas.response.name, TError, typeSchemas.request?.name || 'unknown'].filter(Boolean)\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable })\n const urlParams = Url.getParams({\n paramsType,\n paramsCasing,\n pathParamsType,\n typeSchemas,\n })\n const clientParams = FunctionParams.factory({\n config: {\n mode: 'object',\n children: {\n method: {\n value: JSON.stringify(operation.method.toUpperCase()),\n },\n url: {\n value: urlName ? `${urlName}(${urlParams.toCall()}).url.toString()` : path.template,\n },\n baseURL:\n baseURL && !urlName\n ? {\n value: `\\`${baseURL}\\``,\n }\n : undefined,\n params: typeSchemas.queryParams?.name ? {} : undefined,\n data: typeSchemas.request?.name\n ? {\n value: isFormData ? 'formData as FormData' : 'requestData',\n }\n : undefined,\n requestConfig: isConfigurable\n ? {\n mode: 'inlineSpread',\n }\n : undefined,\n headers: headers.length\n ? {\n value: isConfigurable ? `{ ${headers.join(', ')}, ...requestConfig.headers }` : `{ ${headers.join(', ')} }`,\n }\n : undefined,\n },\n },\n })\n\n const childrenElement = children ? (\n children\n ) : (\n <>\n {dataReturnType === 'full' && parser === 'zod' && zodSchemas && `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`}\n {dataReturnType === 'data' && parser === 'zod' && zodSchemas && `return ${zodSchemas.response.name}.parse(res.data)`}\n {dataReturnType === 'full' && parser === 'client' && 'return res'}\n {dataReturnType === 'data' && parser === 'client' && 'return res.data'}\n </>\n )\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function\n name={name}\n async\n export={isExportable}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n returnType={returnType}\n >\n {isConfigurable ? 'const { client: request = fetch, ...requestConfig } = config' : ''}\n <br />\n <br />\n {parser === 'zod' && zodSchemas?.request?.name\n ? `const requestData = ${zodSchemas.request.name}.parse(data)`\n : typeSchemas?.request?.name && 'const requestData = data'}\n <br />\n {isFormData && typeSchemas?.request?.name && 'const formData = buildFormData(requestData)'}\n <br />\n {isConfigurable\n ? `const res = await request<${generics.join(', ')}>(${clientParams.toCall()})`\n : `const res = await fetch<${generics.join(', ')}>(${clientParams.toCall()})`}\n <br />\n {childrenElement}\n </Function>\n </File.Source>\n )\n}\n\nClient.getParams = getParams\n","import { buildJSDoc, URLPath } from '@kubb/core/utils'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments } from '@kubb/plugin-oas/utils'\nimport { File, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginClient } from '../types.ts'\n\nimport { Client } from './Client.tsx'\n\ntype Props = {\n /**\n * Name of the class\n */\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n operations: Array<{\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n }>\n baseURL: string | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n children?: KubbNode\n}\n\ntype GenerateMethodProps = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n baseURL: string | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n paramsType: PluginClient['resolvedOptions']['paramsType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n}\n\nfunction buildHeaders(contentType: string, hasHeaderParams: boolean): Array<string> {\n return [\n contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : undefined,\n hasHeaderParams ? '...headers' : undefined,\n ].filter(Boolean) as Array<string>\n}\n\nfunction buildGenerics(typeSchemas: OperationSchemas): Array<string> {\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n return [typeSchemas.response.name, TError, typeSchemas.request?.name || 'unknown'].filter(Boolean)\n}\n\nfunction buildClientParams({\n operation,\n path,\n baseURL,\n typeSchemas,\n isFormData,\n headers,\n}: {\n operation: Operation\n path: URLPath\n baseURL: string | undefined\n typeSchemas: OperationSchemas\n isFormData: boolean\n headers: Array<string>\n}) {\n return FunctionParams.factory({\n config: {\n mode: 'object',\n children: {\n method: {\n value: JSON.stringify(operation.method.toUpperCase()),\n },\n url: {\n value: path.template,\n },\n baseURL: baseURL\n ? {\n value: JSON.stringify(baseURL),\n }\n : undefined,\n params: typeSchemas.queryParams?.name ? {} : undefined,\n data: typeSchemas.request?.name\n ? {\n value: isFormData ? 'formData as FormData' : 'requestData',\n }\n : undefined,\n requestConfig: {\n mode: 'inlineSpread',\n },\n headers: headers.length\n ? {\n value: `{ ${headers.join(', ')}, ...requestConfig.headers }`,\n }\n : undefined,\n },\n },\n })\n}\n\nfunction buildRequestDataLine({\n parser,\n zodSchemas,\n typeSchemas,\n}: {\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n zodSchemas: OperationSchemas | undefined\n typeSchemas: OperationSchemas\n}): string {\n if (parser === 'zod' && zodSchemas?.request?.name) {\n return `const requestData = ${zodSchemas.request.name}.parse(data)`\n }\n if (typeSchemas?.request?.name) {\n return 'const requestData = data'\n }\n return ''\n}\n\nfunction buildFormDataLine(isFormData: boolean, hasRequest: boolean): string {\n return isFormData && hasRequest ? 'const formData = buildFormData(requestData)' : ''\n}\n\nfunction buildReturnStatement({\n dataReturnType,\n parser,\n zodSchemas,\n}: {\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n zodSchemas: OperationSchemas | undefined\n}): string {\n if (dataReturnType === 'full' && parser === 'zod' && zodSchemas) {\n return `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`\n }\n if (dataReturnType === 'data' && parser === 'zod' && zodSchemas) {\n return `return ${zodSchemas.response.name}.parse(res.data)`\n }\n if (dataReturnType === 'full' && parser === 'client') {\n return 'return res'\n }\n return 'return res.data'\n}\n\nfunction generateMethod({\n operation,\n name,\n typeSchemas,\n zodSchemas,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n}: GenerateMethodProps): string {\n const path = new URLPath(operation.path, { casing: paramsCasing })\n const contentType = operation.getContentType()\n const isFormData = contentType === 'multipart/form-data'\n const headers = buildHeaders(contentType, !!typeSchemas.headerParams?.name)\n const generics = buildGenerics(typeSchemas)\n const params = ClassClient.getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable: true })\n const clientParams = buildClientParams({ operation, path, baseURL, typeSchemas, isFormData, headers })\n const jsdoc = buildJSDoc(getComments(operation))\n\n const requestDataLine = buildRequestDataLine({ parser, zodSchemas, typeSchemas })\n const formDataLine = buildFormDataLine(isFormData, !!typeSchemas?.request?.name)\n const returnStatement = buildReturnStatement({ dataReturnType, parser, zodSchemas })\n\n const methodBody = [\n 'const { client: request = this.#client, ...requestConfig } = config',\n '',\n requestDataLine,\n formDataLine,\n `const res = await request<${generics.join(', ')}>(${clientParams.toCall()})`,\n returnStatement,\n ]\n .filter(Boolean)\n .map((line) => ` ${line}`)\n .join('\\n')\n\n return `${jsdoc}async ${name}(${params.toConstructor()}) {\\n${methodBody}\\n }`\n}\n\nexport function ClassClient({\n name,\n isExportable = true,\n isIndexable = true,\n operations,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n children,\n}: Props): KubbNode {\n const methods = operations.map(({ operation, name: methodName, typeSchemas, zodSchemas }) =>\n generateMethod({\n operation,\n name: methodName,\n typeSchemas,\n zodSchemas,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n }),\n )\n\n const classCode = `export class ${name} {\n #client: typeof fetch\n\n constructor(config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {\n this.#client = config.client || fetch\n }\n\n${methods.join('\\n\\n')}\n}`\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n {classCode}\n {children}\n </File.Source>\n )\n}\nClassClient.getParams = Client.getParams\n","import { URLPath } from '@kubb/core/utils'\nimport type { HttpMethod, Operation } from '@kubb/oas'\nimport { Const, File } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype OperationsProps = {\n name: string\n operations: Array<Operation>\n}\n\nexport function Operations({ name, operations }: OperationsProps): KubbNode {\n const operationsObject: Record<string, { path: string; method: HttpMethod }> = {}\n\n operations.forEach((operation) => {\n operationsObject[operation.getOperationId()] = {\n path: new URLPath(operation.path).URL,\n method: operation.method,\n }\n })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={name} export>\n {JSON.stringify(operationsObject, undefined, 2)}\n </Const>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;AAgCA,SAASA,YAAU,EAAE,YAAY,cAAc,gBAAgB,eAA+B;AAC5F,KAAI,eAAe,SACjB,QAAOC,mCAAe,QAAQ,EAC5B,MAAM;EACJ,MAAM;EACN,UAAU,EACR,8CAAiB,YAAY,YAAY;GAAE,OAAO;GAAM,QAAQ;GAAc,CAAC,EAChF;EACF,EACF,CAAC;AAGJ,QAAOA,mCAAe,QAAQ,EAC5B,YAAY,YAAY,YAAY,OAChC;EACE,MAAM,mBAAmB,WAAW,WAAW;EAC/C,qDAAwB,YAAY,YAAY;GAAE,OAAO;GAAM,QAAQ;GAAc,CAAC;EACtF,qCAAqB,YAAY,YAAY,OAAO;EACrD,GACD,QACL,CAAC;;AAGJ,SAAgB,IAAI,EAClB,MACA,eAAe,MACf,cAAc,MACd,aACA,SACA,YACA,cACA,gBACA,aACkB;CAClB,MAAM,OAAO,IAAIC,0BAAQ,UAAU,MAAM,EAAE,QAAQ,cAAc,CAAC;CAClE,MAAM,SAASF,YAAU;EAAE;EAAY;EAAc;EAAgB;EAAa,CAAC;AAEnF,QACE,yDAACG,yBAAK;EAAa;EAAoB;EAA2B;YAChE,0DAACC;GAAe;GAAM,QAAQ;GAAc,QAAQ,OAAO,eAAe;;IACxE,yDAACC;KAAM,MAAM;eAAQ,cAAc,UAAU,OAAO,aAAa,CAAC,UA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,MAAM,cAAyC;CAC1E,MAAMC,mBAAyE,EAAE;AAEjF,YAAW,SAAS,cAAc;AAChC,mBAAiB,UAAU,gBAAgB,IAAI;GAC7C,MAAM,IAAIC,0BAAQ,UAAU,KAAK,CAAC;GAClC,QAAQ,UAAU;GACnB;GACD;AAEF,QACE,yDAACC,yBAAK;EAAa;EAAM;EAAa;YACpC,yDAACC;GAAY;GAAM;aAChB,KAAK,UAAU,kBAAkB,QAAW,EAAE;IACzC;GACI"}
|
|
1
|
+
{"version":3,"file":"Operations-DmQa1_7x.cjs","names":["getParams","FunctionParams","URLPath","File","Function","Const","FunctionParams","URLPath","File","Function","FunctionParams","URLPath","File","operationsObject: Record<string, { path: string; method: HttpMethod }>","URLPath","File","Const"],"sources":["../src/components/Url.tsx","../src/components/Client.tsx","../src/components/ClassClient.tsx","../src/components/Operations.tsx"],"sourcesContent":["import { URLPath } from '@kubb/core/utils'\n\nimport { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams } from '@kubb/plugin-oas/utils'\nimport { Const, File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginClient } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n\n baseURL: string | undefined\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n operation: Operation\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['paramsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n },\n },\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n })\n}\n\nexport function Url({\n name,\n isExportable = true,\n isIndexable = true,\n typeSchemas,\n baseURL,\n paramsType,\n paramsCasing,\n pathParamsType,\n operation,\n}: Props): KubbNode {\n const path = new URLPath(operation.path, { casing: paramsCasing })\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas })\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function name={name} export={isExportable} params={params.toConstructor()}>\n <Const name={'res'}>{`{ method: '${operation.method.toUpperCase()}', url: ${path.toTemplateString({ prefix: baseURL })} as const }`}</Const>\n <br />\n return res\n </Function>\n </File.Source>\n )\n}\n\nUrl.getParams = getParams\n","import { URLPath } from '@kubb/core/utils'\n\nimport { isOptional, type Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments, getPathParams } from '@kubb/plugin-oas/utils'\nimport { File, Function, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginClient } from '../types.ts'\nimport { Url } from './Url.tsx'\n\ntype Props = {\n /**\n * Name of the function\n */\n name: string\n urlName?: string\n isExportable?: boolean\n isIndexable?: boolean\n isConfigurable?: boolean\n returnType?: string\n\n baseURL: string | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n operation: Operation\n children?: KubbNode\n}\n\ntype GetParamsProps = {\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['paramsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n typeSchemas: OperationSchemas\n isConfigurable: boolean\n}\n\nfunction getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable }: GetParamsProps) {\n if (paramsType === 'object') {\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n config: isConfigurable\n ? {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n }\n : undefined,\n })\n }\n\n return FunctionParams.factory({\n pathParams: typeSchemas.pathParams?.name\n ? {\n mode: pathParamsType === 'object' ? 'object' : 'inlineSpread',\n children: getPathParams(typeSchemas.pathParams, { typed: true, casing: paramsCasing }),\n optional: isOptional(typeSchemas.pathParams?.schema),\n }\n : undefined,\n data: typeSchemas.request?.name\n ? {\n type: typeSchemas.request?.name,\n optional: isOptional(typeSchemas.request?.schema),\n }\n : undefined,\n params: typeSchemas.queryParams?.name\n ? {\n type: typeSchemas.queryParams?.name,\n optional: isOptional(typeSchemas.queryParams?.schema),\n }\n : undefined,\n headers: typeSchemas.headerParams?.name\n ? {\n type: typeSchemas.headerParams?.name,\n optional: isOptional(typeSchemas.headerParams?.schema),\n }\n : undefined,\n config: isConfigurable\n ? {\n type: typeSchemas.request?.name\n ? `Partial<RequestConfig<${typeSchemas.request?.name}>> & { client?: typeof fetch }`\n : 'Partial<RequestConfig> & { client?: typeof fetch }',\n default: '{}',\n }\n : undefined,\n })\n}\n\nexport function Client({\n name,\n isExportable = true,\n isIndexable = true,\n returnType,\n typeSchemas,\n baseURL,\n dataReturnType,\n parser,\n zodSchemas,\n paramsType,\n paramsCasing,\n pathParamsType,\n operation,\n urlName,\n children,\n isConfigurable = true,\n}: Props): KubbNode {\n const path = new URLPath(operation.path, { casing: paramsCasing })\n const contentType = operation.getContentType()\n const isFormData = contentType === 'multipart/form-data'\n const headers = [\n contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : undefined,\n typeSchemas.headerParams?.name ? '...headers' : undefined,\n ].filter(Boolean)\n\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n\n const generics = [typeSchemas.response.name, TError, typeSchemas.request?.name || 'unknown'].filter(Boolean)\n const params = getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable })\n const urlParams = Url.getParams({\n paramsType,\n paramsCasing,\n pathParamsType,\n typeSchemas,\n })\n const clientParams = FunctionParams.factory({\n config: {\n mode: 'object',\n children: {\n method: {\n value: JSON.stringify(operation.method.toUpperCase()),\n },\n url: {\n value: urlName ? `${urlName}(${urlParams.toCall()}).url.toString()` : path.template,\n },\n baseURL:\n baseURL && !urlName\n ? {\n value: `\\`${baseURL}\\``,\n }\n : undefined,\n params: typeSchemas.queryParams?.name ? {} : undefined,\n data: typeSchemas.request?.name\n ? {\n value: isFormData ? 'formData as FormData' : 'requestData',\n }\n : undefined,\n requestConfig: isConfigurable\n ? {\n mode: 'inlineSpread',\n }\n : undefined,\n headers: headers.length\n ? {\n value: isConfigurable ? `{ ${headers.join(', ')}, ...requestConfig.headers }` : `{ ${headers.join(', ')} }`,\n }\n : undefined,\n },\n },\n })\n\n const childrenElement = children ? (\n children\n ) : (\n <>\n {dataReturnType === 'full' && parser === 'zod' && zodSchemas && `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`}\n {dataReturnType === 'data' && parser === 'zod' && zodSchemas && `return ${zodSchemas.response.name}.parse(res.data)`}\n {dataReturnType === 'full' && parser === 'client' && 'return res'}\n {dataReturnType === 'data' && parser === 'client' && 'return res.data'}\n </>\n )\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n <Function\n name={name}\n async\n export={isExportable}\n params={params.toConstructor()}\n JSDoc={{\n comments: getComments(operation),\n }}\n returnType={returnType}\n >\n {isConfigurable ? 'const { client: request = fetch, ...requestConfig } = config' : ''}\n <br />\n <br />\n {parser === 'zod' && zodSchemas?.request?.name\n ? `const requestData = ${zodSchemas.request.name}.parse(data)`\n : typeSchemas?.request?.name && 'const requestData = data'}\n <br />\n {isFormData && typeSchemas?.request?.name && 'const formData = buildFormData(requestData)'}\n <br />\n {isConfigurable\n ? `const res = await request<${generics.join(', ')}>(${clientParams.toCall()})`\n : `const res = await fetch<${generics.join(', ')}>(${clientParams.toCall()})`}\n <br />\n {childrenElement}\n </Function>\n </File.Source>\n )\n}\n\nClient.getParams = getParams\n","import { buildJSDoc, URLPath } from '@kubb/core/utils'\nimport type { Operation } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getComments } from '@kubb/plugin-oas/utils'\nimport { File, FunctionParams } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\nimport type { PluginClient } from '../types.ts'\n\nimport { Client } from './Client.tsx'\n\ntype Props = {\n /**\n * Name of the class\n */\n name: string\n isExportable?: boolean\n isIndexable?: boolean\n operations: Array<{\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n }>\n baseURL: string | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n paramsType: PluginClient['resolvedOptions']['pathParamsType']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n children?: KubbNode\n}\n\ntype GenerateMethodProps = {\n operation: Operation\n name: string\n typeSchemas: OperationSchemas\n zodSchemas: OperationSchemas | undefined\n baseURL: string | undefined\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n paramsType: PluginClient['resolvedOptions']['paramsType']\n paramsCasing: PluginClient['resolvedOptions']['paramsCasing']\n pathParamsType: PluginClient['resolvedOptions']['pathParamsType']\n}\n\nfunction buildHeaders(contentType: string, hasHeaderParams: boolean): Array<string> {\n return [\n contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : undefined,\n hasHeaderParams ? '...headers' : undefined,\n ].filter(Boolean) as Array<string>\n}\n\nfunction buildGenerics(typeSchemas: OperationSchemas): Array<string> {\n const TError = `ResponseErrorConfig<${typeSchemas.errors?.map((item) => item.name).join(' | ') || 'Error'}>`\n return [typeSchemas.response.name, TError, typeSchemas.request?.name || 'unknown'].filter(Boolean)\n}\n\nfunction buildClientParams({\n operation,\n path,\n baseURL,\n typeSchemas,\n isFormData,\n headers,\n}: {\n operation: Operation\n path: URLPath\n baseURL: string | undefined\n typeSchemas: OperationSchemas\n isFormData: boolean\n headers: Array<string>\n}) {\n return FunctionParams.factory({\n config: {\n mode: 'object',\n children: {\n method: {\n value: JSON.stringify(operation.method.toUpperCase()),\n },\n url: {\n value: path.template,\n },\n baseURL: baseURL\n ? {\n value: JSON.stringify(baseURL),\n }\n : undefined,\n params: typeSchemas.queryParams?.name ? {} : undefined,\n data: typeSchemas.request?.name\n ? {\n value: isFormData ? 'formData as FormData' : 'requestData',\n }\n : undefined,\n requestConfig: {\n mode: 'inlineSpread',\n },\n headers: headers.length\n ? {\n value: `{ ${headers.join(', ')}, ...requestConfig.headers }`,\n }\n : undefined,\n },\n },\n })\n}\n\nfunction buildRequestDataLine({\n parser,\n zodSchemas,\n typeSchemas,\n}: {\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n zodSchemas: OperationSchemas | undefined\n typeSchemas: OperationSchemas\n}): string {\n if (parser === 'zod' && zodSchemas?.request?.name) {\n return `const requestData = ${zodSchemas.request.name}.parse(data)`\n }\n if (typeSchemas?.request?.name) {\n return 'const requestData = data'\n }\n return ''\n}\n\nfunction buildFormDataLine(isFormData: boolean, hasRequest: boolean): string {\n return isFormData && hasRequest ? 'const formData = buildFormData(requestData)' : ''\n}\n\nfunction buildReturnStatement({\n dataReturnType,\n parser,\n zodSchemas,\n}: {\n dataReturnType: PluginClient['resolvedOptions']['dataReturnType']\n parser: PluginClient['resolvedOptions']['parser'] | undefined\n zodSchemas: OperationSchemas | undefined\n}): string {\n if (dataReturnType === 'full' && parser === 'zod' && zodSchemas) {\n return `return {...res, data: ${zodSchemas.response.name}.parse(res.data)}`\n }\n if (dataReturnType === 'data' && parser === 'zod' && zodSchemas) {\n return `return ${zodSchemas.response.name}.parse(res.data)`\n }\n if (dataReturnType === 'full' && parser === 'client') {\n return 'return res'\n }\n return 'return res.data'\n}\n\nfunction generateMethod({\n operation,\n name,\n typeSchemas,\n zodSchemas,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n}: GenerateMethodProps): string {\n const path = new URLPath(operation.path, { casing: paramsCasing })\n const contentType = operation.getContentType()\n const isFormData = contentType === 'multipart/form-data'\n const headers = buildHeaders(contentType, !!typeSchemas.headerParams?.name)\n const generics = buildGenerics(typeSchemas)\n const params = ClassClient.getParams({ paramsType, paramsCasing, pathParamsType, typeSchemas, isConfigurable: true })\n const clientParams = buildClientParams({ operation, path, baseURL, typeSchemas, isFormData, headers })\n const jsdoc = buildJSDoc(getComments(operation))\n\n const requestDataLine = buildRequestDataLine({ parser, zodSchemas, typeSchemas })\n const formDataLine = buildFormDataLine(isFormData, !!typeSchemas?.request?.name)\n const returnStatement = buildReturnStatement({ dataReturnType, parser, zodSchemas })\n\n const methodBody = [\n 'const { client: request = this.#client, ...requestConfig } = config',\n '',\n requestDataLine,\n formDataLine,\n `const res = await request<${generics.join(', ')}>(${clientParams.toCall()})`,\n returnStatement,\n ]\n .filter(Boolean)\n .map((line) => ` ${line}`)\n .join('\\n')\n\n return `${jsdoc}async ${name}(${params.toConstructor()}) {\\n${methodBody}\\n }`\n}\n\nexport function ClassClient({\n name,\n isExportable = true,\n isIndexable = true,\n operations,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n children,\n}: Props): KubbNode {\n const methods = operations.map(({ operation, name: methodName, typeSchemas, zodSchemas }) =>\n generateMethod({\n operation,\n name: methodName,\n typeSchemas,\n zodSchemas,\n baseURL,\n dataReturnType,\n parser,\n paramsType,\n paramsCasing,\n pathParamsType,\n }),\n )\n\n const classCode = `export class ${name} {\n #client: typeof fetch\n\n constructor(config: Partial<RequestConfig> & { client?: typeof fetch } = {}) {\n this.#client = config.client || fetch\n }\n\n${methods.join('\\n\\n')}\n}`\n\n return (\n <File.Source name={name} isExportable={isExportable} isIndexable={isIndexable}>\n {classCode}\n {children}\n </File.Source>\n )\n}\nClassClient.getParams = Client.getParams\n","import { URLPath } from '@kubb/core/utils'\nimport type { HttpMethod, Operation } from '@kubb/oas'\nimport { Const, File } from '@kubb/react-fabric'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\ntype OperationsProps = {\n name: string\n operations: Array<Operation>\n}\n\nexport function Operations({ name, operations }: OperationsProps): KubbNode {\n const operationsObject: Record<string, { path: string; method: HttpMethod }> = {}\n\n operations.forEach((operation) => {\n operationsObject[operation.getOperationId()] = {\n path: new URLPath(operation.path).URL,\n method: operation.method,\n }\n })\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={name} export>\n {JSON.stringify(operationsObject, undefined, 2)}\n </Const>\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;AAgCA,SAASA,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EAAa,CAAC;CACjF,MAAM,eAAe,kBAAkB,YAAY,CAAC,CAAC,aAAa,SAAS,KAAK;CAChF,MAAM,kBAAkB,qBAAqB;EAAE;EAAgB;EAAQ;EAAY,CAAC;CAEpF,MAAM,aAAa;EACjB;EACA;EACA;EACA;EACA,6BAA6B,SAAS,KAAK,KAAK,CAAC,IAAI,aAAa,QAAQ,CAAC;EAC3E;EACD,CACE,OAAO,QAAQ,CACf,KAAK,SAAS,OAAO,OAAO,CAC5B,KAAK,KAAK;AAEb,QAAO,GAAG,MAAM,QAAQ,KAAK,GAAG,OAAO,eAAe,CAAC,OAAO,WAAW;;AAG3E,SAAgB,YAAY,EAC1B,MACA,eAAe,MACf,cAAc,MACd,YACA,SACA,gBACA,QACA,YACA,cACA,gBACA,YACkB;CAgBlB,MAAM,YAAY,gBAAgB,KAAK;;;;;;;EAfvB,WAAW,KAAK,EAAE,WAAW,MAAM,YAAY,aAAa,iBAC1E,eAAe;EACb;EACA,MAAM;EACN;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACD,CAAC,CACH,CASO,KAAK,OAAO,CAAC;;AAGrB,QACE,yDAACC,wBAAK;EAAa;EAAoB;EAA2B;aAC/D,WACA;GACW;;AAGlB,YAAY,YAAY,OAAO;;;;AChO/B,SAAgB,WAAW,EAAE,MAAM,cAAyC;CAC1E,MAAMC,mBAAyE,EAAE;AAEjF,YAAW,SAAS,cAAc;AAChC,mBAAiB,UAAU,gBAAgB,IAAI;GAC7C,MAAM,IAAIC,yBAAQ,UAAU,KAAK,CAAC;GAClC,QAAQ,UAAU;GACnB;GACD;AAEF,QACE,wDAACC,wBAAK;EAAa;EAAM;EAAa;YACpC,wDAACC;GAAY;GAAM;aAChB,KAAK,UAAU,kBAAkB,QAAW,EAAE;IACzC;GACI"}
|
package/dist/components.cjs
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_Operations = require('./Operations-
|
|
2
|
+
const require_Operations = require('./Operations-DmQa1_7x.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_chunk.__toESM(node_path);
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let
|
|
12
|
-
let
|
|
13
|
-
let
|
|
5
|
+
let _kubb_core_transformers = require("@kubb/core/transformers");
|
|
6
|
+
let _kubb_plugin_zod = require("@kubb/plugin-zod");
|
|
7
|
+
let _kubb_core_hooks = require("@kubb/core/hooks");
|
|
8
|
+
let _kubb_plugin_oas_generators = require("@kubb/plugin-oas/generators");
|
|
9
|
+
let _kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
|
|
10
|
+
let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
11
|
+
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
12
|
+
let _kubb_react_fabric = require("@kubb/react-fabric");
|
|
13
|
+
let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
14
14
|
|
|
15
15
|
//#region src/generators/classClientGenerator.tsx
|
|
16
|
-
const classClientGenerator = (0,
|
|
16
|
+
const classClientGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
17
17
|
name: "classClient",
|
|
18
18
|
Operations({ operations, generator, plugin, config }) {
|
|
19
19
|
const { options, key: pluginKey } = plugin;
|
|
20
|
-
const pluginManager = (0,
|
|
21
|
-
const oas = (0,
|
|
22
|
-
const { getName, getFile, getGroup, getSchemas } = (0,
|
|
20
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
21
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
22
|
+
const { getName, getFile, getGroup, getSchemas } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
23
23
|
function buildOperationData(operation) {
|
|
24
24
|
const type = {
|
|
25
|
-
file: getFile(operation, { pluginKey: [
|
|
25
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_ts.pluginTsName] }),
|
|
26
26
|
schemas: getSchemas(operation, {
|
|
27
|
-
pluginKey: [
|
|
27
|
+
pluginKey: [_kubb_plugin_ts.pluginTsName],
|
|
28
28
|
type: "type"
|
|
29
29
|
})
|
|
30
30
|
};
|
|
31
31
|
const zod = {
|
|
32
|
-
file: getFile(operation, { pluginKey: [
|
|
32
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_zod.pluginZodName] }),
|
|
33
33
|
schemas: getSchemas(operation, {
|
|
34
|
-
pluginKey: [
|
|
34
|
+
pluginKey: [_kubb_plugin_zod.pluginZodName],
|
|
35
35
|
type: "function"
|
|
36
36
|
})
|
|
37
37
|
};
|
|
@@ -46,7 +46,7 @@ const classClientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerat
|
|
|
46
46
|
}
|
|
47
47
|
const controllers = operations.reduce((acc, operation) => {
|
|
48
48
|
const group = getGroup(operation);
|
|
49
|
-
const groupName = group?.tag ? options.group?.name?.({ group: (0,
|
|
49
|
+
const groupName = group?.tag ? options.group?.name?.({ group: (0, _kubb_core_transformers.camelCase)(group.tag) }) ?? (0, _kubb_core_transformers.pascalCase)(group.tag) : "Client";
|
|
50
50
|
if (!group?.tag && !options.group) {
|
|
51
51
|
const name = "ApiClient";
|
|
52
52
|
const file = pluginManager.getFile({
|
|
@@ -126,38 +126,38 @@ const classClientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerat
|
|
|
126
126
|
zodFilesByPath: /* @__PURE__ */ new Map()
|
|
127
127
|
};
|
|
128
128
|
const hasFormData = ops.some((op) => op.operation.getContentType() === "multipart/form-data");
|
|
129
|
-
return /* @__PURE__ */ (0,
|
|
129
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
130
130
|
baseName: file.baseName,
|
|
131
131
|
path: file.path,
|
|
132
132
|
meta: file.meta,
|
|
133
|
-
banner: (0,
|
|
133
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
134
134
|
oas,
|
|
135
135
|
output: options.output,
|
|
136
136
|
config: pluginManager.config
|
|
137
137
|
}),
|
|
138
|
-
footer: (0,
|
|
138
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
139
139
|
oas,
|
|
140
140
|
output: options.output
|
|
141
141
|
}),
|
|
142
142
|
children: [
|
|
143
|
-
options.importPath ? /* @__PURE__ */ (0,
|
|
143
|
+
options.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
144
144
|
name: "fetch",
|
|
145
145
|
path: options.importPath
|
|
146
|
-
}), /* @__PURE__ */ (0,
|
|
146
|
+
}), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
147
147
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
148
148
|
path: options.importPath,
|
|
149
149
|
isTypeOnly: true
|
|
150
|
-
})] }) : /* @__PURE__ */ (0,
|
|
150
|
+
})] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
151
151
|
name: ["fetch"],
|
|
152
152
|
root: file.path,
|
|
153
153
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
154
|
-
}), /* @__PURE__ */ (0,
|
|
154
|
+
}), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
155
155
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
156
156
|
root: file.path,
|
|
157
157
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
158
158
|
isTypeOnly: true
|
|
159
159
|
})] }),
|
|
160
|
-
hasFormData && /* @__PURE__ */ (0,
|
|
160
|
+
hasFormData && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
161
161
|
name: ["buildFormData"],
|
|
162
162
|
root: file.path,
|
|
163
163
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
@@ -167,7 +167,7 @@ const classClientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerat
|
|
|
167
167
|
if (!typeFile) return null;
|
|
168
168
|
const importNames = Array.from(imports).filter(Boolean);
|
|
169
169
|
if (importNames.length === 0) return null;
|
|
170
|
-
return /* @__PURE__ */ (0,
|
|
170
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
171
171
|
name: importNames,
|
|
172
172
|
root: file.path,
|
|
173
173
|
path: typeFile.path,
|
|
@@ -179,13 +179,13 @@ const classClientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerat
|
|
|
179
179
|
if (!zodFile) return null;
|
|
180
180
|
const importNames = Array.from(imports).filter(Boolean);
|
|
181
181
|
if (importNames.length === 0) return null;
|
|
182
|
-
return /* @__PURE__ */ (0,
|
|
182
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
183
183
|
name: importNames,
|
|
184
184
|
root: file.path,
|
|
185
185
|
path: zodFile.path
|
|
186
186
|
}, filePath);
|
|
187
187
|
}),
|
|
188
|
-
/* @__PURE__ */ (0,
|
|
188
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_Operations.ClassClient, {
|
|
189
189
|
name,
|
|
190
190
|
operations: ops,
|
|
191
191
|
baseURL: options.baseURL,
|
|
@@ -203,13 +203,13 @@ const classClientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerat
|
|
|
203
203
|
|
|
204
204
|
//#endregion
|
|
205
205
|
//#region src/generators/clientGenerator.tsx
|
|
206
|
-
const clientGenerator = (0,
|
|
206
|
+
const clientGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
207
207
|
name: "client",
|
|
208
208
|
Operation({ config, plugin, operation, generator }) {
|
|
209
|
-
const pluginManager = (0,
|
|
209
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
210
210
|
const { options, options: { output, urlType } } = plugin;
|
|
211
|
-
const oas = (0,
|
|
212
|
-
const { getSchemas, getName, getFile } = (0,
|
|
211
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
212
|
+
const { getSchemas, getName, getFile } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
213
213
|
const client = {
|
|
214
214
|
name: getName(operation, { type: "function" }),
|
|
215
215
|
file: getFile(operation)
|
|
@@ -223,62 +223,62 @@ const clientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
223
223
|
file: getFile(operation)
|
|
224
224
|
};
|
|
225
225
|
const type = {
|
|
226
|
-
file: getFile(operation, { pluginKey: [
|
|
226
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_ts.pluginTsName] }),
|
|
227
227
|
schemas: getSchemas(operation, {
|
|
228
|
-
pluginKey: [
|
|
228
|
+
pluginKey: [_kubb_plugin_ts.pluginTsName],
|
|
229
229
|
type: "type"
|
|
230
230
|
})
|
|
231
231
|
};
|
|
232
232
|
const zod = {
|
|
233
|
-
file: getFile(operation, { pluginKey: [
|
|
233
|
+
file: getFile(operation, { pluginKey: [_kubb_plugin_zod.pluginZodName] }),
|
|
234
234
|
schemas: getSchemas(operation, {
|
|
235
|
-
pluginKey: [
|
|
235
|
+
pluginKey: [_kubb_plugin_zod.pluginZodName],
|
|
236
236
|
type: "function"
|
|
237
237
|
})
|
|
238
238
|
};
|
|
239
239
|
const isFormData = operation.getContentType() === "multipart/form-data";
|
|
240
|
-
return /* @__PURE__ */ (0,
|
|
240
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
241
241
|
baseName: client.file.baseName,
|
|
242
242
|
path: client.file.path,
|
|
243
243
|
meta: client.file.meta,
|
|
244
|
-
banner: (0,
|
|
244
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
245
245
|
oas,
|
|
246
246
|
output,
|
|
247
247
|
config: pluginManager.config
|
|
248
248
|
}),
|
|
249
|
-
footer: (0,
|
|
249
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
250
250
|
oas,
|
|
251
251
|
output
|
|
252
252
|
}),
|
|
253
253
|
children: [
|
|
254
|
-
options.importPath ? /* @__PURE__ */ (0,
|
|
254
|
+
options.importPath ? /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
255
255
|
name: "fetch",
|
|
256
256
|
path: options.importPath
|
|
257
|
-
}), /* @__PURE__ */ (0,
|
|
257
|
+
}), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
258
258
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
259
259
|
path: options.importPath,
|
|
260
260
|
isTypeOnly: true
|
|
261
|
-
})] }) : /* @__PURE__ */ (0,
|
|
261
|
+
})] }) : /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
262
262
|
name: ["fetch"],
|
|
263
263
|
root: client.file.path,
|
|
264
264
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts")
|
|
265
|
-
}), /* @__PURE__ */ (0,
|
|
265
|
+
}), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
266
266
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
267
267
|
root: client.file.path,
|
|
268
268
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
|
|
269
269
|
isTypeOnly: true
|
|
270
270
|
})] }),
|
|
271
|
-
isFormData && type.schemas.request?.name && /* @__PURE__ */ (0,
|
|
271
|
+
isFormData && type.schemas.request?.name && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
272
272
|
name: ["buildFormData"],
|
|
273
273
|
root: client.file.path,
|
|
274
274
|
path: node_path.default.resolve(config.root, config.output.path, ".kubb/config.ts")
|
|
275
275
|
}),
|
|
276
|
-
options.parser === "zod" && /* @__PURE__ */ (0,
|
|
276
|
+
options.parser === "zod" && /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
277
277
|
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
278
278
|
root: client.file.path,
|
|
279
279
|
path: zod.file.path
|
|
280
280
|
}),
|
|
281
|
-
/* @__PURE__ */ (0,
|
|
281
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
282
282
|
name: [
|
|
283
283
|
type.schemas.request?.name,
|
|
284
284
|
type.schemas.response.name,
|
|
@@ -291,7 +291,7 @@ const clientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
291
291
|
path: type.file.path,
|
|
292
292
|
isTypeOnly: true
|
|
293
293
|
}),
|
|
294
|
-
/* @__PURE__ */ (0,
|
|
294
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_Operations.Url, {
|
|
295
295
|
name: url.name,
|
|
296
296
|
baseURL: options.baseURL,
|
|
297
297
|
pathParamsType: options.pathParamsType,
|
|
@@ -302,7 +302,7 @@ const clientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
302
302
|
isIndexable: urlType === "export",
|
|
303
303
|
isExportable: urlType === "export"
|
|
304
304
|
}),
|
|
305
|
-
/* @__PURE__ */ (0,
|
|
305
|
+
/* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_Operations.Client, {
|
|
306
306
|
name: client.name,
|
|
307
307
|
urlName: url.name,
|
|
308
308
|
baseURL: options.baseURL,
|
|
@@ -322,17 +322,17 @@ const clientGenerator = (0, __kubb_plugin_oas_generators.createReactGenerator)({
|
|
|
322
322
|
|
|
323
323
|
//#endregion
|
|
324
324
|
//#region src/generators/groupedClientGenerator.tsx
|
|
325
|
-
const groupedClientGenerator = (0,
|
|
325
|
+
const groupedClientGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
326
326
|
name: "groupedClient",
|
|
327
327
|
Operations({ operations, generator, plugin }) {
|
|
328
328
|
const { options, key: pluginKey } = plugin;
|
|
329
|
-
const pluginManager = (0,
|
|
330
|
-
const oas = (0,
|
|
331
|
-
const { getName, getFile, getGroup } = (0,
|
|
329
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
330
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
331
|
+
const { getName, getFile, getGroup } = (0, _kubb_plugin_oas_hooks.useOperationManager)(generator);
|
|
332
332
|
return operations.reduce((acc, operation) => {
|
|
333
333
|
if (options.group?.type === "tag") {
|
|
334
334
|
const group = getGroup(operation);
|
|
335
|
-
const name = group?.tag ? options.group?.name?.({ group: (0,
|
|
335
|
+
const name = group?.tag ? options.group?.name?.({ group: (0, _kubb_core_transformers.camelCase)(group.tag) }) : void 0;
|
|
336
336
|
if (!group?.tag || !name) return acc;
|
|
337
337
|
const file = pluginManager.getFile({
|
|
338
338
|
name,
|
|
@@ -354,28 +354,28 @@ const groupedClientGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
354
354
|
}
|
|
355
355
|
return acc;
|
|
356
356
|
}, []).map(({ name, file, clients }) => {
|
|
357
|
-
return /* @__PURE__ */ (0,
|
|
357
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File, {
|
|
358
358
|
baseName: file.baseName,
|
|
359
359
|
path: file.path,
|
|
360
360
|
meta: file.meta,
|
|
361
|
-
banner: (0,
|
|
361
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
362
362
|
oas,
|
|
363
363
|
output: options.output,
|
|
364
364
|
config: pluginManager.config
|
|
365
365
|
}),
|
|
366
|
-
footer: (0,
|
|
366
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
367
367
|
oas,
|
|
368
368
|
output: options.output
|
|
369
369
|
}),
|
|
370
|
-
children: [clients.map((client) => /* @__PURE__ */ (0,
|
|
370
|
+
children: [clients.map((client) => /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Import, {
|
|
371
371
|
name: [client.name],
|
|
372
372
|
root: file.path,
|
|
373
373
|
path: client.file.path
|
|
374
|
-
}, client.name)), /* @__PURE__ */ (0,
|
|
374
|
+
}, client.name)), /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File.Source, {
|
|
375
375
|
name,
|
|
376
376
|
isExportable: true,
|
|
377
377
|
isIndexable: true,
|
|
378
|
-
children: /* @__PURE__ */ (0,
|
|
378
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.Function, {
|
|
379
379
|
export: true,
|
|
380
380
|
name,
|
|
381
381
|
children: `return { ${clients.map((client) => client.name).join(", ")} }`
|
|
@@ -388,32 +388,32 @@ const groupedClientGenerator = (0, __kubb_plugin_oas_generators.createReactGener
|
|
|
388
388
|
|
|
389
389
|
//#endregion
|
|
390
390
|
//#region src/generators/operationsGenerator.tsx
|
|
391
|
-
const operationsGenerator = (0,
|
|
391
|
+
const operationsGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
|
|
392
392
|
name: "client",
|
|
393
393
|
Operations({ operations, plugin }) {
|
|
394
394
|
const { key: pluginKey, options: { output } } = plugin;
|
|
395
|
-
const pluginManager = (0,
|
|
396
|
-
const oas = (0,
|
|
395
|
+
const pluginManager = (0, _kubb_core_hooks.usePluginManager)();
|
|
396
|
+
const oas = (0, _kubb_plugin_oas_hooks.useOas)();
|
|
397
397
|
const name = "operations";
|
|
398
398
|
const file = pluginManager.getFile({
|
|
399
399
|
name,
|
|
400
400
|
extname: ".ts",
|
|
401
401
|
pluginKey
|
|
402
402
|
});
|
|
403
|
-
return /* @__PURE__ */ (0,
|
|
403
|
+
return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(_kubb_react_fabric.File, {
|
|
404
404
|
baseName: file.baseName,
|
|
405
405
|
path: file.path,
|
|
406
406
|
meta: file.meta,
|
|
407
|
-
banner: (0,
|
|
407
|
+
banner: (0, _kubb_plugin_oas_utils.getBanner)({
|
|
408
408
|
oas,
|
|
409
409
|
output,
|
|
410
410
|
config: pluginManager.config
|
|
411
411
|
}),
|
|
412
|
-
footer: (0,
|
|
412
|
+
footer: (0, _kubb_plugin_oas_utils.getFooter)({
|
|
413
413
|
oas,
|
|
414
414
|
output
|
|
415
415
|
}),
|
|
416
|
-
children: /* @__PURE__ */ (0,
|
|
416
|
+
children: /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsx)(require_Operations.Operations, {
|
|
417
417
|
name,
|
|
418
418
|
operations
|
|
419
419
|
})
|
|
@@ -446,4 +446,4 @@ Object.defineProperty(exports, 'operationsGenerator', {
|
|
|
446
446
|
return operationsGenerator;
|
|
447
447
|
}
|
|
448
448
|
});
|
|
449
|
-
//# sourceMappingURL=generators-
|
|
449
|
+
//# sourceMappingURL=generators-CfbdSA-k.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generators-iy-47eUM.cjs","names":["pluginTsName","pluginZodName","File","path","ClassClient","pluginTsName","pluginZodName","File","path","Url","Client","File","Function","File","Operations"],"sources":["../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport 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={['RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <ClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Client } from '../components/Client'\nimport { Url } from '../components/Url.tsx'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ config, plugin, operation, generator }) {\n const pluginManager = usePluginManager()\n const {\n options,\n options: { output, urlType },\n } = plugin\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const url = {\n name: getName(operation, { type: 'function', suffix: 'url', prefix: 'get' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const isFormData = operation.getContentType() === 'multipart/form-data'\n\n return (\n <File\n baseName={client.file.baseName}\n path={client.file.path}\n meta={client.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={client.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {isFormData && type.schemas.request?.name && (\n <File.Import name={['buildFormData']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={client.file.path} path={zod.file.path} />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Url\n name={url.name}\n baseURL={options.baseURL}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n isIndexable={urlType === 'export'}\n isExportable={urlType === 'export'}\n />\n\n <Client\n name={client.name}\n urlName={url.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, Function } from '@kubb/react-fabric'\nimport type { PluginClient } from '../types'\n\nexport const groupedClientGenerator = createReactGenerator<PluginClient>({\n name: 'groupedClient',\n Operations({ operations, generator, plugin }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup } = useOperationManager(generator)\n\n const controllers = operations.reduce(\n (acc, operation) => {\n if (options.group?.type === 'tag') {\n const group = getGroup(operation)\n const name = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) : undefined\n\n if (!group?.tag || !name) {\n return acc\n }\n\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.clients.push(client)\n } else {\n acc.push({ name, file, clients: [client] })\n }\n }\n\n return acc\n },\n [] as Array<{ name: string; file: KubbFile.File; clients: Array<{ name: string; file: KubbFile.File }> }>,\n )\n\n return controllers.map(({ name, file, clients }) => {\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {clients.map((client) => (\n <File.Import key={client.name} name={[client.name]} root={file.path} path={client.file.path} />\n ))}\n\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name}>\n {`return { ${clients.map((client) => client.name).join(', ')} }`}\n </Function>\n </File.Source>\n </File>\n )\n })\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations, plugin }) {\n const {\n key: pluginKey,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAa,8EAA0D;CACrE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,QAAQ,UAAU;EACpD,MAAM,EAAE,SAAS,KAAK,cAAc;EACpC,MAAM,yDAAkC;EAExC,MAAM,2CAAc;EACpB,MAAM,EAAE,SAAS,SAAS,UAAU,gEAAmC,UAAU;EAEjF,SAAS,mBAAmB,WAAqC;GAC/D,MAAM,OAAO;IACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,8BAAa,EAAE,CAAC;IACvD,SAAS,WAAW,WAAW;KAAE,WAAW,CAACA,8BAAa;KAAE,MAAM;KAAQ,CAAC;IAC5E;GAED,MAAM,MAAM;IACV,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACC,gCAAc,EAAE,CAAC;IACxD,SAAS,WAAW,WAAW;KAAE,WAAW,CAACA,gCAAc;KAAE,MAAM;KAAY,CAAC;IACjF;AAED,UAAO;IACL;IACA,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;IAC9C,aAAa,KAAK;IAClB,YAAY,IAAI;IAChB,UAAU,KAAK;IACf,SAAS,IAAI;IAC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Client","pluginTsName","pluginZodName","File","path","Url","Client","File","Function","File","Operations"],"sources":["../src/generators/classClientGenerator.tsx","../src/generators/clientGenerator.tsx","../src/generators/groupedClientGenerator.tsx","../src/generators/operationsGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { camelCase, pascalCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport type { Operation } from '@kubb/oas'\nimport 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={['RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {hasFormData && <File.Import name={['buildFormData']} root={file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />}\n\n {Array.from(typeImportsByFile.entries()).map(([filePath, imports]) => {\n const typeFile = typeFilesByPath.get(filePath)\n if (!typeFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n return <File.Import key={filePath} name={importNames} root={file.path} path={typeFile.path} isTypeOnly />\n })}\n\n {options.parser === 'zod' &&\n Array.from(zodImportsByFile.entries()).map(([filePath, imports]) => {\n const zodFile = zodFilesByPath.get(filePath)\n if (!zodFile) {\n return null\n }\n const importNames = Array.from(imports).filter(Boolean)\n if (importNames.length === 0) {\n return null\n }\n\n return <File.Import key={filePath} name={importNames} root={file.path} path={zodFile.path} />\n })}\n\n <ClassClient\n name={name}\n operations={ops}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n parser={options.parser}\n />\n </File>\n )\n })\n },\n})\n","import path from 'node:path'\nimport { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Client } from '../components/Client'\nimport { Url } from '../components/Url.tsx'\nimport type { PluginClient } from '../types'\n\nexport const clientGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operation({ config, plugin, operation, generator }) {\n const pluginManager = usePluginManager()\n const {\n options,\n options: { output, urlType },\n } = plugin\n\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const url = {\n name: getName(operation, { type: 'function', suffix: 'url', prefix: 'get' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n const zod = {\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n }\n\n const isFormData = operation.getContentType() === 'multipart/form-data'\n\n return (\n <File\n baseName={client.file.baseName}\n path={client.file.path}\n meta={client.file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n {options.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={client.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n </>\n )}\n\n {isFormData && type.schemas.request?.name && (\n <File.Import name={['buildFormData']} root={client.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n )}\n\n {options.parser === 'zod' && (\n <File.Import name={[zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean)} root={client.file.path} path={zod.file.path} />\n )}\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={client.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Url\n name={url.name}\n baseURL={options.baseURL}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n isIndexable={urlType === 'export'}\n isExportable={urlType === 'export'}\n />\n\n <Client\n name={client.name}\n urlName={url.name}\n baseURL={options.baseURL}\n dataReturnType={options.dataReturnType}\n pathParamsType={options.pathParamsType}\n paramsCasing={options.paramsCasing}\n paramsType={options.paramsType}\n typeSchemas={type.schemas}\n operation={operation}\n parser={options.parser}\n zodSchemas={zod.schemas}\n />\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/fabric-core/types'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, Function } from '@kubb/react-fabric'\nimport type { PluginClient } from '../types'\n\nexport const groupedClientGenerator = createReactGenerator<PluginClient>({\n name: 'groupedClient',\n Operations({ operations, generator, plugin }) {\n const { options, key: pluginKey } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getName, getFile, getGroup } = useOperationManager(generator)\n\n const controllers = operations.reduce(\n (acc, operation) => {\n if (options.group?.type === 'tag') {\n const group = getGroup(operation)\n const name = group?.tag ? options.group?.name?.({ group: camelCase(group.tag) }) : undefined\n\n if (!group?.tag || !name) {\n return acc\n }\n\n const file = pluginManager.getFile({\n name,\n extname: '.ts',\n pluginKey,\n options: { group },\n })\n\n const client = {\n name: getName(operation, { type: 'function' }),\n file: getFile(operation),\n }\n\n const previousFile = acc.find((item) => item.file.path === file.path)\n\n if (previousFile) {\n previousFile.clients.push(client)\n } else {\n acc.push({ name, file, clients: [client] })\n }\n }\n\n return acc\n },\n [] as Array<{ name: string; file: KubbFile.File; clients: Array<{ name: string; file: KubbFile.File }> }>,\n )\n\n return controllers.map(({ name, file, clients }) => {\n return (\n <File\n key={file.path}\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n {clients.map((client) => (\n <File.Import key={client.name} name={[client.name]} root={file.path} path={client.file.path} />\n ))}\n\n <File.Source name={name} isExportable isIndexable>\n <Function export name={name}>\n {`return { ${clients.map((client) => client.name).join(', ')} }`}\n </Function>\n </File.Source>\n </File>\n )\n })\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File } from '@kubb/react-fabric'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations, plugin }) {\n const {\n key: pluginKey,\n options: { output },\n } = plugin\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AA8BA,MAAa,6EAA0D;CACrE,MAAM;CACN,WAAW,EAAE,YAAY,WAAW,QAAQ,UAAU;EACpD,MAAM,EAAE,SAAS,KAAK,cAAc;EACpC,MAAM,wDAAkC;EAExC,MAAM,0CAAc;EACpB,MAAM,EAAE,SAAS,SAAS,UAAU,+DAAmC,UAAU;EAEjF,SAAS,mBAAmB,WAAqC;GAC/D,MAAM,OAAO;IACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,6BAAa,EAAE,CAAC;IACvD,SAAS,WAAW,WAAW;KAAE,WAAW,CAACA,6BAAa;KAAE,MAAM;KAAQ,CAAC;IAC5E;GAED,MAAM,MAAM;IACV,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACC,+BAAc,EAAE,CAAC;IACxD,SAAS,WAAW,WAAW;KAAE,WAAW,CAACA,+BAAc;KAAE,MAAM;KAAY,CAAC;IACjF;AAED,UAAO;IACL;IACA,MAAM,QAAQ,WAAW,EAAE,MAAM,YAAY,CAAC;IAC9C,aAAa,KAAK;IAClB,YAAY,IAAI;IAChB,UAAU,KAAK;IACf,SAAS,IAAI;IACd;;EAIH,MAAM,cAAc,WAAW,QAC5B,KAAK,cAAc;GAClB,MAAM,QAAQ,SAAS,UAAU;GACjC,MAA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AAC,OAAO;KAAE,CAAC;;AAI/C,UAAO;KAET,EAAE,CACH,CAEkB,KAAK,EAAE,MAAM,MAAM,cAAc;AAClD,UACE,yDAACC;IAEC,UAAU,KAAK;IACf,MAAM,KAAK;IACX,MAAM,KAAK;IACX,8CAAkB;KAAE;KAAK,QAAQ,QAAQ;KAAQ,QAAQ,cAAc;KAAQ,CAAC;IAChF,8CAAkB;KAAE;KAAK,QAAQ,QAAQ;KAAQ,CAAC;eAEjD,QAAQ,KAAK,WACZ,wDAACA,wBAAK;KAAyB,MAAM,CAAC,OAAO,KAAK;KAAE,MAAM,KAAK;KAAM,MAAM,OAAO,KAAK;OAArE,OAAO,KAAsE,CAC/F,EAEF,wDAACA,wBAAK;KAAa;KAAM;KAAa;eACpC,wDAACC;MAAS;MAAa;gBACpB,YAAY,QAAQ,KAAK,WAAW,OAAO,KAAK,CAAC,KAAK,KAAK,CAAC;OACpD;MACC;MAfT,KAAK,KAgBL;IAET;;CAEL,CAAC;;;;ACrEF,MAAa,4EAAyD;CACpE,MAAM;CACN,WAAW,EAAE,YAAY,UAAU;EACjC,MAAM,EACJ,KAAK,WACL,SAAS,EAAE,aACT;EACJ,MAAM,wDAAkC;EAExC,MAAM,0CAAc;EAEpB,MAAM,OAAO;EACb,MAAM,OAAO,cAAc,QAAQ;GAAE;GAAM,SAAS;GAAO;GAAW,CAAC;AAEvE,SACE,wDAACC;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,8CAAkB;IAAE;IAAK;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChE,8CAAkB;IAAE;IAAK;IAAQ,CAAC;aAElC,wDAACC;IAAiB;IAAkB;KAAc;IAC7C;;CAGZ,CAAC"}
|
package/dist/generators.cjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_generators = require('./generators-
|
|
2
|
+
const require_generators = require('./generators-CfbdSA-k.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_chunk.__toESM(node_path);
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
5
|
+
let _kubb_core = require("@kubb/core");
|
|
6
|
+
let _kubb_core_transformers = require("@kubb/core/transformers");
|
|
7
|
+
let _kubb_core_utils = require("@kubb/core/utils");
|
|
8
|
+
let _kubb_plugin_oas = require("@kubb/plugin-oas");
|
|
9
|
+
let _kubb_plugin_zod = require("@kubb/plugin-zod");
|
|
10
10
|
|
|
11
11
|
//#region src/plugin.ts
|
|
12
12
|
const pluginClientName = "plugin-client";
|
|
13
|
-
const pluginClient = (0,
|
|
13
|
+
const pluginClient = (0, _kubb_core.definePlugin)((options) => {
|
|
14
14
|
const { output = {
|
|
15
15
|
path: "clients",
|
|
16
16
|
barrelType: "named"
|
|
@@ -39,10 +39,10 @@ const pluginClient = (0, __kubb_core.definePlugin)((options) => {
|
|
|
39
39
|
baseURL,
|
|
40
40
|
urlType
|
|
41
41
|
},
|
|
42
|
-
pre: [
|
|
42
|
+
pre: [_kubb_plugin_oas.pluginOasName, parser === "zod" ? _kubb_plugin_zod.pluginZodName : void 0].filter(Boolean),
|
|
43
43
|
resolvePath(baseName, pathMode, options$1) {
|
|
44
44
|
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
45
|
-
if ((pathMode ?? (0,
|
|
45
|
+
if ((pathMode ?? (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
|
|
46
46
|
/**
|
|
47
47
|
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
48
48
|
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
@@ -51,20 +51,20 @@ const pluginClient = (0, __kubb_core.definePlugin)((options) => {
|
|
|
51
51
|
if (group && (options$1?.group?.path || options$1?.group?.tag)) {
|
|
52
52
|
const groupName = group?.name ? group.name : (ctx) => {
|
|
53
53
|
if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
54
|
-
return `${(0,
|
|
54
|
+
return `${(0, _kubb_core_transformers.camelCase)(ctx.group)}Controller`;
|
|
55
55
|
};
|
|
56
56
|
return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options$1.group.path : options$1.group.tag }), baseName);
|
|
57
57
|
}
|
|
58
58
|
return node_path.default.resolve(root, output.path, baseName);
|
|
59
59
|
},
|
|
60
60
|
resolveName(name, type) {
|
|
61
|
-
const resolvedName = (0,
|
|
61
|
+
const resolvedName = (0, _kubb_core_transformers.camelCase)(name, { isFile: type === "file" });
|
|
62
62
|
if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
|
|
63
63
|
return resolvedName;
|
|
64
64
|
},
|
|
65
65
|
async install() {
|
|
66
66
|
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
67
|
-
const mode = (0,
|
|
67
|
+
const mode = (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path));
|
|
68
68
|
const oas = await this.getOas();
|
|
69
69
|
const baseURL$1 = await this.getBaseURL();
|
|
70
70
|
if (bundle && !this.plugin.options.importPath) await this.addFile({
|
|
@@ -72,7 +72,7 @@ const pluginClient = (0, __kubb_core.definePlugin)((options) => {
|
|
|
72
72
|
path: node_path.default.resolve(root, ".kubb/fetch.ts"),
|
|
73
73
|
sources: [{
|
|
74
74
|
name: "fetch",
|
|
75
|
-
value: (0,
|
|
75
|
+
value: (0, _kubb_core_utils.resolveModuleSource)(this.plugin.options.client === "fetch" ? "@kubb/plugin-client/templates/clients/fetch" : "@kubb/plugin-client/templates/clients/axios").source,
|
|
76
76
|
isExportable: true,
|
|
77
77
|
isIndexable: true
|
|
78
78
|
}]
|
|
@@ -82,12 +82,12 @@ const pluginClient = (0, __kubb_core.definePlugin)((options) => {
|
|
|
82
82
|
path: node_path.default.resolve(root, ".kubb/config.ts"),
|
|
83
83
|
sources: [{
|
|
84
84
|
name: "config",
|
|
85
|
-
value: (0,
|
|
85
|
+
value: (0, _kubb_core_utils.resolveModuleSource)("@kubb/plugin-client/templates/config").source,
|
|
86
86
|
isExportable: false,
|
|
87
87
|
isIndexable: false
|
|
88
88
|
}]
|
|
89
89
|
});
|
|
90
|
-
const files = await new
|
|
90
|
+
const files = await new _kubb_plugin_oas.OperationGenerator(baseURL$1 ? {
|
|
91
91
|
...this.plugin.options,
|
|
92
92
|
baseURL: baseURL$1
|
|
93
93
|
} : this.plugin.options, {
|
|
@@ -103,7 +103,7 @@ const pluginClient = (0, __kubb_core.definePlugin)((options) => {
|
|
|
103
103
|
mode
|
|
104
104
|
}).build(...generators);
|
|
105
105
|
await this.upsertFile(...files);
|
|
106
|
-
const barrelFiles = await (0,
|
|
106
|
+
const barrelFiles = await (0, _kubb_core.getBarrelFiles)(this.fabric.files, {
|
|
107
107
|
type: output.barrelType ?? "named",
|
|
108
108
|
root,
|
|
109
109
|
output,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["classClientGenerator","clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","path","options","groupName: Group['name']","baseURL","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { classClientGenerator, operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = definePlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrelType: 'named' },\n group,\n urlType = false,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n baseURL,\n paramsCasing,\n clientType = 'function',\n parser = 'client',\n client = 'axios',\n importPath,\n contentType,\n bundle = false,\n } = options\n\n const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : undefined)\n const defaultGenerators = [\n clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType !== 'class' ? groupedClientGenerator : undefined,\n operations ? operationsGenerator : undefined,\n ].filter(Boolean)\n\n const generators = options.generators ?? defaultGenerators\n\n return {\n name: pluginClientName,\n options: {\n client,\n clientType,\n bundle,\n output,\n group,\n parser,\n dataReturnType,\n importPath: resolvedImportPath,\n paramsType,\n paramsCasing,\n pathParamsType,\n baseURL,\n urlType,\n },\n pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n // pre add bundled fetch\n if (bundle && !this.plugin.options.importPath) {\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n\n const operationGenerator = new OperationGenerator(\n baseURL\n ? {\n ...this.plugin.options,\n baseURL,\n }\n : this.plugin.options,\n {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n 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":";;;;;;;;;;;AAWA,MAAa,mBAAmB;AAEhC,MAAa,
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["classClientGenerator","clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","path","options","groupName: Group['name']","baseURL","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { classClientGenerator, operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = definePlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrelType: 'named' },\n group,\n urlType = false,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n baseURL,\n paramsCasing,\n clientType = 'function',\n parser = 'client',\n client = 'axios',\n importPath,\n contentType,\n bundle = false,\n } = options\n\n const resolvedImportPath = importPath ?? (!bundle ? `@kubb/plugin-client/clients/${client}` : undefined)\n const defaultGenerators = [\n clientType === 'class' ? classClientGenerator : clientGenerator,\n group && clientType !== 'class' ? groupedClientGenerator : undefined,\n operations ? operationsGenerator : undefined,\n ].filter(Boolean)\n\n const generators = options.generators ?? defaultGenerators\n\n return {\n name: pluginClientName,\n options: {\n client,\n clientType,\n bundle,\n output,\n group,\n parser,\n dataReturnType,\n importPath: resolvedImportPath,\n paramsType,\n paramsCasing,\n pathParamsType,\n baseURL,\n urlType,\n },\n pre: [pluginOasName, parser === 'zod' ? pluginZodName : undefined].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Controller`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, { isFile: type === 'file' })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n // pre add bundled fetch\n if (bundle && !this.plugin.options.importPath) {\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n\n const operationGenerator = new OperationGenerator(\n baseURL\n ? {\n ...this.plugin.options,\n baseURL,\n }\n : this.plugin.options,\n {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n 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":";;;;;;;;;;;AAWA,MAAa,mBAAmB;AAEhC,MAAa,6CAA2C,YAAY;CAClE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;EAAS,EACjD,OACA,UAAU,OACV,UAAU,EAAE,EACZ,SACA,W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AG,YAAY;;EAExC;EACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-client",
|
|
3
|
-
"version": "4.12.
|
|
3
|
+
"version": "4.12.5",
|
|
4
4
|
"description": "API client generator plugin for Kubb, creating type-safe HTTP clients (Axios, Fetch) from OpenAPI specifications for making API requests.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api-client",
|
|
@@ -86,19 +86,19 @@
|
|
|
86
86
|
}
|
|
87
87
|
],
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@kubb/react-fabric": "0.7.
|
|
89
|
+
"@kubb/react-fabric": "0.7.1",
|
|
90
90
|
"jiti": "^2.6.1",
|
|
91
|
-
"@kubb/core": "4.12.
|
|
92
|
-
"@kubb/oas": "4.12.
|
|
93
|
-
"@kubb/plugin-oas": "4.12.
|
|
94
|
-
"@kubb/plugin-ts": "4.12.
|
|
95
|
-
"@kubb/plugin-zod": "4.12.
|
|
91
|
+
"@kubb/core": "4.12.5",
|
|
92
|
+
"@kubb/oas": "4.12.5",
|
|
93
|
+
"@kubb/plugin-oas": "4.12.5",
|
|
94
|
+
"@kubb/plugin-ts": "4.12.5",
|
|
95
|
+
"@kubb/plugin-zod": "4.12.5"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"axios": "^1.13.2"
|
|
99
99
|
},
|
|
100
100
|
"peerDependencies": {
|
|
101
|
-
"@kubb/react-fabric": "0.7.
|
|
101
|
+
"@kubb/react-fabric": "0.7.1",
|
|
102
102
|
"axios": "^1.7.2"
|
|
103
103
|
},
|
|
104
104
|
"peerDependenciesMeta": {
|