@kubb/plugin-client 3.16.2 → 3.16.4
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-Cxn7C-GC.cjs +228 -0
- package/dist/Operations-Cxn7C-GC.cjs.map +1 -0
- package/dist/Operations-tGJwS9Oj.js +210 -0
- package/dist/Operations-tGJwS9Oj.js.map +1 -0
- package/dist/chunk-CUT6urMc.cjs +30 -0
- package/dist/clients/axios.cjs +24 -30
- package/dist/clients/axios.cjs.map +1 -1
- package/dist/clients/axios.d.cts +23 -21
- package/dist/clients/axios.d.ts +23 -21
- package/dist/clients/axios.js +23 -23
- package/dist/clients/axios.js.map +1 -1
- package/dist/clients/fetch.cjs +37 -36
- package/dist/clients/fetch.cjs.map +1 -1
- package/dist/clients/fetch.d.cts +20 -18
- package/dist/clients/fetch.d.ts +20 -18
- package/dist/clients/fetch.js +37 -34
- package/dist/clients/fetch.js.map +1 -1
- package/dist/components.cjs +4 -19
- package/dist/components.d.cts +97 -56
- package/dist/components.d.ts +97 -56
- package/dist/components.js +3 -3
- package/dist/generators-BQnLTqYl.js +216 -0
- package/dist/generators-BQnLTqYl.js.map +1 -0
- package/dist/generators-XXsaqEtA.cjs +234 -0
- package/dist/generators-XXsaqEtA.cjs.map +1 -0
- package/dist/generators.cjs +5 -20
- package/dist/generators.d.cts +12 -11
- package/dist/generators.d.ts +12 -11
- package/dist/generators.js +4 -4
- package/dist/index.cjs +89 -118
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +88 -112
- package/dist/index.js.map +1 -1
- package/dist/types-CdM4kNiz.d.ts +1274 -0
- package/dist/types-Cpfa5PKO.d.cts +1274 -0
- package/package.json +27 -34
- package/dist/chunk-H5KNP3DD.cjs +0 -205
- package/dist/chunk-H5KNP3DD.cjs.map +0 -1
- package/dist/chunk-LNJCFB5O.js +0 -201
- package/dist/chunk-LNJCFB5O.js.map +0 -1
- package/dist/chunk-QNFXNUH5.js +0 -187
- package/dist/chunk-QNFXNUH5.js.map +0 -1
- package/dist/chunk-SDEXSATF.cjs +0 -191
- package/dist/chunk-SDEXSATF.cjs.map +0 -1
- package/dist/components.cjs.map +0 -1
- package/dist/components.js.map +0 -1
- package/dist/generators.cjs.map +0 -1
- package/dist/generators.js.map +0 -1
- package/dist/types-DFo3xInC.d.cts +0 -119
- package/dist/types-DFo3xInC.d.ts +0 -119
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
const require_Operations = require('./Operations-Cxn7C-GC.cjs');
|
|
3
|
+
const __kubb_core_transformers = require_chunk.__toESM(require("@kubb/core/transformers"));
|
|
4
|
+
const __kubb_plugin_oas = require_chunk.__toESM(require("@kubb/plugin-oas"));
|
|
5
|
+
const __kubb_plugin_zod = require_chunk.__toESM(require("@kubb/plugin-zod"));
|
|
6
|
+
const __kubb_plugin_oas_hooks = require_chunk.__toESM(require("@kubb/plugin-oas/hooks"));
|
|
7
|
+
const __kubb_plugin_oas_utils = require_chunk.__toESM(require("@kubb/plugin-oas/utils"));
|
|
8
|
+
const __kubb_plugin_ts = require_chunk.__toESM(require("@kubb/plugin-ts"));
|
|
9
|
+
const __kubb_react = require_chunk.__toESM(require("@kubb/react"));
|
|
10
|
+
const __kubb_react_jsx_runtime = require_chunk.__toESM(require("@kubb/react/jsx-runtime"));
|
|
11
|
+
|
|
12
|
+
//#region src/generators/clientGenerator.tsx
|
|
13
|
+
const clientGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
14
|
+
name: "client",
|
|
15
|
+
Operation({ options, operation }) {
|
|
16
|
+
const { plugin: { options: { output, urlType } }, pluginManager } = (0, __kubb_react.useApp)();
|
|
17
|
+
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
18
|
+
const { getSchemas, getName, getFile } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
19
|
+
const client = {
|
|
20
|
+
name: getName(operation, { type: "function" }),
|
|
21
|
+
file: getFile(operation)
|
|
22
|
+
};
|
|
23
|
+
const url = {
|
|
24
|
+
name: getName(operation, {
|
|
25
|
+
type: "function",
|
|
26
|
+
suffix: "url",
|
|
27
|
+
prefix: "get"
|
|
28
|
+
}),
|
|
29
|
+
file: getFile(operation)
|
|
30
|
+
};
|
|
31
|
+
const type = {
|
|
32
|
+
file: getFile(operation, { pluginKey: [__kubb_plugin_ts.pluginTsName] }),
|
|
33
|
+
schemas: getSchemas(operation, {
|
|
34
|
+
pluginKey: [__kubb_plugin_ts.pluginTsName],
|
|
35
|
+
type: "type"
|
|
36
|
+
})
|
|
37
|
+
};
|
|
38
|
+
const zod = {
|
|
39
|
+
file: getFile(operation, { pluginKey: [__kubb_plugin_zod.pluginZodName] }),
|
|
40
|
+
schemas: getSchemas(operation, {
|
|
41
|
+
pluginKey: [__kubb_plugin_zod.pluginZodName],
|
|
42
|
+
type: "function"
|
|
43
|
+
})
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsxs)(__kubb_react.File, {
|
|
46
|
+
baseName: client.file.baseName,
|
|
47
|
+
path: client.file.path,
|
|
48
|
+
meta: client.file.meta,
|
|
49
|
+
banner: (0, __kubb_plugin_oas_utils.getBanner)({
|
|
50
|
+
oas,
|
|
51
|
+
output,
|
|
52
|
+
config: pluginManager.config
|
|
53
|
+
}),
|
|
54
|
+
footer: (0, __kubb_plugin_oas_utils.getFooter)({
|
|
55
|
+
oas,
|
|
56
|
+
output
|
|
57
|
+
}),
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
60
|
+
name: "fetch",
|
|
61
|
+
path: options.importPath
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
64
|
+
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
65
|
+
path: options.importPath,
|
|
66
|
+
isTypeOnly: true
|
|
67
|
+
}),
|
|
68
|
+
options.parser === "zod" && /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
69
|
+
name: [zod.schemas.response.name, zod.schemas.request?.name].filter(Boolean),
|
|
70
|
+
root: client.file.path,
|
|
71
|
+
path: zod.file.path
|
|
72
|
+
}),
|
|
73
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
74
|
+
name: [
|
|
75
|
+
type.schemas.request?.name,
|
|
76
|
+
type.schemas.response.name,
|
|
77
|
+
type.schemas.pathParams?.name,
|
|
78
|
+
type.schemas.queryParams?.name,
|
|
79
|
+
type.schemas.headerParams?.name,
|
|
80
|
+
...type.schemas.statusCodes?.map((item) => item.name) || []
|
|
81
|
+
].filter(Boolean),
|
|
82
|
+
root: client.file.path,
|
|
83
|
+
path: type.file.path,
|
|
84
|
+
isTypeOnly: true
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(require_Operations.Url, {
|
|
87
|
+
name: url.name,
|
|
88
|
+
baseURL: options.baseURL,
|
|
89
|
+
pathParamsType: options.pathParamsType,
|
|
90
|
+
paramsCasing: options.paramsCasing,
|
|
91
|
+
paramsType: options.paramsType,
|
|
92
|
+
typeSchemas: type.schemas,
|
|
93
|
+
operation,
|
|
94
|
+
isIndexable: urlType === "export",
|
|
95
|
+
isExportable: urlType === "export"
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(require_Operations.Client, {
|
|
98
|
+
name: client.name,
|
|
99
|
+
urlName: url.name,
|
|
100
|
+
baseURL: options.baseURL,
|
|
101
|
+
dataReturnType: options.dataReturnType,
|
|
102
|
+
pathParamsType: options.pathParamsType,
|
|
103
|
+
paramsCasing: options.paramsCasing,
|
|
104
|
+
paramsType: options.paramsType,
|
|
105
|
+
typeSchemas: type.schemas,
|
|
106
|
+
operation,
|
|
107
|
+
parser: options.parser,
|
|
108
|
+
zodSchemas: zod.schemas
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
//#region src/generators/operationsGenerator.tsx
|
|
117
|
+
const operationsGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
118
|
+
name: "client",
|
|
119
|
+
Operations({ operations }) {
|
|
120
|
+
const { pluginManager, plugin: { key: pluginKey, options: { output } } } = (0, __kubb_react.useApp)();
|
|
121
|
+
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
122
|
+
const name = "operations";
|
|
123
|
+
const file = pluginManager.getFile({
|
|
124
|
+
name,
|
|
125
|
+
extname: ".ts",
|
|
126
|
+
pluginKey
|
|
127
|
+
});
|
|
128
|
+
return /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File, {
|
|
129
|
+
baseName: file.baseName,
|
|
130
|
+
path: file.path,
|
|
131
|
+
meta: file.meta,
|
|
132
|
+
banner: (0, __kubb_plugin_oas_utils.getBanner)({
|
|
133
|
+
oas,
|
|
134
|
+
output,
|
|
135
|
+
config: pluginManager.config
|
|
136
|
+
}),
|
|
137
|
+
footer: (0, __kubb_plugin_oas_utils.getFooter)({
|
|
138
|
+
oas,
|
|
139
|
+
output
|
|
140
|
+
}),
|
|
141
|
+
children: /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(require_Operations.Operations, {
|
|
142
|
+
name,
|
|
143
|
+
operations
|
|
144
|
+
})
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
//#endregion
|
|
150
|
+
//#region src/generators/groupedClientGenerator.tsx
|
|
151
|
+
const groupedClientGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
152
|
+
name: "groupedClient",
|
|
153
|
+
Operations({ operations }) {
|
|
154
|
+
const { pluginManager, plugin: { options, key: pluginKey } } = (0, __kubb_react.useApp)();
|
|
155
|
+
const oas = (0, __kubb_plugin_oas_hooks.useOas)();
|
|
156
|
+
const { getName, getFile, getGroup } = (0, __kubb_plugin_oas_hooks.useOperationManager)();
|
|
157
|
+
const controllers = operations.reduce((acc, operation) => {
|
|
158
|
+
if (options.group?.type === "tag") {
|
|
159
|
+
const group = getGroup(operation);
|
|
160
|
+
const name = group?.tag ? options.group?.name?.({ group: (0, __kubb_core_transformers.camelCase)(group.tag) }) : void 0;
|
|
161
|
+
if (!group?.tag || !name) return acc;
|
|
162
|
+
const file = pluginManager.getFile({
|
|
163
|
+
name,
|
|
164
|
+
extname: ".ts",
|
|
165
|
+
pluginKey,
|
|
166
|
+
options: { group }
|
|
167
|
+
});
|
|
168
|
+
const client = {
|
|
169
|
+
name: getName(operation, { type: "function" }),
|
|
170
|
+
file: getFile(operation)
|
|
171
|
+
};
|
|
172
|
+
const previousFile = acc.find((item) => item.file.path === file.path);
|
|
173
|
+
if (previousFile) previousFile.clients.push(client);
|
|
174
|
+
else acc.push({
|
|
175
|
+
name,
|
|
176
|
+
file,
|
|
177
|
+
clients: [client]
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
return acc;
|
|
181
|
+
}, []);
|
|
182
|
+
return controllers.map(({ name, file, clients }) => {
|
|
183
|
+
return /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsxs)(__kubb_react.File, {
|
|
184
|
+
baseName: file.baseName,
|
|
185
|
+
path: file.path,
|
|
186
|
+
meta: file.meta,
|
|
187
|
+
banner: (0, __kubb_plugin_oas_utils.getBanner)({
|
|
188
|
+
oas,
|
|
189
|
+
output: options.output,
|
|
190
|
+
config: pluginManager.config
|
|
191
|
+
}),
|
|
192
|
+
footer: (0, __kubb_plugin_oas_utils.getFooter)({
|
|
193
|
+
oas,
|
|
194
|
+
output: options.output
|
|
195
|
+
}),
|
|
196
|
+
children: [clients.map((client) => /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Import, {
|
|
197
|
+
name: [client.name],
|
|
198
|
+
root: file.path,
|
|
199
|
+
path: client.file.path
|
|
200
|
+
}, client.name)), /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.File.Source, {
|
|
201
|
+
name,
|
|
202
|
+
isExportable: true,
|
|
203
|
+
isIndexable: true,
|
|
204
|
+
children: /* @__PURE__ */ (0, __kubb_react_jsx_runtime.jsx)(__kubb_react.Function, {
|
|
205
|
+
export: true,
|
|
206
|
+
name,
|
|
207
|
+
children: `return { ${clients.map((client) => client.name).join(", ")} }`
|
|
208
|
+
})
|
|
209
|
+
})]
|
|
210
|
+
}, file.path);
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
//#endregion
|
|
216
|
+
Object.defineProperty(exports, 'clientGenerator', {
|
|
217
|
+
enumerable: true,
|
|
218
|
+
get: function () {
|
|
219
|
+
return clientGenerator;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
Object.defineProperty(exports, 'groupedClientGenerator', {
|
|
223
|
+
enumerable: true,
|
|
224
|
+
get: function () {
|
|
225
|
+
return groupedClientGenerator;
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
Object.defineProperty(exports, 'operationsGenerator', {
|
|
229
|
+
enumerable: true,
|
|
230
|
+
get: function () {
|
|
231
|
+
return operationsGenerator;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
//# sourceMappingURL=generators-XXsaqEtA.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-XXsaqEtA.cjs","names":["pluginTsName","pluginZodName","File","Url","Client","File","Operations","File","Function"],"sources":["../src/generators/clientGenerator.tsx","../src/generators/operationsGenerator.tsx","../src/generators/groupedClientGenerator.tsx"],"sourcesContent":["import { createReactGenerator } from '@kubb/plugin-oas'\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, useApp } from '@kubb/react'\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({ options, operation }) {\n const {\n plugin: {\n options: { output, urlType },\n },\n pluginManager,\n } = useApp<PluginClient>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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 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 <File.Import name={'fetch'} path={options.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.importPath} isTypeOnly />\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 { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, useApp } from '@kubb/react'\nimport { Operations } from '../components/Operations'\nimport type { PluginClient } from '../types'\n\nexport const operationsGenerator = createReactGenerator<PluginClient>({\n name: 'client',\n Operations({ operations }) {\n const {\n pluginManager,\n plugin: {\n key: pluginKey,\n options: { output },\n },\n } = useApp<PluginClient>()\n const oas = useOas()\n\n const name = 'operations'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey })\n\n return (\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output, config: pluginManager.config })}\n footer={getFooter({ oas, output })}\n >\n <Operations name={name} operations={operations} />\n </File>\n )\n },\n})\n","import { camelCase } from '@kubb/core/transformers'\nimport type { KubbFile } from '@kubb/core/fs'\n\nimport { createReactGenerator } from '@kubb/plugin-oas'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { File, Function, useApp } from '@kubb/react'\nimport type { PluginClient } from '../types'\n\nexport const groupedClientGenerator = createReactGenerator<PluginClient>({\n name: 'groupedClient',\n Operations({ operations }) {\n const {\n pluginManager,\n plugin: { options, key: pluginKey },\n } = useApp<PluginClient>()\n const oas = useOas()\n const { getName, getFile, getGroup } = useOperationManager()\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"],"mappings":";;;;;;;;;;;;AAUA,MAAa,8DAAqD;CAChE,MAAM;CACN,UAAU,EAAE,SAAS,WAAW,EAAE;EAChC,MAAM,EACJ,QAAQ,EACN,SAAS,EAAE,QAAQ,SAAS,EAC7B,EACD,eACD,6BAAyB;EAC1B,MAAM,2CAAc;EACpB,MAAM,EAAE,YAAY,SAAS,SAAS,qDAAwB;EAE9D,MAAM,SAAS;GACb,MAAM,QAAQ,WAAW,EAAE,MAAM,WAAY,EAAC;GAC9C,MAAM,QAAQ,UAAU;EACzB;EAED,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAO,QAAQ;GAAO,EAAC;GAC5E,MAAM,QAAQ,UAAU;EACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW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;KACA,SAAS;KACT;KACA,SAAS,EAAE,MAAO;IACnB,EAAC;IAEF,MAAM,SAAS;KACb,MAAM,QAAQ,WAAW,EAAE,MAAM,WAAY,EAAC;KAC9C,MAAM,QAAQ,UAAU;IACzB;IAED,MAAM,eAAe,IAAI,KAAK,CAAC,SAAS,KAAK,KAAK,SAAS,KAAK,KAAK;AAErE,QAAI,cACF,aAAa,QAAQ,KAAK,OAAO;SAEjC,IAAI,KAAK;KAAE;KAAM;KAAM,SAAS,CAAC,MAAO;IAAE,EAAC;GAE9C;AAED,UAAO;EACR,GACD,CAAE,EACH;AAED,SAAO,YAAY,IAAI,CAAC,EAAE,MAAM,MAAM,SAAS,KAAK;AAClD,6DACGC;IAEC,UAAU,KAAK;IACf,MAAM,KAAK;IACX,MAAM,KAAK;IACX,+CAAkB;KAAE;KAAK,QAAQ,QAAQ;KAAQ,QAAQ,cAAc;IAAQ,EAAC;IAChF,+CAAkB;KAAE;KAAK,QAAQ,QAAQ;IAAQ,EAAC;eAEjD,QAAQ,IAAI,CAAC,6DACXA,kBAAK;KAAyB,MAAM,CAAC,OAAO,IAAK;KAAE,MAAM,KAAK;KAAM,MAAM,OAAO,KAAK;OAArE,OAAO,KAAsE,CAC/F,oDAEDA,kBAAK;KAAa;KAAM;KAAa;iEACnCC;MAAS;MAAa;gBACpB,CAAC,SAAS,EAAE,QAAQ,IAAI,CAAC,WAAW,OAAO,KAAK,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC;OACvD;MACC;MAfT,KAAK,KAgBL;EAEV,EAAC;CACH;AACF,EAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,21 +1,6 @@
|
|
|
1
|
-
'
|
|
1
|
+
require('./Operations-Cxn7C-GC.cjs');
|
|
2
|
+
const require_generators = require('./generators-XXsaqEtA.cjs');
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
Object.defineProperty(exports, "clientGenerator", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function () { return chunkSDEXSATF_cjs.clientGenerator; }
|
|
11
|
-
});
|
|
12
|
-
Object.defineProperty(exports, "groupedClientGenerator", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () { return chunkSDEXSATF_cjs.groupedClientGenerator; }
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "operationsGenerator", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function () { return chunkSDEXSATF_cjs.operationsGenerator; }
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=generators.cjs.map
|
|
21
|
-
//# sourceMappingURL=generators.cjs.map
|
|
4
|
+
exports.clientGenerator = require_generators.clientGenerator;
|
|
5
|
+
exports.groupedClientGenerator = require_generators.groupedClientGenerator;
|
|
6
|
+
exports.operationsGenerator = require_generators.operationsGenerator;
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
declare const groupedClientGenerator:
|
|
11
|
-
|
|
1
|
+
import { Generator, PluginClient } from "./types-Cpfa5PKO.cjs";
|
|
2
|
+
|
|
3
|
+
//#region src/generators/clientGenerator.d.ts
|
|
4
|
+
declare const clientGenerator: Generator<PluginClient>;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/generators/operationsGenerator.d.ts
|
|
7
|
+
declare const operationsGenerator: Generator<PluginClient>;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/generators/groupedClientGenerator.d.ts
|
|
10
|
+
declare const groupedClientGenerator: Generator<PluginClient>;
|
|
11
|
+
//#endregion
|
|
12
12
|
export { clientGenerator, groupedClientGenerator, operationsGenerator };
|
|
13
|
+
//# sourceMappingURL=generators.d.cts.map
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
declare const groupedClientGenerator:
|
|
11
|
-
|
|
1
|
+
import { Generator, PluginClient } from "./types-CdM4kNiz.js";
|
|
2
|
+
|
|
3
|
+
//#region src/generators/clientGenerator.d.ts
|
|
4
|
+
declare const clientGenerator: Generator<PluginClient>;
|
|
5
|
+
//#endregion
|
|
6
|
+
//#region src/generators/operationsGenerator.d.ts
|
|
7
|
+
declare const operationsGenerator: Generator<PluginClient>;
|
|
8
|
+
//#endregion
|
|
9
|
+
//#region src/generators/groupedClientGenerator.d.ts
|
|
10
|
+
declare const groupedClientGenerator: Generator<PluginClient>;
|
|
11
|
+
//#endregion
|
|
12
12
|
export { clientGenerator, groupedClientGenerator, operationsGenerator };
|
|
13
|
+
//# sourceMappingURL=generators.d.ts.map
|
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import "./Operations-tGJwS9Oj.js";
|
|
2
|
+
import { clientGenerator, groupedClientGenerator, operationsGenerator } from "./generators-BQnLTqYl.js";
|
|
3
|
+
|
|
4
|
+
export { clientGenerator, groupedClientGenerator, operationsGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,124 +1,95 @@
|
|
|
1
|
-
|
|
1
|
+
const require_chunk = require('./chunk-CUT6urMc.cjs');
|
|
2
|
+
require('./Operations-Cxn7C-GC.cjs');
|
|
3
|
+
const require_generators = require('./generators-XXsaqEtA.cjs');
|
|
4
|
+
const node_path = require_chunk.__toESM(require("node:path"));
|
|
5
|
+
const __kubb_core = require_chunk.__toESM(require("@kubb/core"));
|
|
6
|
+
const __kubb_core_transformers = require_chunk.__toESM(require("@kubb/core/transformers"));
|
|
7
|
+
const __kubb_plugin_oas = require_chunk.__toESM(require("@kubb/plugin-oas"));
|
|
8
|
+
const __kubb_plugin_zod = require_chunk.__toESM(require("@kubb/plugin-zod"));
|
|
2
9
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
async buildStart() {
|
|
84
|
-
const [swaggerPlugin] = core.PluginManager.getDependedPlugins(this.plugins, [pluginOas.pluginOasName]);
|
|
85
|
-
const oas = await swaggerPlugin.context.getOas();
|
|
86
|
-
const root = path__default.default.resolve(this.config.root, this.config.output.path);
|
|
87
|
-
const mode = core.FileManager.getMode(path__default.default.resolve(root, output.path));
|
|
88
|
-
const baseURL2 = await swaggerPlugin.context.getBaseURL();
|
|
89
|
-
const operationGenerator = new pluginOas.OperationGenerator(
|
|
90
|
-
baseURL2 ? {
|
|
91
|
-
...this.plugin.options,
|
|
92
|
-
baseURL: baseURL2
|
|
93
|
-
} : this.plugin.options,
|
|
94
|
-
{
|
|
95
|
-
oas,
|
|
96
|
-
pluginManager: this.pluginManager,
|
|
97
|
-
plugin: this.plugin,
|
|
98
|
-
contentType,
|
|
99
|
-
exclude,
|
|
100
|
-
include,
|
|
101
|
-
override,
|
|
102
|
-
mode
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
const files = await operationGenerator.build(...generators);
|
|
106
|
-
await this.addFile(...files);
|
|
107
|
-
const barrelFiles = await this.fileManager.getBarrelFiles({
|
|
108
|
-
type: output.barrelType ?? "named",
|
|
109
|
-
root,
|
|
110
|
-
output,
|
|
111
|
-
meta: {
|
|
112
|
-
pluginKey: this.plugin.key
|
|
113
|
-
},
|
|
114
|
-
logger: this.logger
|
|
115
|
-
});
|
|
116
|
-
await this.addFile(...barrelFiles);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
10
|
+
//#region src/plugin.ts
|
|
11
|
+
const pluginClientName = "plugin-client";
|
|
12
|
+
const pluginClient = (0, __kubb_core.createPlugin)((options) => {
|
|
13
|
+
const { output = {
|
|
14
|
+
path: "clients",
|
|
15
|
+
barrelType: "named"
|
|
16
|
+
}, group, urlType = false, exclude = [], include, override = [], transformers = {}, dataReturnType = "data", paramsType = "inline", pathParamsType = paramsType === "object" ? "object" : options.pathParamsType || "inline", operations = false, baseURL, paramsCasing, generators = [
|
|
17
|
+
require_generators.clientGenerator,
|
|
18
|
+
group ? require_generators.groupedClientGenerator : void 0,
|
|
19
|
+
operations ? require_generators.operationsGenerator : void 0
|
|
20
|
+
].filter(Boolean), parser = "client", client = "axios", importPath = client === "fetch" ? "@kubb/plugin-client/clients/fetch" : "@kubb/plugin-client/clients/axios", contentType } = options;
|
|
21
|
+
return {
|
|
22
|
+
name: pluginClientName,
|
|
23
|
+
options: {
|
|
24
|
+
output,
|
|
25
|
+
group,
|
|
26
|
+
parser,
|
|
27
|
+
dataReturnType,
|
|
28
|
+
importPath,
|
|
29
|
+
paramsType,
|
|
30
|
+
paramsCasing,
|
|
31
|
+
pathParamsType,
|
|
32
|
+
baseURL,
|
|
33
|
+
urlType
|
|
34
|
+
},
|
|
35
|
+
pre: [__kubb_plugin_oas.pluginOasName, parser === "zod" ? __kubb_plugin_zod.pluginZodName : void 0].filter(Boolean),
|
|
36
|
+
resolvePath(baseName, pathMode, options$1) {
|
|
37
|
+
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
38
|
+
const mode = pathMode ?? __kubb_core.FileManager.getMode(node_path.default.resolve(root, output.path));
|
|
39
|
+
if (mode === "single")
|
|
40
|
+
/**
|
|
41
|
+
* when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
|
|
42
|
+
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
43
|
+
*/
|
|
44
|
+
return node_path.default.resolve(root, output.path);
|
|
45
|
+
if (group && (options$1?.group?.path || options$1?.group?.tag)) {
|
|
46
|
+
const groupName = group?.name ? group.name : (ctx) => {
|
|
47
|
+
if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
48
|
+
return `${(0, __kubb_core_transformers.camelCase)(ctx.group)}Controller`;
|
|
49
|
+
};
|
|
50
|
+
return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options$1.group.path : options$1.group.tag }), baseName);
|
|
51
|
+
}
|
|
52
|
+
return node_path.default.resolve(root, output.path, baseName);
|
|
53
|
+
},
|
|
54
|
+
resolveName(name, type) {
|
|
55
|
+
const resolvedName = (0, __kubb_core_transformers.camelCase)(name, { isFile: type === "file" });
|
|
56
|
+
if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
|
|
57
|
+
return resolvedName;
|
|
58
|
+
},
|
|
59
|
+
async buildStart() {
|
|
60
|
+
const [swaggerPlugin] = __kubb_core.PluginManager.getDependedPlugins(this.plugins, [__kubb_plugin_oas.pluginOasName]);
|
|
61
|
+
const oas = await swaggerPlugin.context.getOas();
|
|
62
|
+
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
63
|
+
const mode = __kubb_core.FileManager.getMode(node_path.default.resolve(root, output.path));
|
|
64
|
+
const baseURL$1 = await swaggerPlugin.context.getBaseURL();
|
|
65
|
+
const operationGenerator = new __kubb_plugin_oas.OperationGenerator(baseURL$1 ? {
|
|
66
|
+
...this.plugin.options,
|
|
67
|
+
baseURL: baseURL$1
|
|
68
|
+
} : this.plugin.options, {
|
|
69
|
+
oas,
|
|
70
|
+
pluginManager: this.pluginManager,
|
|
71
|
+
plugin: this.plugin,
|
|
72
|
+
contentType,
|
|
73
|
+
exclude,
|
|
74
|
+
include,
|
|
75
|
+
override,
|
|
76
|
+
mode
|
|
77
|
+
});
|
|
78
|
+
const files = await operationGenerator.build(...generators);
|
|
79
|
+
await this.addFile(...files);
|
|
80
|
+
const barrelFiles = await this.fileManager.getBarrelFiles({
|
|
81
|
+
type: output.barrelType ?? "named",
|
|
82
|
+
root,
|
|
83
|
+
output,
|
|
84
|
+
meta: { pluginKey: this.plugin.key },
|
|
85
|
+
logger: this.logger
|
|
86
|
+
});
|
|
87
|
+
await this.addFile(...barrelFiles);
|
|
88
|
+
}
|
|
89
|
+
};
|
|
119
90
|
});
|
|
120
91
|
|
|
92
|
+
//#endregion
|
|
121
93
|
exports.pluginClient = pluginClient;
|
|
122
94
|
exports.pluginClientName = pluginClientName;
|
|
123
|
-
//# sourceMappingURL=index.cjs.map
|
|
124
95
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["clientGenerator","groupedClientGenerator","operationsGenerator","pluginOasName","pluginZodName","options","path","FileManager","groupName: Group['name']","PluginManager","baseURL","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\n\nimport { FileManager, type Group, PluginManager, createPlugin } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\n\nimport type { Plugin } from '@kubb/core'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { operationsGenerator } from './generators'\nimport { clientGenerator } from './generators/clientGenerator.tsx'\nimport { groupedClientGenerator } from './generators/groupedClientGenerator.tsx'\nimport type { PluginClient } from './types.ts'\n\nexport const pluginClientName = 'plugin-client' satisfies PluginClient['name']\n\nexport const pluginClient = createPlugin<PluginClient>((options) => {\n const {\n output = { path: 'clients', barrelType: 'named' },\n group,\n urlType = false,\n exclude = [],\n include,\n override = [],\n transformers = {},\n dataReturnType = 'data',\n paramsType = 'inline',\n pathParamsType = paramsType === 'object' ? 'object' : options.pathParamsType || 'inline',\n operations = false,\n baseURL,\n paramsCasing,\n generators = [clientGenerator, group ? groupedClientGenerator : undefined, operations ? operationsGenerator : undefined].filter(Boolean),\n parser = 'client',\n client = 'axios',\n importPath = client === 'fetch' ? '@kubb/plugin-client/clients/fetch' : '@kubb/plugin-client/clients/axios',\n contentType,\n } = options\n\n return {\n name: pluginClientName,\n options: {\n output,\n group,\n parser,\n dataReturnType,\n importPath,\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 ?? FileManager.getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = FileManager.getMode(path.resolve(root, output.path))\n const baseURL = await swaggerPlugin.context.getBaseURL()\n\n const operationGenerator = new OperationGenerator(\n baseURL\n ? {\n ...this.plugin.options,\n baseURL,\n }\n : this.plugin.options,\n {\n oas,\n pluginManager: this.pluginManager,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n },\n )\n\n const files = await operationGenerator.build(...generators)\n\n await this.addFile(...files)\n\n const barrelFiles = await this.fileManager.getBarrelFiles({\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAcA,MAAa,mBAAmB;AAEhC,MAAa,6CAA0C,CAAC,YAAY;CAClE,MAAM,EACJ,SAAS;EAAE,MAAM;EAAW,YAAY;CAAS,GACjD,OACA,UAAU,OACV,UAAU,CAAE,GACZ,SACA,WAAW,CAAE,GACb,eAAe,CAAE,GACjB,iBAAiB,QACjB,aAAa,UACb,iBAAiB,eAAe,WAAW,WAAW,QAAQ,kBAAkB,UAChF,aAAa,OACb,SACA,cACA,aAAa;EAACA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ACN,+BAAc,EAAC;GAE7I,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAOG,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAOC,wBAAY,QAAQD,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GACjE,MAAMI,YAAU,MAAM,cAAc,QAAQ,YAAY;GAExD,MAAM,qBAAqB,IAAIC,qCAC7BD,YACI;IACE,GAAG,KAAK,OAAO;IACf;GACD,IACD,KAAK,OAAO,SAChB;IACE;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;GACD;GAGH,MAAM,QAAQ,MAAM,mBAAmB,MAAM,GAAG,WAAW;GAE3D,MAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,KAAK,YAAY,eAAe;IACxD,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,IACxB;IACD,QAAQ,KAAK;GACd,EAAC;GAEF,MAAM,KAAK,QAAQ,GAAG,YAAY;EACnC;CACF;AACF,EAAC"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { O as Options, P as PluginClient } from './types-DFo3xInC.cjs';
|
|
3
|
-
import '@kubb/oas';
|
|
4
|
-
import '@kubb/plugin-oas';
|
|
1
|
+
import { Options, PluginClient, UserPluginWithLifeCycle } from "./types-Cpfa5PKO.cjs";
|
|
5
2
|
|
|
3
|
+
//#region src/plugin.d.ts
|
|
6
4
|
declare const pluginClientName = "plugin-client";
|
|
7
|
-
declare const pluginClient: (options?: Options | undefined) =>
|
|
8
|
-
|
|
9
|
-
export { PluginClient, pluginClient, pluginClientName };
|
|
5
|
+
declare const pluginClient: (options?: Options | undefined) => UserPluginWithLifeCycle<PluginClient>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type PluginClient, pluginClient, pluginClientName };
|
|
8
|
+
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { O as Options, P as PluginClient } from './types-DFo3xInC.js';
|
|
3
|
-
import '@kubb/oas';
|
|
4
|
-
import '@kubb/plugin-oas';
|
|
1
|
+
import { Options, PluginClient, UserPluginWithLifeCycle } from "./types-CdM4kNiz.js";
|
|
5
2
|
|
|
3
|
+
//#region src/plugin.d.ts
|
|
6
4
|
declare const pluginClientName = "plugin-client";
|
|
7
|
-
declare const pluginClient: (options?: Options | undefined) =>
|
|
8
|
-
|
|
9
|
-
export { PluginClient, pluginClient, pluginClientName };
|
|
5
|
+
declare const pluginClient: (options?: Options | undefined) => UserPluginWithLifeCycle<PluginClient>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type PluginClient, pluginClient, pluginClientName };
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|