@kubb/plugin-ts 5.0.0-alpha.22 → 5.0.0-alpha.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/index.cjs +1680 -49
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.ts +529 -4
  4. package/dist/index.js +1653 -52
  5. package/dist/index.js.map +1 -1
  6. package/package.json +3 -42
  7. package/src/components/Enum.tsx +2 -7
  8. package/src/components/Type.tsx +11 -5
  9. package/src/generators/typeGenerator.tsx +36 -24
  10. package/src/generators/typeGeneratorLegacy.tsx +28 -38
  11. package/src/index.ts +13 -1
  12. package/src/plugin.ts +42 -23
  13. package/src/presets.ts +16 -34
  14. package/src/printers/functionPrinter.ts +194 -0
  15. package/src/printers/printerTs.ts +23 -7
  16. package/src/resolvers/resolverTs.ts +10 -47
  17. package/src/resolvers/resolverTsLegacy.ts +4 -31
  18. package/src/types.ts +169 -254
  19. package/src/utils.ts +103 -0
  20. package/dist/Type-Bf8raoQX.cjs +0 -124
  21. package/dist/Type-Bf8raoQX.cjs.map +0 -1
  22. package/dist/Type-BpXxT4l_.js +0 -113
  23. package/dist/Type-BpXxT4l_.js.map +0 -1
  24. package/dist/builderTs-COUg3xtQ.cjs +0 -135
  25. package/dist/builderTs-COUg3xtQ.cjs.map +0 -1
  26. package/dist/builderTs-DPpkJKd1.js +0 -131
  27. package/dist/builderTs-DPpkJKd1.js.map +0 -1
  28. package/dist/builders.cjs +0 -3
  29. package/dist/builders.d.ts +0 -23
  30. package/dist/builders.js +0 -2
  31. package/dist/casing-BJHFg-zZ.js +0 -84
  32. package/dist/casing-BJHFg-zZ.js.map +0 -1
  33. package/dist/casing-DHfdqpLi.cjs +0 -107
  34. package/dist/casing-DHfdqpLi.cjs.map +0 -1
  35. package/dist/chunk-ByKO4r7w.cjs +0 -38
  36. package/dist/components.cjs +0 -4
  37. package/dist/components.d.ts +0 -71
  38. package/dist/components.js +0 -2
  39. package/dist/generators-DFDut8o-.js +0 -555
  40. package/dist/generators-DFDut8o-.js.map +0 -1
  41. package/dist/generators-DKd7MYbx.cjs +0 -567
  42. package/dist/generators-DKd7MYbx.cjs.map +0 -1
  43. package/dist/generators.cjs +0 -4
  44. package/dist/generators.d.ts +0 -12
  45. package/dist/generators.js +0 -2
  46. package/dist/printerTs-BcHudagv.cjs +0 -594
  47. package/dist/printerTs-BcHudagv.cjs.map +0 -1
  48. package/dist/printerTs-CMBCOuqd.js +0 -558
  49. package/dist/printerTs-CMBCOuqd.js.map +0 -1
  50. package/dist/printers.cjs +0 -3
  51. package/dist/printers.d.ts +0 -81
  52. package/dist/printers.js +0 -2
  53. package/dist/resolverTsLegacy-CPiqqsO6.js +0 -185
  54. package/dist/resolverTsLegacy-CPiqqsO6.js.map +0 -1
  55. package/dist/resolverTsLegacy-CuR9XbKk.cjs +0 -196
  56. package/dist/resolverTsLegacy-CuR9XbKk.cjs.map +0 -1
  57. package/dist/resolvers.cjs +0 -4
  58. package/dist/resolvers.d.ts +0 -52
  59. package/dist/resolvers.js +0 -2
  60. package/dist/types-CRtcZOCz.d.ts +0 -374
  61. package/src/builders/builderTs.ts +0 -107
  62. package/src/builders/index.ts +0 -1
  63. package/src/components/index.ts +0 -2
  64. package/src/generators/index.ts +0 -2
  65. package/src/printers/index.ts +0 -1
  66. package/src/resolvers/index.ts +0 -2
package/dist/index.d.ts CHANGED
@@ -1,7 +1,360 @@
1
1
  import { t as __name } from "./chunk--u3MIqq1.js";
