@kubb/plugin-client 5.0.0-beta.42 → 5.0.0-beta.64
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/clients/axios.cjs.map +1 -1
- package/dist/clients/axios.js.map +1 -1
- package/dist/clients/fetch.cjs.map +1 -1
- package/dist/clients/fetch.js.map +1 -1
- package/dist/index.cjs +439 -383
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +60 -25
- package/dist/index.js +435 -383
- package/dist/index.js.map +1 -1
- package/dist/templates/clients/axios.source.cjs.map +1 -1
- package/dist/templates/clients/axios.source.js.map +1 -1
- package/dist/templates/clients/fetch.source.cjs.map +1 -1
- package/dist/templates/clients/fetch.source.js.map +1 -1
- package/dist/templates/config.source.cjs.map +1 -1
- package/dist/templates/config.source.js.map +1 -1
- package/package.json +10 -18
- package/extension.yaml +0 -1267
- package/src/clients/axios.ts +0 -113
- package/src/clients/fetch.ts +0 -201
- package/src/components/ClassClient.tsx +0 -137
- package/src/components/Client.tsx +0 -273
- package/src/components/Operations.tsx +0 -29
- package/src/components/StaticClassClient.tsx +0 -129
- package/src/components/Url.tsx +0 -91
- package/src/components/WrapperClient.tsx +0 -33
- package/src/functionParams.ts +0 -118
- package/src/generators/classClientGenerator.tsx +0 -253
- package/src/generators/clientGenerator.tsx +0 -127
- package/src/generators/groupedClientGenerator.tsx +0 -82
- package/src/generators/operationsGenerator.tsx +0 -34
- package/src/generators/staticClassClientGenerator.tsx +0 -232
- package/src/index.ts +0 -9
- package/src/plugin.ts +0 -160
- package/src/resolvers/resolverClient.ts +0 -45
- package/src/templates/clients/axios.source.ts +0 -4
- package/src/templates/clients/fetch.source.ts +0 -4
- package/src/templates/config.source.ts +0 -4
- package/src/types.ts +0 -268
- package/src/utils.ts +0 -159
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk-C0LytTxp.js";
|
|
2
|
-
import { Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
|
|
2
|
+
import { Exclude, Generator, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
|
|
3
3
|
import { ResolverTs } from "@kubb/plugin-ts";
|
|
4
4
|
import { ResolverZod } from "@kubb/plugin-zod";
|
|
5
5
|
import { KubbReactNode } from "@kubb/renderer-jsx/types";
|
|
@@ -26,7 +26,12 @@ type ResolverClient = Resolver & {
|
|
|
26
26
|
*/
|
|
27
27
|
resolveClassName(this: ResolverClient, name: string): string;
|
|
28
28
|
/**
|
|
29
|
-
* Resolves the generated class name for tag-based client groups.
|
|
29
|
+
* Resolves the generated class name for tag-based client groups. The default
|
|
30
|
+
* appends a `Client` suffix (tag `pet` becomes `PetClient`) so the class never
|
|
31
|
+
* collides with the schema model of the same name in the barrel.
|
|
32
|
+
*
|
|
33
|
+
* @example Resolving tag-group class names
|
|
34
|
+
* `resolver.resolveGroupName('pet') // -> 'PetClient'`
|
|
30
35
|
*/
|
|
31
36
|
resolveGroupName(this: ResolverClient, name: string): string;
|
|
32
37
|
/**
|
|
@@ -110,17 +115,13 @@ type ParamsTypeOptions = {
|
|
|
110
115
|
*/
|
|
111
116
|
pathParamsType?: 'object' | 'inline';
|
|
112
117
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Split generated files into subfolders based on the operation's tag.
|
|
122
|
-
*/
|
|
123
|
-
group?: Group;
|
|
118
|
+
/**
|
|
119
|
+
* Where the generated client files are written and how they are exported, plus the optional
|
|
120
|
+
* `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
|
|
121
|
+
*
|
|
122
|
+
* @default { path: 'clients', barrel: { type: 'named' } }
|
|
123
|
+
*/
|
|
124
|
+
type Options = OutputOptions & {
|
|
124
125
|
/**
|
|
125
126
|
* Skip operations matching at least one entry in the list.
|
|
126
127
|
*/
|
|
@@ -155,7 +156,9 @@ type Options = {
|
|
|
155
156
|
/**
|
|
156
157
|
* Shape of the value returned by each generated client function.
|
|
157
158
|
* - `'data'` — only the response body.
|
|
158
|
-
* - `'full'` — the full response
|
|
159
|
+
* - `'full'` — the full response as a discriminated union keyed by HTTP status code.
|
|
160
|
+
* Each member is `{ status: N; data: StatusNType; statusText: string }`,
|
|
161
|
+
* so narrowing on `res.status` also narrows `res.data` to the matching response type.
|
|
159
162
|
*
|
|
160
163
|
* @default 'data'
|
|
161
164
|
*/
|
|
@@ -168,14 +171,22 @@ type Options = {
|
|
|
168
171
|
*/
|
|
169
172
|
paramsCasing?: 'camelcase';
|
|
170
173
|
/**
|
|
171
|
-
* Validator applied to response bodies
|
|
172
|
-
* - `false` (default)
|
|
173
|
-
*
|
|
174
|
-
* - `'zod'
|
|
174
|
+
* Validator applied to request and response bodies using schemas from `@kubb/plugin-zod`.
|
|
175
|
+
* - `false` (default): no validation. The response is returned as-is.
|
|
176
|
+
* - `'zod'`: validates response bodies only (backward-compatible shorthand).
|
|
177
|
+
* - `{ request?: 'zod'; response?: 'zod' }`: opt in per direction. `request` validates the
|
|
178
|
+
* request body and query parameters before the call. `response` validates the response body.
|
|
175
179
|
*
|
|
176
180
|
* @default false
|
|
181
|
+
* @example Response only (shorthand)
|
|
182
|
+
* `parser: 'zod'`
|
|
183
|
+
* @example Both directions
|
|
184
|
+
* `parser: { request: 'zod', response: 'zod' }`
|
|
177
185
|
*/
|
|
178
|
-
parser?: false | 'zod'
|
|
186
|
+
parser?: false | 'zod' | {
|
|
187
|
+
request?: 'zod';
|
|
188
|
+
response?: 'zod';
|
|
189
|
+
};
|
|
179
190
|
/**
|
|
180
191
|
* Shape of the generated client.
|
|
181
192
|
* - `'function'` — one standalone async function per operation.
|
|
@@ -204,8 +215,8 @@ type Options = {
|
|
|
204
215
|
* sdk: { className: 'PetStoreSDK' },
|
|
205
216
|
* })
|
|
206
217
|
* // class PetStoreSDK {
|
|
207
|
-
* // readonly
|
|
208
|
-
* // readonly
|
|
218
|
+
* // readonly petClient: PetClient
|
|
219
|
+
* // readonly storeClient: StoreClient
|
|
209
220
|
* // constructor(config = {}) { ... }
|
|
210
221
|
* // }
|
|
211
222
|
* ```
|
|
@@ -223,10 +234,10 @@ type Options = {
|
|
|
223
234
|
*/
|
|
224
235
|
resolver?: Partial<ResolverClient> & ThisType<ResolverClient>;
|
|
225
236
|
/**
|
|
226
|
-
*
|
|
227
|
-
* Return `null` or `undefined` to leave the node unchanged.
|
|
237
|
+
* Macros applied to each operation node before code is printed.
|
|
238
|
+
* Return `null` or `undefined` from a callback to leave the node unchanged.
|
|
228
239
|
*/
|
|
229
|
-
|
|
240
|
+
macros?: Array<ast.Macro>;
|
|
230
241
|
/**
|
|
231
242
|
* Custom generators that run alongside the built-in client generators.
|
|
232
243
|
*/
|
|
@@ -387,10 +398,34 @@ declare const pluginClient: (options?: Options | undefined) => import("@kubb/cor
|
|
|
387
398
|
*
|
|
388
399
|
* resolverClient.default('list pets', 'function') // 'listPets'
|
|
389
400
|
* resolverClient.resolveClassName('pet') // 'Pet'
|
|
401
|
+
* resolverClient.resolveGroupName('pet') // 'PetClient'
|
|
390
402
|
* resolverClient.resolveUrlName(operationNode) // 'getShowPetByIdUrl'
|
|
391
403
|
* ```
|
|
392
404
|
*/
|
|
393
405
|
declare const resolverClient: ResolverClient;
|
|
394
406
|
//#endregion
|
|
395
|
-
|
|
407
|
+
//#region src/utils.d.ts
|
|
408
|
+
type ParserOption = PluginClient['resolvedOptions']['parser'];
|
|
409
|
+
/**
|
|
410
|
+
* Returns `true` when any direction of the parser uses Zod (used for dependency checks).
|
|
411
|
+
*/
|
|
412
|
+
declare function isParserEnabled(parser: ParserOption | undefined | false): boolean;
|
|
413
|
+
/**
|
|
414
|
+
* Returns `'zod'` when request body parsing is enabled, `null` otherwise.
|
|
415
|
+
* The string shorthand `'zod'` also enables request body parsing (existing behavior).
|
|
416
|
+
*/
|
|
417
|
+
declare function resolveRequestParser(parser: ParserOption | undefined | false): 'zod' | null;
|
|
418
|
+
/**
|
|
419
|
+
* Returns `'zod'` when query-parameters parsing is enabled, `null` otherwise.
|
|
420
|
+
* Only the object form `{ request: 'zod' }` enables query-params parsing.
|
|
421
|
+
* The string shorthand `'zod'` does not, preserving its existing behavior.
|
|
422
|
+
*/
|
|
423
|
+
declare function resolveQueryParamsParser(parser: ParserOption | undefined | false): 'zod' | null;
|
|
424
|
+
/**
|
|
425
|
+
* Returns `'zod'` when response-direction parsing is enabled, `null` otherwise.
|
|
426
|
+
* `parser: 'zod'` (string shorthand) maps to response parsing and returns `'zod'`.
|
|
427
|
+
*/
|
|
428
|
+
declare function resolveResponseParser(parser: ParserOption | undefined | false): 'zod' | null;
|
|
429
|
+
//#endregion
|
|
430
|
+
export { Client, type ClientImportPath, type PluginClient, type ResolverClient, classClientGenerator, clientGenerator, pluginClient as default, pluginClient, groupedClientGenerator, isParserEnabled, operationsGenerator, pluginClientName, resolveQueryParamsParser, resolveRequestParser, resolveResponseParser, resolverClient, staticClassClientGenerator };
|
|
396
431
|
//# sourceMappingURL=index.d.ts.map
|