@kubb/plugin-ts 5.0.0-beta.10 → 5.0.0-beta.100

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/index.d.ts CHANGED
@@ -1,9 +1,8 @@
1
- import { t as __name } from "./chunk--u3MIqq1.js";
2
- import * as _$_kubb_core0 from "@kubb/core";
3
- import { Exclude, Generator, Group, Include, Output, Override, PluginFactoryOptions, Resolver, ast } from "@kubb/core";
1
+ import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
2
+ import { KubbReactNode } from "kubb/jsx";
3
+ import { Exclude, Group, Include, Output, OutputOptions, Override, PluginFactoryOptions, Resolver, ResolverPatch, ast } from "kubb/kit";
4
4
  import ts from "typescript";
5
- import { KubbReactNode } from "@kubb/renderer-jsx/types";
6
-
5
+ import "@kubb/adapter-oas";
7
6
  //#region src/printers/printerTs.d.ts
8
7
  /**
9
8
  * Partial map of node-type overrides for the TypeScript printer.
@@ -44,23 +43,11 @@ type PrinterTsOptions = {
44
43
  */
45
44
  arrayType: PluginTs['resolvedOptions']['arrayType'];
46
45
  /**
47
- * Enum output format.
48
- * - `'inlineLiteral'` embeds literal unions inline
49
- * - `'asPascalConst'` generates named const unions
50
- * - `'asConst'` generates as const declarations
51
- *
52
- * @default `'inlineLiteral'`
46
+ * Grouped enum settings. The printer emits references to enums, not the enum declarations, so only
47
+ * `type` (the output format) and `typeSuffix` (the enum key reference suffix) matter here.
48
+ * `constCasing` and `keyCasing` are ignored.
53
49
  */
54
- enumType: PluginTs['resolvedOptions']['enumType'];
55
- /**
56
- * Suffix appended to enum key reference names.
57
- *
58
- * @example Enum key naming
59
- * `StatusKey` when `enumType` is `'asConst'`
60
- *
61
- * @default `'Key'`
62
- */
63
- enumTypeSuffix?: PluginTs['resolvedOptions']['enumTypeSuffix'];
50
+ enum: PluginTs['resolvedOptions']['enum'];
64
51
  /**
65
52
  * Syntax for generated declarations.
66
53
  * - `'type'` generates type aliases
@@ -82,7 +69,7 @@ type PrinterTsOptions = {
82
69
  * Properties to exclude using `Omit<Type, Keys>`.
83
70
  * Forces type alias syntax regardless of `syntaxType` setting.
84
71
  */
85
- keysToOmit?: Array<string>;
72
+ keysToOmit?: Array<string> | null;
86
73
  /**
87
74
  * Transforms raw schema names into valid TypeScript identifiers.
88
75
  */
@@ -113,13 +100,13 @@ type PrinterTsFactory = ast.PrinterFactoryOptions<'typescript', PrinterTsOptions
113
100
  *
114
101
  * @example Raw type node (no `typeName`)
115
102
  * ```ts
116
- * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral' })
103
+ * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enum: { type: 'inlineLiteral' } })
117
104
  * const typeNode = printer.print(schemaNode) // ts.TypeNode
118
105
  * ```
119
106
  *
120
107
  * @example Full declaration (with `typeName`)
121
108
  * ```ts
122
- * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enumType: 'inlineLiteral', typeName: 'MyType' })
109
+ * const printer = printerTs({ optionalType: 'questionToken', arrayType: 'array', enum: { type: 'inlineLiteral' }, typeName: 'MyType' })
123
110
  * const declaration = printer.print(schemaNode) // ts.TypeAliasDeclaration | ts.InterfaceDeclaration
124
111
  * ```
125
112
  */
@@ -128,122 +115,148 @@ declare const printerTs: (options?: PrinterTsOptions | undefined) => ast.Printer
128
115
  //#region src/types.d.ts
129
116
  /**
130
117
  * The concrete resolver type for `@kubb/plugin-ts`.
131
- * Extends the base `Resolver` (which provides `default` and `resolveOptions`) with
132
- * plugin-specific naming helpers for operations, parameters, responses, and schemas.
118
+ * Extends the base `Resolver` (which provides `default` naming and option helpers, the top-level
119
+ * `name` casing, and the `file` builder) with plugin-specific naming namespaces for operation
120
+ * parameters, responses, and enum schemas.
133
121
  */