2
- import { n as Options, r as PluginTs } from "./types-CRtcZOCz.js";
3
- import * as _kubb_core0 from "@kubb/core";
2
+ import ts from "typescript";
3
+ import { OperationParamsResolver } from "@kubb/ast";
4
+ import * as _$_kubb_core0 from "@kubb/core";
5
+ import { CompatibilityPreset, Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, PrinterFactoryOptions, ResolvePathOptions, Resolver, UserGroup } from "@kubb/core";
6
+ import { EnumSchemaNode, FunctionNode, OperationNode, ParameterNode, SchemaNode, StatusCode, Visitor } from "@kubb/ast/types";
7
+ import { FabricReactNode } from "@kubb/react-fabric/types";
4
8
 
9
+ //#region src/types.d.ts
10
+ /**
11
+ * The concrete resolver type for `@kubb/plugin-ts`.
12
+ * Extends the base `Resolver` (which provides `default` and `resolveOptions`) with
13
+ * plugin-specific naming helpers for operations, parameters, responses, and schemas.
14
+ */
15
+ type ResolverTs = Resolver & OperationParamsResolver & {
16
+ /**
17
+ * Resolves the name for a given raw name (equivalent to `default(name, 'function')`).
18
+ * Since TypeScript only emits types, this is the canonical naming method.
19
+ *
20
+ * @example
21
+ * resolver.resolveName('list pets status 200') // → 'ListPetsStatus200'
22
+ */
23
+ resolveName(name: string): string;
24
+ /**
25
+ * Resolves the file/path name for a given identifier using PascalCase.
26
+ *
27
+ * @example
28
+ * resolver.resolvePathName('list pets', 'file') // → 'ListPets'
29
+ */
30
+ resolvePathName(name: string, type?: 'file' | 'function' | 'type' | 'const'): string; /** Resolves the request body type name (required on ResolverTs). */
31
+ resolveDataName(node: OperationNode): string;
32
+ /**
33
+ * Resolves the name for an operation response by status code.
34
+ * Encapsulates the `<operationId> Status <statusCode>` template with PascalCase applied to the result.
35
+ *
36
+ * @example
37
+ * resolver.resolveResponseStatusName(node, 200) // → 'ListPetsStatus200'
38
+ */
39
+ resolveResponseStatusName(node: OperationNode, statusCode: StatusCode): string;
40
+ /**
41
+ * Resolves the name for an operation's request config (`RequestConfig`).
42
+ *
43
+ * @example
44
+ * resolver.resolveRequestConfigName(node) // → 'ListPetsRequestConfig'
45
+ */
46
+ resolveRequestConfigName(node: OperationNode): string;
47
+ /**
48
+ * Resolves the name for the collection of all operation responses (`Responses`).
49
+ *
50
+ * @example
51
+ * resolver.resolveResponsesName(node) // → 'ListPetsResponses'
52
+ */
53
+ resolveResponsesName(node: OperationNode): string;
54
+ /**
55
+ * Resolves the name for the union of all operation responses (`Response`).
56
+ *
57
+ * @example
58
+ * resolver.resolveResponseName(node) // → 'ListPetsResponse'
59
+ */
60
+ resolveResponseName(node: OperationNode): string;
61
+ /**
62
+ * Resolves the TypeScript type alias name for an enum schema's key variant.
63
+ * Appends `enumTypeSuffix` (default `'Key'`) after applying the default naming convention.
64
+ *
65
+ * @example
66
+ * resolver.resolveEnumKeyName(node, 'Key') // → 'PetStatusKey'
67
+ * resolver.resolveEnumKeyName(node, 'Value') // → 'PetStatusValue'
68
+ * resolver.resolveEnumKeyName(node, '') // → 'PetStatus'
69
+ */
70
+ resolveEnumKeyName(node: SchemaNode, enumTypeSuffix: string): string;
71
+ /**
72
+ * Resolves the name for an operation's grouped path parameters type.
73
+ *
74
+ * @example
75
+ * resolver.resolvePathParamsName(node, param) // → 'GetPetByIdPathParams'
76
+ */
77
+ resolvePathParamsName(node: OperationNode, param: ParameterNode): string;
78
+ /**
79
+ * Resolves the name for an operation's grouped query parameters type.
80
+ *
81
+ * @example
82
+ * resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'
83
+ */
84
+ resolveQueryParamsName(node: OperationNode, param: ParameterNode): string;
85
+ /**
86
+ * Resolves the name for an operation's grouped header parameters type.
87
+ *
88
+ * @example
89
+ * resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'
90
+ */
91
+ resolveHeaderParamsName(node: OperationNode, param: ParameterNode): string;
92
+ };
93
+ type EnumKeyCasing = 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none';
94
+ /**
95
+ * Discriminated union that ties `enumTypeSuffix` and `enumKeyCasing` to the enum types that actually use them.
96
+ *
97
+ * - `'asConst'` / `'asPascalConst'` — emit a `const` object; both `enumTypeSuffix` (type-alias suffix) and
98
+ * `enumKeyCasing` (key formatting) are meaningful.
99
+ * - `'enum'` / `'constEnum'` — emit a TypeScript enum; `enumKeyCasing` applies to member names,
100
+ * but there is no separate type alias so `enumTypeSuffix` is not used.
101
+ * - `'literal'` / `'inlineLiteral'` — emit only union literals; keys are discarded entirely,
102
+ * so neither `enumTypeSuffix` nor `enumKeyCasing` have any effect.
103
+ */
104
+ type EnumTypeOptions = {
105
+ /**
106
+ * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
107
+ * - 'asConst' generates const objects with camelCase names and as const assertion.
108
+ * - 'asPascalConst' generates const objects with PascalCase names and as const assertion.
109
+ * @default 'asConst'
110
+ */
111
+ enumType?: 'asConst' | 'asPascalConst';
112
+ /**
113
+ * Suffix appended to the generated type alias name.
114
+ *
115
+ * Only affects the type alias — the const object name is unchanged.
116
+ *
117
+ * @default 'Key'
118
+ * @example enumTypeSuffix: 'Value' → `export type PetStatusValue = …`
119
+ */
120
+ enumTypeSuffix?: string;
121
+ /**
122
+ * Choose the casing for enum key names.
123
+ * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
124
+ * - 'snakeCase' generates keys in snake_case format.
125
+ * - 'pascalCase' generates keys in PascalCase format.
126
+ * - 'camelCase' generates keys in camelCase format.
127
+ * - 'none' uses the enum value as-is without transformation.
128
+ * @default 'none'
129
+ */
130
+ enumKeyCasing?: EnumKeyCasing;
131
+ } | {
132
+ /**
133
+ * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
134
+ * - 'enum' generates TypeScript enum declarations.
135
+ * - 'constEnum' generates TypeScript const enum declarations.
136
+ * @default 'asConst'
137
+ */
138
+ enumType?: 'enum' | 'constEnum';
139
+ /**
140
+ * `enumTypeSuffix` has no effect for this `enumType`.
141
+ * It is only used when `enumType` is `'asConst'` or `'asPascalConst'`.
142
+ */
143
+ enumTypeSuffix?: never;
144
+ /**
145
+ * Choose the casing for enum key names.
146
+ * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
147
+ * - 'snakeCase' generates keys in snake_case format.
148
+ * - 'pascalCase' generates keys in PascalCase format.
149
+ * - 'camelCase' generates keys in camelCase format.
150
+ * - 'none' uses the enum value as-is without transformation.
151
+ * @default 'none'
152
+ */
153
+ enumKeyCasing?: EnumKeyCasing;
154
+ } | {
155
+ /**
156
+ * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
157
+ * - 'literal' generates literal union types.
158
+ * - 'inlineLiteral' inlines enum values directly into the type (default in v5).
159
+ * @default 'asConst'
160
+ * @note In Kubb v5, 'inlineLiteral' becomes the default.
161
+ */
162
+ enumType?: 'literal' | 'inlineLiteral';
163
+ /**
164
+ * `enumTypeSuffix` has no effect for this `enumType`.
165
+ * It is only used when `enumType` is `'asConst'` or `'asPascalConst'`.
166
+ */
167
+ enumTypeSuffix?: never;
168
+ /**
169
+ * `enumKeyCasing` has no effect for this `enumType`.
170
+ * Literal and inlineLiteral modes emit only values — keys are discarded entirely.
171
+ */
172
+ enumKeyCasing?: never;
173
+ };
174
+ type Options = {
175
+ /**
176
+ * Specify the export location for the files and define the behavior of the output
177
+ * @default { path: 'types', barrelType: 'named' }
178
+ */
179
+ output?: Output;
180
+ /**
181
+ * Define which contentType should be used.
182
+ * By default, uses the first valid JSON media type.
183
+ */
184
+ contentType?: 'application/json' | (string & {});
185
+ /**
186
+ * Group the clients based on the provided name.
187
+ */
188
+ group?: UserGroup;
189
+ /**
190
+ * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
191
+ */
192
+ exclude?: Array<Exclude>;
193
+ /**
194
+ * Array containing include parameters to include tags/operations/methods/paths.
195
+ */
196
+ include?: Array<Include>;
197
+ /**
198
+ * Array containing override parameters to override `options` based on tags/operations/methods/paths.
199
+ */
200
+ override?: Array<Override<ResolvedOptions>>;
201
+ /**
202
+ * Switch between type or interface for creating TypeScript types.
203
+ * - 'type' generates type alias declarations.
204
+ * - 'interface' generates interface declarations.
205
+ * @default 'type'
206
+ */
207
+ syntaxType?: 'type' | 'interface';
208
+ /**
209
+ * Choose what to use as mode for an optional value.
210
+ * - 'questionToken' marks the property as optional with ? (e.g., type?: string).
211
+ * - 'undefined' adds undefined to the type union (e.g., type: string | undefined).
212
+ * - 'questionTokenAndUndefined' combines both approaches (e.g., type?: string | undefined).
213
+ * @default 'questionToken'
214
+ */
215
+ optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
216
+ /**
217
+ * Choose between Array<string> or string[] for array types.
218
+ * - 'generic' generates Array<Type> syntax.
219
+ * - 'array' generates Type[] syntax.
220
+ * @default 'array'
221
+ */
222
+ arrayType?: 'generic' | 'array';
223
+ /**
224
+ * How to style your params, by default no casing is applied
225
+ * - 'camelcase' uses camelCase for pathParams, queryParams and headerParams property names
226
+ * @default undefined
227
+ * @note response types (data/body) are NOT affected by this option
228
+ */
229
+ paramsCasing?: 'camelcase';
230
+ /**
231
+ * Define some generators next to the ts generators
232
+ */
233
+ generators?: Array<Generator<PluginTs>>;
234
+ /**
235
+ * Apply a compatibility naming preset.
236
+ * Use `kubbV4` for strict v4 type-generation compatibility.
237
+ * You can further customize naming with `resolvers`.
238
+ * @default 'default'
239
+ */
240
+ compatibilityPreset?: CompatibilityPreset;
241
+ /**
242
+ * Array of named resolvers that control naming conventions.
243
+ * Later entries override earlier ones (last wins).
244
+ * Built-in: `resolverTs` (default), `resolverTsLegacy`.
245
+ * @default [resolverTs]
246
+ */
247
+ resolvers?: Array<ResolverTs>;
248
+ /**
249
+ * Array of AST visitors applied to each SchemaNode/OperationNode before printing.
250
+ * Uses `transform()` from `@kubb/ast` — visitors can modify, replace, or annotate nodes.
251
+ *
252
+ * @example Remove writeOnly properties from response types
253
+ * ```ts
254
+ * transformers: [{
255
+ * property(node) {
256
+ * if (node.schema.writeOnly) return undefined
257
+ * }
258
+ * }]
259
+ * ```
260
+ *
261
+ * @example Force all dates to plain strings
262
+ * ```ts
263
+ * transformers: [{
264
+ * schema(node) {
265
+ * if (node.type === 'date') return { ...node, type: 'string' }
266
+ * }
267
+ * }]
268
+ * ```
269
+ */
270
+ transformers?: Array<Visitor>;
271
+ } & EnumTypeOptions;
272
+ type ResolvedOptions = {
273
+ output: Output;
274
+ group: Group | undefined;
275
+ enumType: NonNullable<Options['enumType']>;
276
+ enumTypeSuffix: NonNullable<Options['enumTypeSuffix']>;
277
+ enumKeyCasing: EnumKeyCasing;
278
+ optionalType: NonNullable<Options['optionalType']>;
279
+ arrayType: NonNullable<Options['arrayType']>;
280
+ syntaxType: NonNullable<Options['syntaxType']>;
281
+ paramsCasing: Options['paramsCasing'];
282
+ transformers: Array<Visitor>;
283
+ };
284
+ type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, never, ResolvePathOptions, ResolverTs>;
285
+ //#endregion
286
+ //#region src/components/Enum.d.ts
287
+ type Props$1 = {
288
+ node: EnumSchemaNode;
289
+ enumType: PluginTs['resolvedOptions']['enumType'];
290
+ enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
291
+ enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
292
+ resolver: ResolverTs;
293
+ };
294
+ /**
295
+ * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.
296
+ *
297
+ * The raw `node.name` may be a YAML key such as `"enumNames.Type"` which is not a
298
+ * valid TypeScript identifier. The resolver normalizes it; for inline enum
299
+ * properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.
300
+ */
301
+ /**
302
+ * Renders the enum declaration(s) for a single named `EnumSchemaNode`.
303
+ *
304
+ * Depending on `enumType` this may emit:
305
+ * - A runtime object (`asConst` / `asPascalConst`) plus a `typeof` type alias
306
+ * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`)
307
+ * - A union literal type alias (`literal`)
308
+ *
309
+ * The emitted `File.Source` nodes carry the resolved names so that the barrel
310
+ * index picks up the correct export identifiers.
311
+ */
312
+ declare function Enum({
313
+ node,
314
+ enumType,
315
+ enumTypeSuffix,
316
+ enumKeyCasing,
317
+ resolver
318
+ }: Props$1): FabricReactNode;
319
+ //#endregion
320
+ //#region src/components/Type.d.ts
321
+ type Props = {
322
+ name: string;
323
+ node: SchemaNode;
324
+ optionalType: PluginTs['resolvedOptions']['optionalType'];
325
+ arrayType: PluginTs['resolvedOptions']['arrayType'];
326
+ enumType: PluginTs['resolvedOptions']['enumType'];
327
+ enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
328
+ enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
329
+ syntaxType: PluginTs['resolvedOptions']['syntaxType'];
330
+ resolver: PluginTs['resolver'];
331
+ description?: string;
332
+ keysToOmit?: string[];
333
+ /**
334
+ * Names of top-level schemas that are enums.
335
+ * Used so the printer's `ref` handler can use the suffixed type name (e.g. `StatusKey`)
336
+ * instead of the plain PascalCase name (e.g. `Status`) when resolving `$ref` enum targets.
337
+ */
338
+ enumSchemaNames?: Set<string>;
339
+ };
340
+ declare function Type({
341
+ name,
342
+ node,
343
+ keysToOmit,
344
+ optionalType,
345
+ arrayType,
346
+ syntaxType,
347
+ enumType,
348
+ enumTypeSuffix,
349
+ enumKeyCasing,
350
+ description,
351
+ resolver,
352
+ enumSchemaNames
353
+ }: Props): FabricReactNode;
354
+ //#endregion
355
+ //#region src/generators/typeGenerator.d.ts
356
+ declare const typeGenerator: _$_kubb_core0.ReactGeneratorV2<PluginTs>;
357
+ //#endregion
5
358
  //#region src/plugin.d.ts