134
- type ResolverTs = Resolver & ast.OperationParamsResolver & {
135
- /**
136
- * Resolves the name for a given raw name (equivalent to `default(name, 'function')`).
137
- * Since TypeScript only emits types, this is the canonical naming method.
138
- *
139
- * @example Resolving type names
140
- * `resolver.resolveName('list pets status 200') // → 'ListPetsStatus200'`
141
- */
142
- resolveTypeName(name: string): string;
143
- /**
144
- * Resolves the file/path name for a given identifier using PascalCase.
145
- *
146
- * @example Resolving path names
147
- * `resolver.resolvePathName('list pets', 'file') // → 'ListPets'`
148
- */
149
- resolvePathName(name: string, type?: 'file' | 'function' | 'type' | 'const'): string;
150
- /**
151
- * Resolves the request body type name for an operation (required on ResolverTs).
152
- */
153
- resolveDataName(node: ast.OperationNode): string;
154
- /**
155
- * Resolves the name for an operation response by status code.
156
- * Encapsulates the `<operationId> Status <statusCode>` template with PascalCase applied to the result.
157
- *
158
- * @example Response status names
159
- * `resolver.resolveResponseStatusName(node, 200) // → 'ListPetsStatus200'`
160
- */
161
- resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string;
162
- /**
163
- * Resolves the name for an operation's request config (`RequestConfig`).
164
- *
165
- * @example Request config names
166
- * `resolver.resolveRequestConfigName(node) // → 'ListPetsRequestConfig'`
167
- */
168
- resolveRequestConfigName(node: ast.OperationNode): string;
169
- /**
170
- * Resolves the name for the collection of all operation responses (`Responses`).
171
- *
172
- * @example Responses collection names
173
- * `resolver.resolveResponsesName(node) // → 'ListPetsResponses'`
174
- */
175
- resolveResponsesName(node: ast.OperationNode): string;
176
- /**
177
- * Resolves the name for the union of all operation responses (`Response`).
178
- *
179
- * @example Response union names
180
- * `resolver.resolveResponseName(node) // → 'ListPetsResponse'`
181
- */
182
- resolveResponseName(node: ast.OperationNode): string;
183
- /**
184
- * Resolves the TypeScript type alias name for an enum schema's key variant.
185
- * Appends `enumTypeSuffix` (default `'Key'`) after applying the default naming convention.
186
- *
187
- * @example Enum key names with different suffixes
188
- * ```ts
189
- * resolver.resolveEnumKeyName(node, 'Key') // → 'PetStatusKey'
190
- * resolver.resolveEnumKeyName(node, 'Value') // → 'PetStatusValue'
191
- * resolver.resolveEnumKeyName(node, '') // → 'PetStatus'
192
- * ```
193
- */
194
- resolveEnumKeyName(node: {
195
- name?: string | null;
196
- }, enumTypeSuffix: string): string;
197
- /**
198
- * Resolves the name for an operation's grouped path parameters type.
199
- *
200
- * @example Path parameters names
201
- * `resolver.resolvePathParamsName(node, param) // → 'GetPetByIdPathParams'`
202
- */
203
- resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string;
122
+ type ResolverTs = Resolver & {
123
+ /**
124
+ * Naming for an operation's parameters, grouped by location.
125
+ */
126
+ param: {
127
+ /**
128
+ * Resolves the type name for an individual parameter.
129
+ *
130
+ * @example Individual parameter name
131
+ * `resolver.param.name(node, param) // → 'DeletePetPathPetId'`
132
+ */
133
+ name(node: ast.OperationNode, param: ast.ParameterNode): string;
134
+ /**
135
+ * Resolves the name for an operation's grouped path parameters type.
136
+ *
137
+ * @example Path parameters names
138
+ * `resolver.param.path(node, param) // → 'GetPetByIdPath'`
139
+ */
140
+ path(node: ast.OperationNode, param: ast.ParameterNode): string;
141
+ /**
142
+ * Resolves the name for an operation's grouped query parameters type.
143
+ *
144
+ * @example Query parameters names
145
+ * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'`
146
+ */
147
+ query(node: ast.OperationNode, param: ast.ParameterNode): string;
148
+ /**
149
+ * Resolves the name for an operation's grouped header parameters type.
150
+ *
151
+ * @example Header parameters names
152
+ * `resolver.param.headers(node, param) // → 'DeletePetHeaders'`
153
+ */
154
+ headers(node: ast.OperationNode, param: ast.ParameterNode): string;
155
+ };
204
156
  /**
205
- * Resolves the name for an operation's grouped query parameters type.
206
- *
207
- * @example Query parameters names
208
- * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`
209
- */
210
- resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string;
157
+ * Naming for an operation's request and response types.
158
+ */
159
+ response: {
160
+ /**
161
+ * Resolves the name for an operation response by status code.
162
+ * Encapsulates the `<operationId> Status <statusCode>` template with PascalCase applied to the result.
163
+ *
164
+ * @example Response status names
165
+ * `resolver.response.status(node, 200) // → 'ListPetsStatus200'`
166
+ */
167
+ status(node: ast.OperationNode, statusCode: ast.StatusCode): string;
168
+ /**
169
+ * Resolves the name for an operation's grouped request options type (`Options`), the
170
+ * `{ body, path, query, headers }` bag passed to call an operation.
171
+ *
172
+ * @example Options type names
173
+ * `resolver.response.options(node) // → 'ListPetsOptions'`
174
+ */
175
+ options(node: ast.OperationNode): string;
176
+ /**
177
+ * Resolves the name for the collection of all operation responses (`Responses`).
178
+ *
179
+ * @example Responses collection names
180
+ * `resolver.response.responses(node) // → 'ListPetsResponses'`
181
+ */
182
+ responses(node: ast.OperationNode): string;
183
+ /**
184
+ * Resolves the name for the union of all operation responses (`Response`).
185
+ *
186
+ * @example Response union names
187
+ * `resolver.response.response(node) // → 'ListPetsResponse'`
188
+ */
189
+ response(node: ast.OperationNode): string;
190
+ /**
191
+ * Resolves the request body type name.
192
+ *
193
+ * @example Request body type name
194
+ * `resolver.response.body(node) // → 'CreatePetBody'`
195
+ */
196
+ body(node: ast.OperationNode): string;
197
+ };
211
198
  /**
212
- * Resolves the name for an operation's grouped header parameters type.
213
- *
214
- * @example Header parameters names
215
- * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`
216
- */
217
- resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string;
199
+ * Naming for enum schemas.
200
+ */
201
+ enum: {
202
+ /**
203
+ * Resolves the TypeScript type alias name for an enum schema's key variant.
204
+ * Appends `enumTypeSuffix` (default `'key'`) after applying the default naming convention.
205
+ *
206
+ * @example Enum key names with different suffixes
207
+ * ```ts
208
+ * resolver.enum.keyName(node, 'Key') // → 'PetStatusKey'
209
+ * resolver.enum.keyName(node, 'Value') // → 'PetStatusValue'
210
+ * resolver.enum.keyName(node, '') // → 'PetStatus'
211
+ * ```
212
+ */
213
+ keyName(node: {
214
+ name?: string | null;
215
+ }, enumTypeSuffix?: string): string;
216
+ };
218
217
  };
219
218
  type EnumKeyCasing = 'screamingSnakeCase' | 'snakeCase' | 'pascalCase' | 'camelCase' | 'none';
219
+ type EnumConstCasing = 'camelCase' | 'pascalCase';
220
220
  /**
221
- * Discriminated union that ties `enumTypeSuffix` and `enumKeyCasing` to the enum types that actually use them.
222
- *
223
- * - `'asConst'` / `'asPascalConst'` — emit a `const` object; both `enumTypeSuffix` (type-alias suffix) and
224
- * `enumKeyCasing` (key formatting) are meaningful.
225
- * - `'enum'` / `'constEnum'` — emit a TypeScript enum; `enumKeyCasing` applies to member names,
226
- * but there is no separate type alias so `enumTypeSuffix` is not used.
227
- * - `'literal'` / `'inlineLiteral'` — emit only union literals; keys are discarded entirely,
228
- * so neither `enumTypeSuffix` nor `enumKeyCasing` have any effect.
221
+ * Grouped enum settings. Each `type` uses only some of the other fields.
222
+ *
223
+ * - `'asConst'` emits a `const` object plus a `typeof` type alias, so `constCasing`, `typeSuffix`, and `keyCasing` all apply.
224
+ * - `'enum'` and `'constEnum'` emit a TypeScript enum, so only `keyCasing` (the member names) applies.
225
+ * - `'literal'` and `'inlineLiteral'` emit union literals and drop the keys, so none of the other fields apply.
226
+ *
227
+ * @example Share one name between the const and the type
228
+ * ```ts
229
+ * enum: { type: 'asConst', constCasing: 'pascalCase', typeSuffix: '' }
230
+ * // export const VehicleType = { … } as const
231
+ * // export type VehicleType = (typeof VehicleType)[keyof typeof VehicleType]
232
+ * ```
229
233
  */
230
- type EnumTypeOptions = {
234
+ type EnumOptions$1 = {
231
235
  /**
232
- * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
233
- * - 'asConst' generates const objects with camelCase names and as const assertion.
234
- * - 'asPascalConst' generates const objects with PascalCase names and as const assertion.
236
+ * Emit a `const` object asserted with `as const`, paired with a `typeof` type alias.
237
+ * This is tree-shakeable and adds no enum runtime.
238
+ *
235
239
  * @default 'asConst'
236
240
  */
237
- enumType?: 'asConst' | 'asPascalConst';
241
+ type?: 'asConst';
238
242
  /**
239
- * Suffix appended to the generated type alias name.
243
+ * Casing of the generated const variable.
244
+ * - 'camelCase' names the const `vehicleType`.
245
+ * - 'pascalCase' names the const `VehicleType`, matching the schema name.
240
246
  *
241
- * Only affects the type alias — the const object name is unchanged.
247
+ * @default 'camelCase'
248
+ */
249
+ constCasing?: EnumConstCasing;
250
+ /**
251
+ * Suffix appended to the generated type alias name. Only the type alias is renamed. The const
252
+ * object name stays the same. Set it to `''` together with `constCasing: 'pascalCase'` to merge
253
+ * the const and type under the schema's exact name.
242
254
  *
243
255
  * @default 'Key'
244
- * @example enumTypeSuffix: 'Value' → `export type PetStatusValue = …`
256
+ * @example A custom suffix
257
+ * `typeSuffix: 'Value'` renames the alias to `PetStatusValue`
245
258
  */
246
- enumTypeSuffix?: string;
259
+ typeSuffix?: string;
247
260
  /**
248
261
  * Choose the casing for enum key names.
249
262
  * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
@@ -253,22 +266,24 @@ type EnumTypeOptions = {
253
266
  * - 'none' uses the enum value as-is without transformation.
254
267
  * @default 'none'
255
268
  */
256
- enumKeyCasing?: EnumKeyCasing;
269
+ keyCasing?: EnumKeyCasing;
257
270
  } | {
258
271
  /**
259
- * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
260
- * - 'enum' generates TypeScript enum declarations.
261
- * - 'constEnum' generates TypeScript const enum declarations.
272
+ * Emit a TypeScript `enum` (`'enum'`) or `const enum` (`'constEnum'`) declaration.
273
+ *
262
274
  * @default 'asConst'
263
275
  */
264
- enumType?: 'enum' | 'constEnum';
276
+ type?: 'enum' | 'constEnum';
265
277
  /**
266
- * `enumTypeSuffix` has no effect for this `enumType`.
267
- * It is only used when `enumType` is `'asConst'` or `'asPascalConst'`.
278
+ * `constCasing` has no effect for this `type`. Only `'asConst'` emits a const object.
268
279
  */
269
- enumTypeSuffix?: never;
280
+ constCasing?: never;
270
281
  /**
271
- * Choose the casing for enum key names.
282
+ * `typeSuffix` has no effect for this `type`. Only `'asConst'` emits a separate type alias.
283
+ */
284
+ typeSuffix?: never;
285
+ /**
286
+ * Choose the casing for enum member names.
272
287
  * - 'screamingSnakeCase' generates keys in SCREAMING_SNAKE_CASE format.
273
288
  * - 'snakeCase' generates keys in snake_case format.
274
289
  * - 'pascalCase' generates keys in PascalCase format.
@@ -276,119 +291,111 @@ type EnumTypeOptions = {
276
291
  * - 'none' uses the enum value as-is without transformation.
277
292
  * @default 'none'
278
293
  */
279
- enumKeyCasing?: EnumKeyCasing;
294
+ keyCasing?: EnumKeyCasing;
280
295
  } | {
281
296
  /**
282
- * Choose to use enum, asConst, asPascalConst, constEnum, literal, or inlineLiteral for enums.
283
- * - 'literal' generates literal union types.
284
- * - 'inlineLiteral' will inline enum values directly into the type (default in v5).
297
+ * Emit a union of literals as a named alias (`'literal'`) or inline the union at every usage
298
+ * site (`'inlineLiteral'`).
299
+ *
285
300
  * @default 'asConst'
286
301
  * @note In Kubb v5, 'inlineLiteral' becomes the default.
287
302
  */
288
- enumType?: 'literal' | 'inlineLiteral';
303
+ type?: 'literal' | 'inlineLiteral';
289
304
  /**
290
- * `enumTypeSuffix` has no effect for this `enumType`.
291
- * It is only used when `enumType` is `'asConst'` or `'asPascalConst'`.
305
+ * `constCasing` has no effect for this `type`; literal modes emit no const object.
292
306
  */
293
- enumTypeSuffix?: never;
307
+ constCasing?: never;
294
308
  /**
295
- * `enumKeyCasing` has no effect for this `enumType`.
296
- * Literal and inlineLiteral modes emit only values — keys are discarded entirely.
309
+ * `typeSuffix` has no effect for this `type`; literal modes emit no separate type alias.
297
310
  */
298
- enumKeyCasing?: never;
299
- };
300
- type Options = {
301
- /**
302
- * Specify the export location for the files and define the behavior of the output
303
- * @default { path: 'types', barrelType: 'named' }
304
- */
305
- output?: Output;
311
+ typeSuffix?: never;
306
312
  /**
307
- * Define which contentType should be used.
308
- * By default, uses the first valid JSON media type.
313
+ * `keyCasing` has no effect for this `type`. Literal and inlineLiteral modes emit only values,
314
+ * so the keys are discarded.
309
315
  */
310
- contentType?: 'application/json' | (string & {});
311
- /**
312
- * Group the clients based on the provided name.
313
- */
314
- group?: Group;
316
+ keyCasing?: never;
317
+ };
318
+ /**
319
+ * Where the generated `.ts` files are written and how they are exported, plus the optional
320
+ * `group` strategy. The `group` option organizes `output.mode: 'directory'` output into per-tag or per-path subdirectories.
321
+ *
322
+ * @default { path: 'types', barrel: { type: 'named' } }
323
+ */
324
+ type Options = OutputOptions & {
315
325
  /**
316
- * Array containing exclude parameters to exclude/skip tags/operations/methods/paths.
326
+ * Skip operations matching at least one entry in the list.
317
327
  */
318
328
  exclude?: Array<Exclude>;
319
329
  /**
320
- * Array containing include parameters to include tags/operations/methods/paths.
330
+ * Restrict generation to operations matching at least one entry in the list.
321
331
  */
322
332
  include?: Array<Include>;
323
333
  /**
324
- * Array containing override parameters to override `options` based on tags/operations/methods/paths.
334
+ * Apply a different options object to operations matching a pattern.
325
335
  */
326
336
  override?: Array<Override<ResolvedOptions>>;
327
337
  /**
328
- * Switch between type or interface for creating TypeScript types.
329
- * - 'type' generates type alias declarations.
330
- * - 'interface' generates interface declarations.
338
+ * Whether object schemas are emitted as `type` aliases or `interface` declarations.
339
+ * - `'type'` emits closed type aliases. Safer default for generated code.
340
+ * - `'interface'` emits interfaces. Useful when consumers rely on declaration merging.
341
+ *
331
342
  * @default 'type'
343
+ * @see https://www.totaltypescript.com/type-vs-interface-which-should-you-use
332
344
  */
333
345
  syntaxType?: 'type' | 'interface';
334
346
  /**
335
- * Choose what to use as mode for an optional value.
336
- * - 'questionToken' marks the property as optional with ? (e.g., type?: string).
337
- * - 'undefined' adds undefined to the type union (e.g., type: string | undefined).
338
- * - 'questionTokenAndUndefined' combines both approaches (e.g., type?: string | undefined).
347
+ * How optional properties are written in generated types.
348
+ * - `'questionToken'` — `type?: string`. The property may be missing.
349
+ * - `'undefined'` — `type: string | undefined`. Required to exist, may be `undefined`.
350
+ * - `'questionTokenAndUndefined'` — `type?: string | undefined`. Strictest.
351
+ *
339
352
  * @default 'questionToken'
353
+ * @note Pick `'questionTokenAndUndefined'` when `exactOptionalPropertyTypes` is on in `tsconfig.json`.
340
354
  */
341
355
  optionalType?: 'questionToken' | 'undefined' | 'questionTokenAndUndefined';
342
356
  /**
343
- * Choose between Array<string> or string[] for array types.
344
- * - 'generic' generates Array<Type> syntax.
345
- * - 'array' generates Type[] syntax.
357
+ * Syntax used for array types.
358
+ * - `'array'` — `Type[]`. Shorter.
359
+ * - `'generic'` — `Array<Type>`. More readable for complex element types.
360
+ *
346
361
  * @default 'array'
347
362
  */
348
363
  arrayType?: 'generic' | 'array';
349
364
  /**
350
- * How to style your params, by default no casing is applied
351
- * - 'camelcase' uses camelCase for pathParams, queryParams and headerParams property names
352
- * @default undefined
353
- * @note response types (data/body) are NOT affected by this option
354
- */
355
- paramsCasing?: 'camelcase';
356
- /**
357
- * Define some generators next to the ts generators
358
- */
359
- generators?: Array<Generator<PluginTs>>;
360
- /**
361
- * Override naming conventions. When a method returns `null` or `undefined`, the preset
362
- * resolver (`resolverTs`) is used as fallback.
365
+ * Override how names and file paths are built for generated symbols.
366
+ * Methods you omit fall back to the default `resolverTs`. `this` is bound to the
367
+ * full resolver, so `this.default.name(name)` delegates to the built-in implementation.
363
368
  */
364
- resolver?: Partial<ResolverTs> & ThisType<ResolverTs>;
369
+ resolver?: ResolverPatch<ResolverTs>;
365
370
  /**
366
- * AST visitor applied to each schema/operation node before printing.
367
- * Returning `null` or `undefined` from a visitor method falls back to the preset transformer.
371
+ * Macros applied to each schema or operation node before printing.
372
+ * Callbacks you omit fall back to the preset behavior.
368
373
  *
369
- * @example Remove writeOnly properties from response types
374
+ * @example Drop writeOnly properties from response types
370
375
  * ```ts
371
- * transformer: {
372
- * property(node) {
373
- * if (node.schema.writeOnly) return undefined
374
- * }
375
- * }
376
+ * macros: [
377
+ * {
378
+ * name: 'drop-write-only',
379
+ * property(node) {
380
+ * if (node.schema.writeOnly) return undefined
381
+ * },
382
+ * },
383
+ * ]
376
384
  * ```
377
385
  */
378
- transformer?: ast.Visitor;
386
+ macros?: Array<ast.Macro>;
379
387
  /**
380
- * Override individual printer node handlers to customize rendering of specific schema types.
381
- *
382
- * Each key is a `SchemaType` (e.g. `'date'`, `'string'`). The function replaces the
383
- * built-in handler for that type. Use `this.transform` to recurse into nested schema nodes.
388
+ * Replace the TypeScript handler for a specific schema type (`'integer'`, `'date'`, ...).
389
+ * Each handler returns a TypeScript AST node for that schema type. Use `this.transform`
390
+ * to recurse into nested schema nodes.
384
391
  *
385
- * @example Override the `date` node to use the `Date` object type
392
+ * @example Use the JavaScript `Date` object for date schemas
386
393
  * ```ts
387
394
  * import ts from 'typescript'
388
395
  * pluginTs({
389
396
  * printer: {
390
397
  * nodes: {
391
- * date(node) {
398
+ * date() {
392
399
  * return ts.factory.createTypeReferenceNode('Date', [])
393
400
  * },
394
401
  * },
@@ -399,20 +406,27 @@ type Options = {
399
406
  printer?: {
400
407
  nodes?: PrinterTsNodes;
401
408
  };
402
- } & EnumTypeOptions;
409
+ /**
410
+ * How OpenAPI enums are represented in the generated TypeScript, and how their names are cased.
411
+ */
412
+ enum?: EnumOptions$1;
413
+ };
414
+ type ResolvedEnumOptions = {
415
+ type: NonNullable<EnumOptions$1['type']>;
416
+ constCasing: EnumConstCasing;
417
+ typeSuffix: string;
418
+ keyCasing: EnumKeyCasing;
419
+ };
403
420
  type ResolvedOptions = {
404
421
  output: Output;
405
422
  exclude: Array<Exclude>;
406
423
  include: Array<Include> | undefined;
407
424
  override: Array<Override<ResolvedOptions>>;
408
- group: Group | undefined;
409
- enumType: NonNullable<Options['enumType']>;
410
- enumTypeSuffix: NonNullable<Options['enumTypeSuffix']>;
411
- enumKeyCasing: EnumKeyCasing;
425
+ group: Group | null;
426
+ enum: ResolvedEnumOptions;
412
427
  optionalType: NonNullable<Options['optionalType']>;
413
428
  arrayType: NonNullable<Options['arrayType']>;
414
429
  syntaxType: NonNullable<Options['syntaxType']>;
415
- paramsCasing: Options['paramsCasing'];
416
430
  printer: Options['printer'];
417
431
  };
418
432
  type PluginTs = PluginFactoryOptions<'plugin-ts', Options, ResolvedOptions, ResolverTs>;
@@ -425,39 +439,25 @@ declare global {
425
439
  }
426
440
  //#endregion
427
441
  //#region src/components/Enum.d.ts
442
+ type EnumOptions = PluginTs['resolvedOptions']['enum'];
428
443
  type Props$1 = {
429
444
  node: ast.EnumSchemaNode;
430
- enumType: PluginTs['resolvedOptions']['enumType'];
431
- enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
432
- enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
445
+ enum: EnumOptions;
433
446
  resolver: ResolverTs;
434
447
  key?: string | number | null;
435
448
  };
436
- /**
437
- * Resolves the runtime identifier name and the TypeScript type name for an enum schema node.
438
- *
439
- * The raw `node.name` may be a YAML key such as `"enumNames.Type"` which is not a
440
- * valid TypeScript identifier. The resolver normalizes it; for inline enum
441
- * properties the adapter already emits a PascalCase+suffix name so resolution is typically a no-op.
442
- */
443
449
  /**
444
450
  * Renders the enum declaration(s) for a single named `EnumSchemaNode`.
445
451
  *
446
- * Depending on `enumType` this may emit:
447
- * - A runtime object (`asConst` / `asPascalConst`) plus a `typeof` type alias
452
+ * Depending on `enum.type` this may emit:
453
+ * - A runtime object (`asConst`) plus a `typeof` type alias
448
454
  * - A `const enum` or plain `enum` declaration (`constEnum` / `enum`)
449
455
  * - A union literal type alias (`literal`)
450
456
  *
451
457
  * The emitted `File.Source` nodes carry the resolved names so that the barrel
452
458
  * index picks up the correct export identifiers.
453
459
  */
454
- declare function Enum({
455
- node,
456
- enumType,
457
- enumTypeSuffix,
458
- enumKeyCasing,
459
- resolver
460
- }: Props$1): KubbReactNode;
460
+ declare function Enum({ node, enum: enumOptions, resolver }: Props$1): KubbReactNode;
461
461
  //#endregion
462
462
  //#region src/components/Type.d.ts
463
463
  type Props = {
@@ -468,60 +468,275 @@ type Props = {
468
468
  * Created with `printerTs({ ..., nodes: options.printer?.nodes })`.
469
469
  */
470
470
  printer: ast.Printer<PrinterTsFactory>;
471
- enumType: PluginTs['resolvedOptions']['enumType'];
472
- enumTypeSuffix: PluginTs['resolvedOptions']['enumTypeSuffix'];
473
- enumKeyCasing: PluginTs['resolvedOptions']['enumKeyCasing'];
471
+ enum: PluginTs['resolvedOptions']['enum'];
474
472
  resolver: ResolverTs;
475
473
  };
476
- declare function Type({
477
- name,
478
- node,
479
- printer,
480
- enumType,
481
- enumTypeSuffix,
482
- enumKeyCasing,
483
- resolver
484
- }: Props): KubbReactNode;
474
+ declare function Type({ name, node, printer, enum: enumOptions, resolver }: Props): KubbReactNode;
485
475
  //#endregion
486
476
  //#region src/generators/typeGenerator.d.ts
487
- declare const typeGenerator: _$_kubb_core0.Generator<PluginTs, unknown>;
477
+ /**
478
+ * Built-in generator for `@kubb/plugin-ts`. Emits one TypeScript file per
479
+ * schema in the spec plus per-operation request, response, and parameter
480
+ * types. Drop-replace with a custom `Generator<PluginTs>` to change how
481
+ * TypeScript output is produced.
482
+ */
483
+ declare const typeGenerator: import("kubb/kit").Generator<PluginTs, unknown>;
488
484
  //#endregion
489
485
  //#region src/plugin.d.ts
490
486
  /**
491
- * Canonical plugin name for `@kubb/plugin-ts`, used to identify the plugin in driver lookups and warnings.
487
+ * Canonical plugin name for `@kubb/plugin-ts`. Used for driver lookups and
488
+ * cross-plugin dependency references.
492
489
  */
493
490
  declare const pluginTsName = "plugin-ts";
494
491
  /**
495
- * The `@kubb/plugin-ts` plugin factory.
496
- *
497
- * Generates TypeScript type declarations from an OpenAPI/AST `RootNode`.
498
- * Walks schemas and operations, delegates rendering to the active generators,
499
- * and writes barrel files based on `output.barrelType`.
492
+ * Generates TypeScript `type` aliases and `interface` declarations from an
493
+ * OpenAPI spec. The foundation that every other Kubb plugin builds on:
494
+ * clients, query hooks, mocks, and validators all reference the names this
495
+ * plugin produces.
500
496
  *
501
497
  * @example
502
498
  * ```ts
503
- * import pluginTs from '@kubb/plugin-ts'
499
+ * import { defineConfig } from 'kubb/config'
500
+ * import { pluginTs } from '@kubb/plugin-ts'
504
501
  *
505
502
  * export default defineConfig({
506
- * plugins: [pluginTs({ output: { path: 'types' }, enumType: 'asConst' })],
503
+ * input: './petStore.yaml',
504
+ * output: { path: './src/gen' },
505
+ * plugins: [
506
+ * pluginTs({
507
+ * output: { path: './types' },
508
+ * enum: { type: 'asConst' },
509
+ * optionalType: 'questionTokenAndUndefined',
510
+ * }),
511
+ * ],
507
512
  * })
508
513
  * ```
509
514
  */
510
- declare const pluginTs: (options?: Options | undefined) => _$_kubb_core0.Plugin<PluginTs>;
515
+ declare const pluginTs: (options?: Options | undefined) => import("kubb/kit").Plugin<PluginTs>;
516
+ //#endregion
517
+ //#region src/printers/functionParams.d.ts
518
+ /**
519
+ * A type expression used as a function parameter type annotation.
520
+ *
521
+ * - a plain `string` is a type reference rendered as-is, e.g. `'string'`, `'QueryParams'`, `'Partial<Config>'`
522
+ * - a {@link TypeLiteralNode} is an inline anonymous type, e.g. `{ petId: string; name?: string }`
523
+ * - an {@link IndexedAccessTypeNode} is a single field accessed from a named type, e.g. `PathParams['petId']`
524
+ */
525
+ type TypeExpression = string | TypeLiteralNode | IndexedAccessTypeNode;
526
+ /**
527
+ * An inline anonymous object type grouping named fields.
528
+ * Renders as `{ key: Type; other?: OtherType }`.
529
+ */
530
+ type TypeLiteralNode = {
531
+ kind: 'TypeLiteral';
532
+ /**
533
+ * Members of the object type, rendered in order.
534
+ */
535
+ members: Array<{
536
+ /**
537
+ * Member key.
538
+ */
539
+ name: string;
540
+ /**
541
+ * Member type expression.
542
+ */
543
+ type: TypeExpression;
544
+ /**
545
+ * Whether the member is optional, rendered with `?`.
546
+ */
547
+ optional?: boolean;
548
+ }>;
549
+ };
550
+ /**
551
+ * A single field accessed from a named group type. Renders as `target['key']`.
552
+ */
553
+ type IndexedAccessTypeNode = {
554
+ kind: 'IndexedAccessType';
555
+ /**
556
+ * Name of the type being indexed, e.g. `'GetPetPathParams'`.
557
+ */
558
+ target: string;
559
+ /**
560
+ * Field key to access, e.g. `'petId'`.
561
+ */
562
+ key: string;
563
+ };
564
+ /**
565
+ * An object destructuring binding, used as the name of a grouped function parameter.
566
+ * Renders as `{ id, name }` or `{ id: renamed }` when `propertyName` differs.
567
+ */
568
+ type ObjectBindingPatternNode = {
569
+ kind: 'ObjectBindingPattern';
570
+ /**
571
+ * Bound elements, rendered in order.
572
+ */
573
+ elements: Array<{
574
+ /**
575
+ * Local binding name.
576
+ */
577
+ name: string;
578
+ /**
579
+ * Source key when it differs from the binding name, rendered as `propertyName: name`.
580
+ */
581
+ propertyName?: string;
582
+ }>;
583
+ };
584
+ /**
585
+ * One function parameter.
586
+ *
587
+ * A simple parameter has a `string` name. A destructured group has an
588
+ * {@link ObjectBindingPatternNode} name paired with a {@link TypeLiteralNode} type.
589
+ *
590
+ * @example Required parameter
591
+ * `name: Type`
592
+ *
593
+ * @example Optional parameter
594
+ * `name?: Type`
595
+ *
596
+ * @example Parameter with default value
597
+ * `name: Type = defaultValue`
598
+ *
599
+ * @example Rest parameter
600
+ * `...name: Type[]`
601
+ *
602
+ * @example Destructured group
603
+ * `{ id, name? }: { id: string; name?: string } = {}`
604
+ */
605
+ type FunctionParameterNode = {
606
+ kind: 'FunctionParameter';
607
+ /**
608
+ * Parameter name, or an {@link ObjectBindingPatternNode} for a destructured group.
609
+ */
610
+ name: string | ObjectBindingPatternNode;
611
+ /**
612
+ * Type annotation as a {@link TypeExpression}. Omit for untyped output.
613
+ */
614
+ type?: TypeExpression;
615
+ /**
616
+ * Whether the parameter is optional, rendered with `?`.
617
+ */
618
+ optional?: boolean;
619
+ /**
620
+ * Default value, written verbatim after `=`. Commonly `'{}'` for a destructured group.
621
+ */
622
+ default?: string;
623
+ /**
624
+ * When `true` the parameter is emitted as a rest parameter, e.g. `...name: Type[]`.
625
+ */
626
+ rest?: boolean;
627
+ };
628
+ /**
629
+ * A complete function parameter list.
630
+ *
631
+ * Printers are responsible for sorting (`required` → `optional` → `defaulted`).
632
+ */
633
+ type FunctionParametersNode = {
634
+ kind: 'FunctionParameters';
635
+ /**
636
+ * Ordered parameter nodes.
637
+ */
638
+ params: ReadonlyArray<FunctionParameterNode>;
639
+ };
640
+ /**
641
+ * Creates a {@link TypeLiteralNode} representing an inline anonymous object type.
642
+ *
643
+ * @example
644
+ * ```ts
645
+ * createTypeLiteral({ members: [{ name: 'petId', type: 'string', optional: false }] })
646
+ * // { petId: string }
647
+ * ```
648
+ */
649
+ declare function createTypeLiteral(props: Omit<TypeLiteralNode, 'kind'>): TypeLiteralNode;
650
+ /**
651
+ * Creates an {@link IndexedAccessTypeNode} representing a single field accessed from a named type.
652
+ *
653
+ * @example
654
+ * ```ts
655
+ * createIndexedAccessType({ target: 'DeletePetPathParams', key: 'petId' })
656
+ * // DeletePetPathParams['petId']
657
+ * ```
658
+ */
659
+ declare function createIndexedAccessType(props: Omit<IndexedAccessTypeNode, 'kind'>): IndexedAccessTypeNode;
660
+ /**
661
+ * Creates an {@link ObjectBindingPatternNode} for a destructured parameter binding.
662
+ *
663
+ * @example
664
+ * ```ts
665
+ * createObjectBindingPattern({ elements: [{ name: 'id' }, { name: 'name' }] })
666
+ * // { id, name }
667
+ * ```
668
+ */
669
+ declare function createObjectBindingPattern(props: Omit<ObjectBindingPatternNode, 'kind'>): ObjectBindingPatternNode;
670
+ /**
671
+ * Plain property descriptor for a destructured group built by {@link createFunctionParameter}.
672
+ */
673
+ type FunctionParameterProperty = {
674
+ name: string;
675
+ type: TypeExpression;
676
+ optional?: boolean;
677
+ };
678
+ type FunctionParameterInput = {
679
+ name: string | ObjectBindingPatternNode;
680
+ type?: TypeExpression;
681
+ optional?: boolean;
682
+ default?: string;
683
+ rest?: boolean;
684
+ } | {
685
+ properties: Array<FunctionParameterProperty>;
686
+ optional?: boolean;
687
+ default?: string;
688
+ };
689
+ /**
690
+ * Creates a {@link FunctionParameterNode}. `optional` defaults to `false`.
691
+ * Passing `properties` builds a destructured group: an {@link ObjectBindingPatternNode} name
692
+ * paired with a {@link TypeLiteralNode} type.
693
+ *
694
+ * @example Optional param
695
+ * ```ts
696
+ * createFunctionParameter({ name: 'params', type: 'QueryParams', optional: true })
697
+ * // → params?: QueryParams
698
+ * ```
699
+ *
700
+ * @example Destructured group
701
+ * ```ts
702
+ * createFunctionParameter({ properties: [{ name: 'id', type: 'string' }, { name: 'name', type: 'string', optional: true }], default: '{}' })
703
+ * // → { id, name }: { id: string; name?: string } = {}
704
+ * ```
705
+ */
706
+ declare function createFunctionParameter(input: FunctionParameterInput): FunctionParameterNode;
707
+ /**
708
+ * Creates a {@link FunctionParametersNode} from an ordered list of parameters.
709
+ *
710
+ * @example
711
+ * ```ts
712
+ * const empty = createFunctionParameters()
713
+ * // { params: [] }
714
+ * ```
715
+ */
716
+ declare function createFunctionParameters(props?: Partial<Omit<FunctionParametersNode, 'kind'>>): FunctionParametersNode;
511
717
  //#endregion
512
718
  //#region src/printers/functionPrinter.d.ts
719
+ /**
720
+ * Renders a {@link TypeExpression} to its TypeScript source.
721
+ *
722
+ * - a `string` is a type reference, returned as-is
723
+ * - an `IndexedAccessType` becomes `objectType['indexType']`
724
+ * - a `TypeLiteral` becomes `{ key: Type; key?: Type }`
725
+ *
726
+ * `transformType` is applied once to the fully rendered type, matching how the
727
+ * printer wrapped reference types before the `ts.factory` model.
728
+ */
729
+ declare function renderType(type: TypeExpression, transformType?: (type: string) => string): string;
513
730
  type FunctionPrinterOptions = {
514
731
  /**
515
732
  * Rendering modes supported by `functionPrinter`.
516
733
  *
517
- * | Mode | Output example | Use case |
518
- * |---------------|---------------------------------------------|---------------------------------|
519
- * | `declaration` | `id: string, config: Config = {}` | Function parameter declaration |
520
- * | `call` | `id, { method, url }` | Function call arguments |
521
- * | `keys` | `{ id, config }` | Key names only (destructuring) |
522
- * | `values` | `{ id: id, config: config }` | Key/value object entries |
734
+ * | Mode | Output example | Use case |
735
+ * |---------------|-----------------------------------|--------------------------------|
736
+ * | `declaration` | `id: string, config: Config = {}` | Function parameter declaration |
737
+ * | `call` | `id, { method, url }` | Function call arguments |
523
738
  */
524
- mode: 'declaration' | 'call' | 'keys' | 'values';
739
+ mode: 'declaration' | 'call';
525
740
  /**
526
741
  * Optional transformation applied to every parameter name before printing.
527
742
  */
@@ -532,8 +747,8 @@ type FunctionPrinterOptions = {
532
747
  transformType?: (type: string) => string;
533
748
  };
534
749
  /**
535
- * Default function-signature printer.
536
- * Covers the four standard output modes used across Kubb plugins.
750
+ * Default function-signature printer. Renders a parameter list in one of two modes:
751
+ * `declaration` for the function signature and `call` for the call arguments.
537
752
  *
538
753
  * @example
539
754
  * ```ts
@@ -549,32 +764,187 @@ type FunctionPrinterOptions = {
549
764
  * printer.print(sig) // → "petId: string, config: Config = {}"
550
765
  * ```
551
766
  */
552
- declare const functionPrinter: (options?: FunctionPrinterOptions | undefined) => {
767
+ declare function functionPrinter(options: FunctionPrinterOptions): {
553
768
  name: "functionParameters";
554
769
  options: FunctionPrinterOptions;
555
- transform: (node: ast.FunctionParamNode) => string | null | undefined;
556
- print: (node: ast.FunctionParamNode) => string | null | undefined;
770
+ print(node: FunctionParametersNode): string;
771
+ };
772
+ //#endregion
773
+ //#region ../../internals/shared/src/operation.d.ts
774
+ /**
775
+ * Resolver interface for building operation parameters.
776
+ *
777
+ * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.
778
+ */
779
+ type OperationParamsResolver = {
780
+ /**
781
+ * Naming for an operation's parameters, grouped by location.
782
+ */
783
+ param: {
784
+ /**
785
+ * Resolves the type name for an individual parameter.
786
+ *
787
+ * @example Individual path parameter name
788
+ * `resolver.param.name(node, param) // → 'DeletePetPathPetId'`
789
+ */
790
+ name(node: ast.OperationNode, param: ast.ParameterNode): string;
791
+ /**
792
+ * Resolves the grouped path parameters type name.
793
+ * When the return value equals `resolver.param.name`, no indexed access is emitted.
794
+ *
795
+ * @example Grouped path params type name
796
+ * `resolver.param.path(node, param) // → 'DeletePetPath'`
797
+ */
798
+ path(node: ast.OperationNode, param: ast.ParameterNode): string;
799
+ /**
800
+ * Resolves the grouped query parameters type name.
801
+ * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.
802
+ *
803
+ * @example Grouped query params type name
804
+ * `resolver.param.query(node, param) // → 'FindPetsByStatusQuery'`
805
+ */
806
+ query(node: ast.OperationNode, param: ast.ParameterNode): string;
807
+ /**
808
+ * Resolves the grouped header parameters type name.
809
+ * When the return value equals `resolver.param.name`, an inline struct type is emitted instead.
810
+ *
811
+ * @example Grouped header params type name
812
+ * `resolver.param.headers(node, param) // → 'DeletePetHeaders'`
813
+ */
814
+ headers(node: ast.OperationNode, param: ast.ParameterNode): string;
815
+ };
816
+ /**
817
+ * Naming for an operation's request and response types.
818
+ */
819
+ response: {
820
+ /**
821
+ * Resolves the request body type name.
822
+ *
823
+ * @example Request body type name
824
+ * `resolver.response.body(node) // → 'CreatePetBody'`
825
+ */
826
+ body(node: ast.OperationNode): string;
827
+ };
557
828
  };
558
829
  //#endregion
830
+ //#region src/printers/operationParams.d.ts
831
+ /**
832
+ * Options for {@link createOperationParams}.
833
+ */
834
+ type CreateOperationParamsOptions = {
835
+ /**
836
+ * How all operation parameters are grouped in the function signature.
837
+ * - `'object'` wraps all params into a single destructured object `{ petId, data, params }`
838
+ * - `'inline'` emits each param category as a separate top-level parameter
839
+ */
840
+ paramsType: 'object' | 'inline';
841
+ /**
842
+ * How path parameters are emitted when `paramsType` is `'inline'`.
843
+ * - `'object'` groups them as `{ petId, storeId }: PathParams`
844
+ * - `'inline'` spreads them as individual parameters `petId: string, storeId: string`
845
+ * - `'inlineSpread'` emits a single rest parameter `...pathParams: PathParams`
846
+ */
847
+ pathParamsType: 'object' | 'inline' | 'inlineSpread';
848
+ /**
849
+ * Resolver for parameter and request body type names.
850
+ * Pass `ResolverTs` from `@kubb/plugin-ts` directly.
851
+ * When omitted, falls back to the schema primitive or `'unknown'`.
852
+ */
853
+ resolver?: OperationParamsResolver;
854
+ /**
855
+ * Default value for the path parameters binding when `pathParamsType` is `'object'`.
856
+ * Falls back to `'{}'` when all path params are optional.
857
+ */
858
+ pathParamsDefault?: string;
859
+ /**
860
+ * Extra parameters appended after the standard operation parameters.
861
+ *
862
+ * @example Plugin-specific trailing parameter
863
+ * ```ts
864
+ * extraParams: [createFunctionParameter({ name: 'options', type: 'Partial<RequestOptions>', default: '{}' })]
865
+ * ```
866
+ */
867
+ extraParams?: Array<FunctionParameterNode>;
868
+ /**
869
+ * Override the default parameter names used for body, query, header, and rest-path groups.
870
+ *
871
+ * Useful when targeting languages or frameworks with different naming conventions.
872
+ *
873
+ * @default { data: 'data', params: 'params', headers: 'headers', path: 'pathParams' }
874
+ */
875
+ paramNames?: {
876
+ /**
877
+ * Name for the request body parameter.
878
+ * @default 'data'
879
+ */
880
+ data?: string;
881
+ /**
882
+ * Name for the query parameters group parameter.
883
+ * @default 'params'
884
+ */
885
+ params?: string;
886
+ /**
887
+ * Name for the header parameters group parameter.
888
+ * @default 'headers'
889
+ */
890
+ headers?: string;
891
+ /**
892
+ * Name for the rest path-parameters parameter when `pathParamsType` is `'inlineSpread'`.
893
+ * @default 'pathParams'
894
+ */
895
+ path?: string;
896
+ };
897
+ /**
898
+ * Transforms every resolved type name before it lands in a parameter node, for framework-level
899
+ * type wrappers.
900
+ *
901
+ * @example Vue Query, wrap every parameter type with `MaybeRefOrGetter`
902
+ * `typeWrapper: (t) => \`MaybeRefOrGetter<${t}>\``
903
+ */
904
+ typeWrapper?: (type: string) => string;
905
+ };
906
+ /**
907
+ * Converts an `OperationNode` into function parameters for code generation.
908
+ *
909
+ * Centralizes parameter grouping logic for all plugins. `paramsType` chooses between one
910
+ * destructured object parameter (`object`) and separate top-level parameters (`inline`), while
911
+ * `pathParamsType` controls how path params render in inline mode. Provide a `resolver` for type
912
+ * name resolution and `extraParams` for plugin-specific trailing parameters such as an `options` object.
913
+ */
914
+ declare function createOperationParams(node: ast.OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode;
915
+ //#endregion
559
916
  //#region src/resolvers/resolverTs.d.ts
560
917
  /**
561
- * Resolver for `@kubb/plugin-ts` that provides the default naming and path-resolution
562
- * helpers used by the plugin. Import this in other plugins to resolve the exact names and
563
- * paths that `plugin-ts` generates without hardcoding the conventions.
918
+ * Default resolver used by `@kubb/plugin-ts`. Decides the names and file paths
919
+ * for every generated TypeScript type. Import this in other plugins that need
920
+ * to reference the exact names `plugin-ts` produces without duplicating the
921
+ * casing/file-layout rules.
564
922
  *
565
- * The `default` method is automatically injected by `defineResolver` — it uses `camelCase`
566
- * for identifiers/files and `pascalCase` for type names.
923
+ * The `default` helpers are supplied by `createResolver`. This plugin overrides the top-level `name`
924
+ * to use PascalCase for value and type names and `file` to write PascalCase file paths (dotted names
925
+ * become `/`-joined), and groups the operation-specific naming under the `param`, `response`, and
926
+ * `enum` namespaces.
567
927
  *
568
- * @example
928
+ * @example Resolve a type and file name
569
929
  * ```ts
570
- * import { resolver } from '@kubb/plugin-ts'
930
+ * import { resolverTs } from '@kubb/plugin-ts'
571
931
  *
572
- * resolver.default('list pets', 'type') // → 'ListPets'
573
- * resolver.resolveName('list pets status 200') // → 'ListPetsStatus200'
574
- * resolver.resolvePathName('list pets', 'file') // → 'listPets'
932
+ * resolverTs.name('list pets') // 'ListPets'
933
+ * resolverTs.response.status(node, 200) // 'ListPetsStatus200'
575
934
  * ```
576
935
  */
577
936
  declare const resolverTs: ResolverTs;
578
937
  //#endregion
579
- export { Enum, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, Type, pluginTs as default, pluginTs, functionPrinter, pluginTsName, printerTs, resolverTs, typeGenerator };
938
+ //#region src/utils.d.ts
939
+ type BuildParamsSchemaOptions = {
940
+ params: Array<ast.ParameterNode>;
941
+ };
942
+ /**
943
+ * Builds the object schema for a group of parameters sharing one `in` location (path, query, or
944
+ * header), embedding each param's own schema (and JSDoc) directly rather than referencing a
945
+ * separate per-param type — the group itself is the only type these params get exported as.
946
+ */
947
+ declare function buildParams({ params }: BuildParamsSchemaOptions): ast.SchemaNode;
948
+ //#endregion
949
+ export { type CreateOperationParamsOptions, Enum, type FunctionParameterNode, type FunctionParametersNode, type IndexedAccessTypeNode, type ObjectBindingPatternNode, type PluginTs, type PrinterTsFactory, type PrinterTsNodes, type PrinterTsOptions, type ResolverTs, Type, type TypeExpression, type TypeLiteralNode, buildParams, createFunctionParameter, createFunctionParameters, createIndexedAccessType, createObjectBindingPattern, createOperationParams, createTypeLiteral, pluginTs as default, pluginTs, functionPrinter, pluginTsName, printerTs, renderType, resolverTs, typeGenerator };
580
950
  //# sourceMappingURL=index.d.ts.map