6
359
  /**
7
360
  * Canonical plugin name for `@kubb/plugin-ts`, used to identify the plugin in driver lookups and warnings.
@@ -23,7 +376,179 @@ declare const pluginTsName = "plugin-ts";
23
376
  * })
24
377
  * ```
25
378
  */
26
- declare const pluginTs: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginTs>;
379
+ declare const pluginTs: (options?: Options | undefined) => _$_kubb_core0.UserPluginWithLifeCycle<PluginTs>;
380
+ //#endregion
381
+ //#region src/printers/functionPrinter.d.ts
382
+ type FunctionPrinterOptions = {
383
+ /**
384
+ * Rendering modes supported by `functionPrinter`.
385
+ *
386
+ * | Mode | Output example | Use case |
387
+ * |---------------|---------------------------------------------|---------------------------------|
388
+ * | `declaration` | `id: string, config: Config = {}` | Function parameter declaration |
389
+ * | `call` | `id, { method, url }` | Function call arguments |
390
+ * | `keys` | `{ id, config }` | Key names only (destructuring) |
391
+ * | `values` | `{ id: id, config: config }` | Key/value object entries |
392
+ */
393
+ mode: 'declaration' | 'call' | 'keys' | 'values';
394
+ /**
395
+ * Optional transformation applied to every parameter name before printing.
396
+ */
397
+ transformName?: (name: string) => string;
398
+ /**
399
+ * Optional transformation applied to every type string before printing.
400
+ */
401
+ transformType?: (type: string) => string;
402
+ };
403
+ /**
404
+ * Default function-signature printer.
405
+ * Covers the four standard output modes used across Kubb plugins.
406
+ *
407
+ * @example
408
+ * ```ts
409
+ * const printer = functionPrinter({ mode: 'declaration' })
410
+ *
411
+ * const sig = createFunctionParameters({
412
+ * params: [
413
+ * createFunctionParameter({ name: 'petId', type: 'string', optional: false }),
414
+ * createFunctionParameter({ name: 'config', type: 'Config', optional: false, default: '{}' }),
415
+ * ],
416
+ * })
417
+ *
418
+ * printer.print(sig) // → "petId: string, config: Config = {}"
419
+ * ```
420
+ */
421
+ declare const functionPrinter: (options?: FunctionPrinterOptions | undefined) => {
422
+ name: "functionParameters";
423
+ options: FunctionPrinterOptions;
424
+ transform: (node: FunctionNode) => string | null | undefined;
425
+ print: (node: FunctionNode) => string | null | undefined;
426
+ };
427
+ //#endregion
428
+ //#region src/printers/printerTs.d.ts
429
+ type TsOptions = {
430
+ /**
431
+ * @default `'questionToken'`
432
+ */
433
+ optionalType: PluginTs['resolvedOptions']['optionalType'];
434
+ /**
435
+ * @default `'array'`
436
+ */
437
+ arrayType: PluginTs['resolvedOptions']['arrayType'];
438
+ /**
439
+ * @default `'inlineLiteral'`
440
+ */
441
+ enumType: PluginTs['resolvedOptions']['enumType'];
442
+ /**
443
+ * Suffix appended to the generated type alias name when `enumType` is `asConst` or `asPascalConst`.
444
+ *
445
+ * @default `'Key'`
446
+ */
447
+ enumTypeSuffix?: PluginTs['resolvedOptions']['enumTypeSuffix'];
448
+ /**
449
+ * Controls whether a `type` alias or `interface` declaration is emitted.
450
+ * @default `'type'`
451
+ */
452
+ syntaxType?: PluginTs['resolvedOptions']['syntaxType'];
453
+ /**
454
+ * When set, `printer.print(node)` produces a full `type Name = …` declaration.
455
+ * When omitted, `printer.print(node)` returns the raw type node.
456
+ */
457
+ name?: string;
458
+ /**
459
+ * JSDoc `@description` comment added to the generated type or interface declaration.
460
+ */
461
+ description?: string;
462
+ /**
463
+ * Property keys to exclude from the generated type via `Omit<Type, Keys>`.
464
+ * Forces type-alias syntax even when `syntaxType` is `'interface'`.
465
+ */
466
+ keysToOmit?: Array<string>;
467
+ /**
468
+ * Resolver used to transform raw schema names into valid TypeScript identifiers.
469
+ */
470
+ resolver: ResolverTs;
471
+ /**
472
+ * Names of top-level schemas that are enums.
473
+ * When set, the `ref` handler uses the suffixed type name (e.g. `StatusKey`) for enum refs
474
+ * instead of the plain PascalCase name, so imports align with what the enum file actually exports.
475
+ */
476
+ enumSchemaNames?: Set<string>;
477
+ };
478
+ /**
479
+ * TypeScript printer factory options: maps `SchemaNode` → `ts.TypeNode` (raw) or `ts.Node` (full declaration).
480
+ */
481
+ type TsPrinter = PrinterFactoryOptions<'typescript', TsOptions, ts.TypeNode, string>;
482
+ /**
483
+ * TypeScript type printer built with `definePrinter`.
484
+ *
485
+ * Converts a `SchemaNode` AST node into a TypeScript AST node:
486
+ * - **`printer.print(node)`** — when `options.typeName` is set, returns a full
487
+ * `type Name = …` or `interface Name { … }` declaration (`ts.Node`).
488
+ * Without `typeName`, returns the raw `ts.TypeNode` for the schema.
489
+ *
490
+ * Dispatches on `node.type` to the appropriate handler in `nodes`. Options are closed
491
+ * over per printer instance, so each call to `printerTs(options)` produces an independent printer.
492
+ *
493
+ * @example Raw type node (no `typeName`)
494
+ * ```ts
495
+ * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral' })
496
+ * const typeNode = printer.print(schemaNode) // ts.TypeNode
497
+ * ```
498
+ *
499
+ * @example Full declaration (with `typeName`)
500
+ * ```ts
501
+ * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral', typeName: 'MyType' })
502
+ * const declaration = printer.print(schemaNode) // ts.TypeAliasDeclaration | ts.InterfaceDeclaration
503
+ * ```
504
+ */
505
+ declare const printerTs: (options?: TsOptions | undefined) => _$_kubb_core0.Printer<TsPrinter>;
506
+ //#endregion
507
+ //#region src/resolvers/resolverTs.d.ts
508
+ /**
509
+ * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution
510
+ * helpers used by the plugin. Import this in other plugins to resolve the exact names and
511
+ * paths that `plugin-ts` generates without hardcoding the conventions.
512
+ *
513
+ * The `default` method is automatically injected by `defineResolver` — it uses `camelCase`
514
+ * for identifiers/files and `pascalCase` for type names.
515
+ *
516
+ * @example
517
+ * ```ts
518
+ * import { resolver } from '@kubb/plugin-ts'
519
+ *
520
+ * resolver.default('list pets', 'type') // → 'ListPets'
521
+ * resolver.resolveName('list pets status 200') // → 'ListPetsStatus200'
522
+ * resolver.resolvePathName('list pets', 'file') // → 'listPets'
523
+ * ```
524
+ */
525
+ declare const resolverTs: ResolverTs;
526
+ //#endregion
527
+ //#region src/resolvers/resolverTsLegacy.d.ts
528
+ /**
529
+ * Legacy resolver for `@kubb/plugin-ts` that reproduces the naming conventions
530
+ * used before the v2 resolver refactor. Enable via `compatibilityPreset: 'kubbV4'`
531
+ * (or by composing this resolver manually).
532
+ *
533
+ * Key differences from the default resolver:
534
+ * - Response status types: `<OperationId><StatusCode>` (e.g. `CreatePets201`) instead of `<OperationId>Status201`
535
+ * - Default/error responses: `<OperationId>Error` instead of `<OperationId>StatusDefault`
536
+ * - Request body: `<OperationId>MutationRequest` (non-GET) / `<OperationId>QueryRequest` (GET)
537
+ * - Combined responses type: `<OperationId>Mutation` / `<OperationId>Query`
538
+ * - Response union: `<OperationId>MutationResponse` / `<OperationId>QueryResponse`
539
+ *
540
+ * @example
541
+ * ```ts
542
+ * import { resolverTsLegacy } from '@kubb/plugin-ts'
543
+ *
544
+ * resolverTsLegacy.resolveResponseStatusTypedName(node, 201) // → 'CreatePets201'
545
+ * resolverTsLegacy.resolveResponseStatusTypedName(node, 'default') // → 'CreatePetsError'
546
+ * resolverTsLegacy.resolveDataTypedName(node) // → 'CreatePetsMutationRequest' (POST)
547
+ * resolverTsLegacy.resolveResponsesTypedName(node) // → 'CreatePetsMutation' (POST)
548
+ * resolverTsLegacy.resolveResponseTypedName(node) // → 'CreatePetsMutationResponse' (POST)
549
+ * ```
550
+ */
551
+ declare const resolverTsLegacy: ResolverTs;
27
552
  //#endregion
28
- export { type PluginTs, pluginTs, pluginTsName };
553
+ export { Enum, type PluginTs, type ResolverTs, Type, functionPrinter, pluginTs, pluginTsName, printerTs, resolverTs, resolverTsLegacy, typeGenerator };
29
554
  //# sourceMappingURL=index.d.ts.map