@kubb/ast 5.0.0-beta.7 → 5.0.0-beta.71

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 (65) hide show
  1. package/LICENSE +17 -10
  2. package/README.md +53 -27
  3. package/dist/defineMacro-5Dvct8k_.cjs +114 -0
  4. package/dist/defineMacro-5Dvct8k_.cjs.map +1 -0
  5. package/dist/defineMacro-BXpTwp0y.d.ts +466 -0
  6. package/dist/defineMacro-VfsvblGi.js +98 -0
  7. package/dist/defineMacro-VfsvblGi.js.map +1 -0
  8. package/dist/index-DJEyS5y6.d.ts +2428 -0
  9. package/dist/index.cjs +198 -2239
  10. package/dist/index.cjs.map +1 -1
  11. package/dist/index.d.ts +98 -3400
  12. package/dist/index.js +149 -2160
  13. package/dist/index.js.map +1 -1
  14. package/dist/macros.cjs +130 -0
  15. package/dist/macros.cjs.map +1 -0
  16. package/dist/macros.d.ts +61 -0
  17. package/dist/macros.js +128 -0
  18. package/dist/macros.js.map +1 -0
  19. package/dist/operationParams-BaY12i2I.d.ts +148 -0
  20. package/dist/refs-D18OeCgb.js +117 -0
  21. package/dist/refs-D18OeCgb.js.map +1 -0
  22. package/dist/refs-DuP3_Leg.cjs +157 -0
  23. package/dist/refs-DuP3_Leg.cjs.map +1 -0
  24. package/dist/rolldown-runtime-CNktS9qV.js +17 -0
  25. package/dist/types-BsP1SK9j.d.ts +244 -0
  26. package/dist/types.cjs +0 -0
  27. package/dist/types.d.ts +5 -0
  28. package/dist/types.js +1 -0
  29. package/dist/utils.cjs +803 -0
  30. package/dist/utils.cjs.map +1 -0
  31. package/dist/utils.d.ts +354 -0
  32. package/dist/utils.js +777 -0
  33. package/dist/utils.js.map +1 -0
  34. package/dist/visitor-CQdSiClY.cjs +1749 -0
  35. package/dist/visitor-CQdSiClY.cjs.map +1 -0
  36. package/dist/visitor-dcVC5TOW.js +1313 -0
  37. package/dist/visitor-dcVC5TOW.js.map +1 -0
  38. package/package.json +17 -5
  39. package/dist/chunk--u3MIqq1.js +0 -8
  40. package/src/constants.ts +0 -228
  41. package/src/factory.ts +0 -742
  42. package/src/guards.ts +0 -110
  43. package/src/index.ts +0 -46
  44. package/src/infer.ts +0 -130
  45. package/src/mocks.ts +0 -176
  46. package/src/nodes/base.ts +0 -56
  47. package/src/nodes/code.ts +0 -304
  48. package/src/nodes/file.ts +0 -230
  49. package/src/nodes/function.ts +0 -223
  50. package/src/nodes/http.ts +0 -119
  51. package/src/nodes/index.ts +0 -86
  52. package/src/nodes/operation.ts +0 -111
  53. package/src/nodes/output.ts +0 -26
  54. package/src/nodes/parameter.ts +0 -41
  55. package/src/nodes/property.ts +0 -34
  56. package/src/nodes/response.ts +0 -43
  57. package/src/nodes/root.ts +0 -64
  58. package/src/nodes/schema.ts +0 -656
  59. package/src/printer.ts +0 -250
  60. package/src/refs.ts +0 -67
  61. package/src/resolvers.ts +0 -45
  62. package/src/transformers.ts +0 -159
  63. package/src/types.ts +0 -70
  64. package/src/utils.ts +0 -915
  65. package/src/visitor.ts +0 -592
@@ -0,0 +1,2428 @@
1
+ import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
2
+
3
+ //#region src/nodes/base.d.ts
4
+ /**
5
+ * `kind` values used by AST nodes.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * const kind: NodeKind = 'Schema'
10
+ * ```
11
+ */
12
+ type NodeKind = 'Input' | 'Output' | 'Operation' | 'Schema' | 'Property' | 'Parameter' | 'Response' | 'RequestBody' | 'Content' | 'FunctionParameter' | 'FunctionParameters' | 'TypeLiteral' | 'IndexedAccessType' | 'ObjectBindingPattern' | 'Type' | 'File' | 'Import' | 'Export' | 'Source' | 'Const' | 'Function' | 'ArrowFunction' | 'Text' | 'Break' | 'Jsx';
13
+ /**
14
+ * Base shape shared by all AST nodes.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const base: BaseNode = { kind: 'Input' }
19
+ * ```
20
+ */
21
+ type BaseNode = {
22
+ /**
23
+ * Node discriminator.
24
+ */
25
+ kind: NodeKind;
26
+ };
27
+ //#endregion
28
+ //#region src/defineNode.d.ts
29
+ /**
30
+ * Visitor callback names, one per traversable node kind, in traversal order.
31
+ * Kept in sync with the keys of `Visitor` in `visitor.ts`.
32
+ */
33
+ declare const visitorKeys: readonly ["input", "output", "operation", "schema", "property", "parameter", "response"];
34
+ /**
35
+ * One of the {@link visitorKeys} callback names.
36
+ */
37
+ type VisitorKey = (typeof visitorKeys)[number];
38
+ /**
39
+ * Distributive `Omit` that preserves each member of a union.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * type A = { kind: 'a'; keep: string; drop: number }
44
+ * type B = { kind: 'b'; keep: boolean; drop: number }
45
+ * type Result = DistributiveOmit<A | B, 'drop'>
46
+ * // -> { kind: 'a'; keep: string } | { kind: 'b'; keep: boolean }
47
+ * ```
48
+ */
49
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
50
+ /**
51
+ * The single definition derived from one {@link defineNode} call: the node's
52
+ * `create` builder, its `is` guard, and the traversal metadata the registry
53
+ * collects into the visitor tables.
54
+ */
55
+ type NodeDef<TNode extends BaseNode = BaseNode, TInput = never> = {
56
+ /**
57
+ * Node discriminator this definition owns.
58
+ */
59
+ kind: NodeKind;
60
+ /**
61
+ * Builds a node from its input, applying `defaults` and the optional `build` hook.
62
+ */
63
+ create: (input: TInput) => TNode;
64
+ /**
65
+ * Type guard matching this node kind.
66
+ */
67
+ is: (node: unknown) => node is TNode;
68
+ /**
69
+ * Child node fields in traversal order. Feeds `VISITOR_KEYS`.
70
+ */
71
+ children?: ReadonlyArray<string>;
72
+ /**
73
+ * Visitor callback name. Feeds `VISITOR_KEY_BY_KIND`.
74
+ */
75
+ visitorKey?: VisitorKey;
76
+ };
77
+ type DefineNodeConfig<TNode extends BaseNode, TInput, TBuilt extends object> = {
78
+ kind: TNode['kind'];
79
+ defaults?: Partial<TNode>;
80
+ build?: (input: TInput) => TBuilt;
81
+ children?: ReadonlyArray<string>;
82
+ visitorKey?: VisitorKey;
83
+ };
84
+ /**
85
+ * Defines a node once and derives its `create` builder, `is` guard, and traversal
86
+ * metadata. `create` merges `defaults`, the `build` hook (or the raw input), and the
87
+ * `kind`, so node construction lives in one place without scattered `as` casts.
88
+ *
89
+ * @example Simple node
90
+ * ```ts
91
+ * const importDef = defineNode<ImportNode>({ kind: 'Import' })
92
+ * const createImport = importDef.create
93
+ * ```
94
+ *
95
+ * @example Node with a build hook
96
+ * ```ts
97
+ * const propertyDef = defineNode<PropertyNode, UserPropertyNode>({
98
+ * kind: 'Property',
99
+ * build: (props) => ({ ...props, required: props.required ?? false }),
100
+ * children: ['schema'],
101
+ * visitorKey: 'property',
102
+ * })
103
+ * ```
104
+ */
105
+ declare function defineNode<TNode extends BaseNode, TInput = Omit<TNode, 'kind'>, TBuilt extends object = Omit<TNode, 'kind'>>(config: DefineNodeConfig<TNode, TInput, TBuilt>): NodeDef<TNode, TInput>;
106
+ //#endregion
107
+ //#region src/nodes/code.d.ts
108
+ /**
109
+ * JSDoc documentation metadata attached to code declarations.
110
+ */
111
+ type JSDocNode = {
112
+ /**
113
+ * JSDoc comment lines. `undefined` entries are filtered out during rendering.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * ['@description A pet resource', '@deprecated']
118
+ * ```
119
+ */
120
+ comments?: Array<string | undefined>;
121
+ };
122
+ /**
123
+ * AST node representing a TypeScript `const` declaration.
124
+ *
125
+ * Mirrors the props of the `Const` component from `@kubb/renderer-jsx`.
126
+ * The `children` prop of the component is represented as `nodes`.
127
+ *
128
+ * @example
129
+ * ```ts
130
+ * createConst({ name: 'pet', export: true, asConst: true })
131
+ * // export const pet = ... as const
132
+ * ```
133
+ */
134
+ type ConstNode = BaseNode & {
135
+ kind: 'Const';
136
+ /**
137
+ * Name of the constant declaration.
138
+ */
139
+ name: string;
140
+ /**
141
+ * Whether the declaration should be exported.
142
+ */
143
+ export?: boolean | null;
144
+ /**
145
+ * Explicit type annotation.
146
+ *
147
+ * @example Type reference
148
+ * `'Pet'`
149
+ */
150
+ type?: string | null;
151
+ /**
152
+ * JSDoc documentation metadata.
153
+ */
154
+ JSDoc?: JSDocNode | null;
155
+ /**
156
+ * Whether to append `as const` to the declaration.
157
+ */
158
+ asConst?: boolean | null;
159
+ /**
160
+ * Child nodes representing the value of the constant (children of the `Const` component).
161
+ * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
162
+ */
163
+ nodes?: Array<CodeNode>;
164
+ };
165
+ /**
166
+ * AST node representing a TypeScript `type` alias declaration.
167
+ *
168
+ * Mirrors the props of the `Type` component from `@kubb/renderer-jsx`.
169
+ * The `children` prop of the component is represented as `nodes`.
170
+ *
171
+ * @example
172
+ * ```ts
173
+ * createType({ name: 'Pet', export: true })
174
+ * // export type Pet = ...
175
+ * ```
176
+ */
177
+ type TypeNode = BaseNode & {
178
+ kind: 'Type';
179
+ /**
180
+ * Name of the type alias.
181
+ */
182
+ name: string;
183
+ /**
184
+ * Whether the declaration should be exported.
185
+ */
186
+ export?: boolean | null;
187
+ /**
188
+ * JSDoc documentation metadata.
189
+ */
190
+ JSDoc?: JSDocNode | null;
191
+ /**
192
+ * Child nodes representing the type body (children of the `Type` component).
193
+ * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
194
+ */
195
+ nodes?: Array<CodeNode>;
196
+ };
197
+ /**
198
+ * AST node representing a TypeScript `function` declaration.
199
+ *
200
+ * Mirrors the props of the `Function` component from `@kubb/renderer-jsx`.
201
+ * The `children` prop of the component is represented as `nodes`.
202
+ *
203
+ * @example
204
+ * ```ts
205
+ * createFunctionDeclaration({ name: 'getPet', export: true, async: true, returnType: 'Pet' })
206
+ * // export async function getPet(): Promise<Pet> { ... }
207
+ * ```
208
+ */
209
+ type FunctionNode = BaseNode & {
210
+ kind: 'Function';
211
+ /**
212
+ * Name of the function.
213
+ */
214
+ name: string;
215
+ /**
216
+ * Whether the function is a default export.
217
+ */
218
+ default?: boolean | null;
219
+ /**
220
+ * Function parameter list as a pre-rendered string, written verbatim between the parentheses.
221
+ *
222
+ * @example
223
+ * `'id: string, config: Config = {}'`
224
+ */
225
+ params?: string | null;
226
+ /**
227
+ * Whether the function should be exported.
228
+ */
229
+ export?: boolean | null;
230
+ /**
231
+ * Whether the function is async. When `true`, the return type is wrapped in `Promise<>`.
232
+ */
233
+ async?: boolean | null;
234
+ /**
235
+ * TypeScript generic type parameters.
236
+ *
237
+ * @example Constrained generics
238
+ * `['T', 'U extends string']`
239
+ */
240
+ generics?: string | Array<string> | null;
241
+ /**
242
+ * Return type annotation.
243
+ *
244
+ * @example Type reference
245
+ * `'Pet'`
246
+ */
247
+ returnType?: string | null;
248
+ /**
249
+ * JSDoc documentation metadata.
250
+ */
251
+ JSDoc?: JSDocNode | null;
252
+ /**
253
+ * Child nodes representing the function body (children of the `Function` component).
254
+ * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
255
+ */
256
+ nodes?: Array<CodeNode>;
257
+ };
258
+ /**
259
+ * AST node representing a TypeScript arrow function (`const name = () => { ... }`).
260
+ *
261
+ * Mirrors the props of the `Function.Arrow` component from `@kubb/renderer-jsx`.
262
+ * The `children` prop of the component is represented as `nodes`.
263
+ *
264
+ * @example
265
+ * ```ts
266
+ * createArrowFunctionDeclaration({ name: 'getPet', export: true, singleLine: true })
267
+ * // export const getPet = () => ...
268
+ * ```
269
+ */
270
+ type ArrowFunctionNode = Omit<FunctionNode, 'kind'> & {
271
+ kind: 'ArrowFunction';
272
+ /**
273
+ * Render the arrow function body as a single-line expression.
274
+ */
275
+ singleLine?: boolean | null;
276
+ };
277
+ /**
278
+ * AST node representing a raw text/string fragment in the source output.
279
+ *
280
+ * Used instead of bare `string` values so that all entries in `nodes` arrays
281
+ * are typed `CodeNode` objects rather than a mixed `CodeNode | string` union.
282
+ *
283
+ * @example
284
+ * ```ts
285
+ * createText('return fetch(id)')
286
+ * // { kind: 'Text', value: 'return fetch(id)' }
287
+ * ```
288
+ */
289
+ type TextNode = BaseNode & {
290
+ kind: 'Text';
291
+ /**
292
+ * The raw string content.
293
+ */
294
+ value: string;
295
+ };
296
+ /**
297
+ * AST node representing a blank line in the source output.
298
+ *
299
+ * Corresponds to `<br/>` in JSX components. `printNodes` turns a `Break` between two
300
+ * statements into one blank line. Consecutive breaks, and breaks at the start or end of
301
+ * the list, are folded away, so a `Break` never produces more than one blank line.
302
+ *
303
+ * @example
304
+ * ```ts
305
+ * createBreak()
306
+ * // { kind: 'Break' }
307
+ * ```
308
+ */
309
+ type BreakNode = BaseNode & {
310
+ kind: 'Break';
311
+ };
312
+ /**
313
+ * AST node representing a raw JSX fragment in the source output.
314
+ *
315
+ * Mirrors the `Jsx` component from `@kubb/renderer-jsx`. Embeds raw JSX/TSX markup
316
+ * (including fragments `<>…</>`) directly in generated code.
317
+ *
318
+ * @example
319
+ * ```ts
320
+ * createJsx('<>\n <a href={href}>Open</a>\n</>')
321
+ * // { kind: 'Jsx', value: '<>\n <a href={href}>Open</a>\n</>' }
322
+ * ```
323
+ */
324
+ type JsxNode = BaseNode & {
325
+ kind: 'Jsx';
326
+ /**
327
+ * The raw JSX string content.
328
+ */
329
+ value: string;
330
+ };
331
+ /**
332
+ * Union of all code-generation AST nodes.
333
+ *
334
+ * These nodes mirror the JSX components from `@kubb/renderer-jsx` and are used as
335
+ * structured children in {@link SourceNode.nodes}.
336
+ */
337
+ type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
338
+ /**
339
+ * Definition for the {@link ConstNode}.
340
+ */
341
+ declare const constDef: NodeDef<ConstNode, Omit<ConstNode, "kind">>;
342
+ /**
343
+ * Definition for the {@link TypeNode}.
344
+ */
345
+ declare const typeDef: NodeDef<TypeNode, Omit<TypeNode, "kind">>;
346
+ /**
347
+ * Definition for the {@link FunctionNode}.
348
+ */
349
+ declare const functionDef: NodeDef<FunctionNode, Omit<FunctionNode, "kind">>;
350
+ /**
351
+ * Definition for the {@link ArrowFunctionNode}.
352
+ */
353
+ declare const arrowFunctionDef: NodeDef<ArrowFunctionNode, Omit<ArrowFunctionNode, "kind">>;
354
+ /**
355
+ * Definition for the {@link TextNode}.
356
+ */
357
+ declare const textDef: NodeDef<TextNode, string>;
358
+ /**
359
+ * Definition for the {@link BreakNode}.
360
+ */
361
+ declare const breakDef: NodeDef<BreakNode, void>;
362
+ /**
363
+ * Definition for the {@link JsxNode}.
364
+ */
365
+ declare const jsxDef: NodeDef<JsxNode, string>;
366
+ /**
367
+ * Creates a `ConstNode` representing a TypeScript `const` declaration.
368
+ *
369
+ * @example Exported constant with type and `as const`
370
+ * ```ts
371
+ * createConst({ name: 'pets', export: true, type: 'Pet[]', asConst: true })
372
+ * // export const pets: Pet[] = ... as const
373
+ * ```
374
+ */
375
+ declare const createConst: (input: Omit<ConstNode, "kind">) => ConstNode;
376
+ /**
377
+ * Creates a `TypeNode` representing a TypeScript `type` alias declaration.
378
+ *
379
+ * @example
380
+ * ```ts
381
+ * createType({ name: 'Pet', export: true })
382
+ * // export type Pet = ...
383
+ * ```
384
+ */
385
+ declare const createType: (input: Omit<TypeNode, "kind">) => TypeNode;
386
+ /**
387
+ * Creates a `FunctionNode` representing a TypeScript `function` declaration.
388
+ *
389
+ * @example
390
+ * ```ts
391
+ * createFunction({ name: 'fetchPet', export: true, async: true, returnType: 'Pet' })
392
+ * // export async function fetchPet(): Promise<Pet> { ... }
393
+ * ```
394
+ */
395
+ declare const createFunction: (input: Omit<FunctionNode, "kind">) => FunctionNode;
396
+ /**
397
+ * Creates an `ArrowFunctionNode` representing a TypeScript arrow function.
398
+ *
399
+ * @example
400
+ * ```ts
401
+ * createArrowFunction({ name: 'double', export: true, params: 'n: number', singleLine: true })
402
+ * // export const double = (n: number) => ...
403
+ * ```
404
+ */
405
+ declare const createArrowFunction: (input: Omit<ArrowFunctionNode, "kind">) => ArrowFunctionNode;
406
+ /**
407
+ * Creates a {@link TextNode} representing a raw string fragment in the source output.
408
+ *
409
+ * @example
410
+ * ```ts
411
+ * createText('return fetch(id)')
412
+ * // { kind: 'Text', value: 'return fetch(id)' }
413
+ * ```
414
+ */
415
+ declare const createText: (input: string) => TextNode;
416
+ /**
417
+ * Creates a {@link BreakNode} representing a line break in the source output.
418
+ *
419
+ * @example
420
+ * ```ts
421
+ * createBreak()
422
+ * // { kind: 'Break' }
423
+ * ```
424
+ */
425
+ declare function createBreak(): BreakNode;
426
+ /**
427
+ * Creates a {@link JsxNode} representing a raw JSX fragment in the source output.
428
+ *
429
+ * @example
430
+ * ```ts
431
+ * createJsx('<>\n <a href={href}>Open</a>\n</>')
432
+ * // { kind: 'Jsx', value: '<>\n <a href={href}>Open</a>\n</>' }
433
+ * ```
434
+ */
435
+ declare const createJsx: (input: string) => JsxNode;
436
+ //#endregion
437
+ //#region src/infer.d.ts
438
+ /**
439
+ * Options that control how the adapter parser maps OpenAPI schemas to AST nodes.
440
+ */
441
+ type ParserOptions = {
442
+ /**
443
+ * How `format: 'date-time'` schemas are represented downstream.
444
+ * - `false` falls through to a plain `string` (no validation).
445
+ * - `'string'` emits a datetime string node.
446
+ * - `'stringOffset'` emits a datetime node with timezone offset.
447
+ * - `'stringLocal'` emits a local datetime node.
448
+ * - `'date'` emits a `date` node (JavaScript `Date` object).
449
+ */
450
+ dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
451
+ /**
452
+ * How `type: 'integer'` (and `format: 'int64'`) maps to TypeScript.
453
+ * - `'bigint'` is exact for 64-bit IDs, but does not round-trip through JSON.
454
+ * - `'number'` fits most JSON APIs. Loses precision above `Number.MAX_SAFE_INTEGER`.
455
+ *
456
+ * @default 'bigint'
457
+ */
458
+ integerType?: 'number' | 'bigint';
459
+ /**
460
+ * AST type used when a schema's type cannot be inferred from the spec
461
+ * (`additionalProperties: true`, missing `type`, ...).
462
+ */
463
+ unknownType: 'any' | 'unknown' | 'void';
464
+ /**
465
+ * AST type used for completely empty schemas (`{}`).
466
+ */
467
+ emptySchemaType: 'any' | 'unknown' | 'void';
468
+ /**
469
+ * Suffix appended to derived enum names when Kubb has to invent one
470
+ * (typically for inline enums on object properties).
471
+ */
472
+ enumSuffix: 'enum' | (string & {});
473
+ };
474
+ /**
475
+ * Maps each `dateType` option value to the AST node produced by `format: 'date-time'`.
476
+ */
477
+ type DateTimeNodeByDateType = {
478
+ date: DateSchemaNode;
479
+ string: DatetimeSchemaNode;
480
+ stringOffset: DatetimeSchemaNode;
481
+ stringLocal: DatetimeSchemaNode;
482
+ false: StringSchemaNode;
483
+ };
484
+ /**
485
+ * Resolves the AST node produced by `format: 'date-time'` based on the `dateType` option.
486
+ */
487
+ type ResolveDateTimeNode<TDateType extends ParserOptions['dateType']> = DateTimeNodeByDateType[TDateType extends keyof DateTimeNodeByDateType ? TDateType : 'string'];
488
+ /**
489
+ * Ordered list of `[schema-shape, SchemaNode]` pairs.
490
+ * `InferSchemaNode` walks this tuple in order and returns the first matching node type.
491
+ */
492
+ type SchemaNodeMap<TDateType extends ParserOptions['dateType'] = 'string'> = [[{
493
+ $ref: string;
494
+ }, RefSchemaNode], [{
495
+ allOf: ReadonlyArray<unknown>;
496
+ properties: object;
497
+ }, IntersectionSchemaNode], [{
498
+ allOf: readonly [unknown, unknown, ...Array<unknown>];
499
+ }, IntersectionSchemaNode], [{
500
+ allOf: ReadonlyArray<unknown>;
501
+ }, SchemaNode], [{
502
+ oneOf: ReadonlyArray<unknown>;
503
+ }, UnionSchemaNode], [{
504
+ anyOf: ReadonlyArray<unknown>;
505
+ }, UnionSchemaNode], [{
506
+ const: null;
507
+ }, ScalarSchemaNode], [{
508
+ const: string | number | boolean;
509
+ }, EnumSchemaNode], [{
510
+ type: ReadonlyArray<string>;
511
+ }, UnionSchemaNode], [{
512
+ type: 'array';
513
+ enum: ReadonlyArray<unknown>;
514
+ }, ArraySchemaNode], [{
515
+ enum: ReadonlyArray<unknown>;
516
+ }, EnumSchemaNode], [{
517
+ type: 'enum';
518
+ }, EnumSchemaNode], [{
519
+ type: 'union';
520
+ }, UnionSchemaNode], [{
521
+ type: 'intersection';
522
+ }, IntersectionSchemaNode], [{
523
+ type: 'tuple';
524
+ }, ArraySchemaNode], [{
525
+ type: 'ref';
526
+ }, RefSchemaNode], [{
527
+ type: 'datetime';
528
+ }, DatetimeSchemaNode], [{
529
+ type: 'date';
530
+ }, DateSchemaNode], [{
531
+ type: 'time';
532
+ }, TimeSchemaNode], [{
533
+ type: 'url';
534
+ }, UrlSchemaNode], [{
535
+ type: 'object';
536
+ }, ObjectSchemaNode], [{
537
+ additionalProperties: boolean | {};
538
+ }, ObjectSchemaNode], [{
539
+ type: 'array';
540
+ }, ArraySchemaNode], [{
541
+ items: object;
542
+ }, ArraySchemaNode], [{
543
+ prefixItems: ReadonlyArray<unknown>;
544
+ }, ArraySchemaNode], [{
545
+ type: string;
546
+ format: 'date-time';
547
+ }, ResolveDateTimeNode<TDateType>], [{
548
+ type: string;
549
+ format: 'date';
550
+ }, DateSchemaNode], [{
551
+ type: string;
552
+ format: 'time';
553
+ }, TimeSchemaNode], [{
554
+ format: 'date-time';
555
+ }, ResolveDateTimeNode<TDateType>], [{
556
+ format: 'date';
557
+ }, DateSchemaNode], [{
558
+ format: 'time';
559
+ }, TimeSchemaNode], [{
560
+ type: 'string';
561
+ }, StringSchemaNode], [{
562
+ type: 'number';
563
+ }, NumberSchemaNode], [{
564
+ type: 'integer';
565
+ }, NumberSchemaNode], [{
566
+ type: 'bigint';
567
+ }, NumberSchemaNode], [{
568
+ type: string;
569
+ }, ScalarSchemaNode], [{
570
+ minLength: number;
571
+ }, StringSchemaNode], [{
572
+ maxLength: number;
573
+ }, StringSchemaNode], [{
574
+ pattern: string;
575
+ }, StringSchemaNode], [{
576
+ minimum: number;
577
+ }, NumberSchemaNode], [{
578
+ maximum: number;
579
+ }, NumberSchemaNode]];
580
+ /**
581
+ * Infers the matching AST `SchemaNode` type from an input schema shape.
582
+ */
583
+ type InferSchemaNode<TSchema extends object, TDateType extends ParserOptions['dateType'] = 'string', TEntries extends ReadonlyArray<[object, SchemaNode]> = SchemaNodeMap<TDateType>> = TEntries extends [infer TEntry extends [object, SchemaNode], ...infer TRest extends ReadonlyArray<[object, SchemaNode]>] ? TSchema extends TEntry[0] ? TEntry[1] : InferSchemaNode<TSchema, TDateType, TRest> : SchemaNode;
584
+ //#endregion
585
+ //#region src/nodes/property.d.ts
586
+ /**
587
+ * AST node representing one named object property.
588
+ *
589
+ * @example
590
+ * ```ts
591
+ * const property: PropertyNode = {
592
+ * kind: 'Property',
593
+ * name: 'id',
594
+ * schema: createSchema({ type: 'integer' }),
595
+ * required: true,
596
+ * }
597
+ * ```
598
+ */
599
+ type PropertyNode = BaseNode & {
600
+ kind: 'Property';
601
+ /**
602
+ * Property key.
603
+ */
604
+ name: string;
605
+ /**
606
+ * Property schema.
607
+ */
608
+ schema: SchemaNode;
609
+ /**
610
+ * Whether the property is required.
611
+ */
612
+ required: boolean;
613
+ };
614
+ /**
615
+ * Loosely-typed property accepted by `createProperty`, with `required` optional.
616
+ */
617
+ type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>;
618
+ /**
619
+ * Definition for the {@link PropertyNode}. `required` defaults to `false`, and the schema's
620
+ * `optional`/`nullish` flags are derived from it through {@link optionality}.
621
+ */
622
+ declare const propertyDef: NodeDef<PropertyNode, UserPropertyNode>;
623
+ /**
624
+ * Creates a `PropertyNode`.
625
+ *
626
+ * @example
627
+ * ```ts
628
+ * const property = createProperty({
629
+ * name: 'status',
630
+ * required: true,
631
+ * schema: createSchema({ type: 'string', nullable: true }),
632
+ * })
633
+ * // required=true, no optional/nullish
634
+ * ```
635
+ */
636
+ declare const createProperty: (input: UserPropertyNode) => PropertyNode;
637
+ //#endregion
638
+ //#region src/nodes/schema.d.ts
639
+ type PrimitiveSchemaType =
640
+ /**
641
+ * Text value.
642
+ */
643
+ 'string'
644
+ /**
645
+ * Floating-point number.
646
+ */
647
+ | 'number'
648
+ /**
649
+ * Integer number.
650
+ */
651
+ | 'integer'
652
+ /**
653
+ * Big integer number.
654
+ */
655
+ | 'bigint'
656
+ /**
657
+ * Boolean value.
658
+ */
659
+ | 'boolean'
660
+ /**
661
+ * Null value.
662
+ */
663
+ | 'null'
664
+ /**
665
+ * Any value.
666
+ */
667
+ | 'any'
668
+ /**
669
+ * Unknown value.
670
+ */
671
+ | 'unknown'
672
+ /**
673
+ * No value (`void`).
674
+ */
675
+ | 'void'
676
+ /**
677
+ * Never value.
678
+ */
679
+ | 'never'
680
+ /**
681
+ * Object value.
682
+ */
683
+ | 'object'
684
+ /**
685
+ * Array value.
686
+ */
687
+ | 'array'
688
+ /**
689
+ * Date value.
690
+ */
691
+ | 'date';
692
+ /**
693
+ * Composite schema types.
694
+ */
695
+ type ComplexSchemaType = 'tuple' | 'union' | 'intersection' | 'enum';
696
+ /**
697
+ * Schema types that need special handling in generators.
698
+ */
699
+ type SpecialSchemaType = 'ref' | 'datetime' | 'time' | 'uuid' | 'email' | 'url' | 'ipv4' | 'ipv6' | 'blob';
700
+ /**
701
+ * All schema type strings.
702
+ */
703
+ type SchemaType = PrimitiveSchemaType | ComplexSchemaType | SpecialSchemaType;
704
+ /**
705
+ * Scalar schema types without extra object/array/ref structure.
706
+ */
707
+ type ScalarSchemaType = Exclude<SchemaType, 'object' | 'array' | 'tuple' | 'union' | 'intersection' | 'enum' | 'ref' | 'datetime' | 'date' | 'time' | 'string' | 'number' | 'integer' | 'bigint' | 'url' | 'uuid' | 'email'>;
708
+ /**
709
+ * Fields shared by all schema nodes.
710
+ */
711
+ type SchemaNodeBase = BaseNode & {
712
+ /**
713
+ * Node kind.
714
+ */
715
+ kind: 'Schema';
716
+ /**
717
+ * Schema name for named definitions (for example, `"Pet"`).
718
+ * Inline schemas omit this field.
719
+ * `null` means Kubb has processed this and determined there is no applicable name.
720
+ * `undefined` means the name has not been set yet.
721
+ */
722
+ name?: string | null;
723
+ /**
724
+ * Short schema title.
725
+ */
726
+ title?: string;
727
+ /**
728
+ * Schema description text.
729
+ */
730
+ description?: string;
731
+ /**
732
+ * Whether `null` is allowed.
733
+ */
734
+ nullable?: boolean;
735
+ /**
736
+ * Whether the field is optional.
737
+ */
738
+ optional?: boolean;
739
+ /**
740
+ * Both optional and nullable (`optional` + `nullable`).
741
+ */
742
+ nullish?: boolean;
743
+ /**
744
+ * Whether the schema is deprecated.
745
+ */
746
+ deprecated?: boolean;
747
+ /**
748
+ * Whether the schema is read-only.
749
+ */
750
+ readOnly?: boolean;
751
+ /**
752
+ * Whether the schema is write-only.
753
+ */
754
+ writeOnly?: boolean;
755
+ /**
756
+ * Default value.
757
+ */
758
+ default?: unknown;
759
+ /**
760
+ * Example values (OAS 3.1 `examples` array).
761
+ */
762
+ examples?: Array<unknown>;
763
+ /**
764
+ * Base primitive type.
765
+ * For example, this is `'string'` for a `uuid` schema.
766
+ */
767
+ primitive?: PrimitiveSchemaType;
768
+ /**
769
+ * Schema `format` value.
770
+ */
771
+ format?: string;
772
+ };
773
+ /**
774
+ * Object schema with ordered properties.
775
+ *
776
+ * @example
777
+ * ```ts
778
+ * const objectSchema: ObjectSchemaNode = {
779
+ * kind: 'Schema',
780
+ * type: 'object',
781
+ * properties: [],
782
+ * }
783
+ * ```
784
+ */
785
+ type ObjectSchemaNode = SchemaNodeBase & {
786
+ /**
787
+ * Schema type discriminator.
788
+ */
789
+ type: 'object';
790
+ /**
791
+ * Primitive type, always `'object'` for object schemas.
792
+ */
793
+ primitive: 'object';
794
+ /**
795
+ * Ordered object properties.
796
+ */
797
+ properties: Array<PropertyNode>;
798
+ /**
799
+ * Additional object properties behavior:
800
+ * - `true`: allow any value
801
+ * - `false`: reject unknown properties
802
+ * - `SchemaNode`: allow values that match that schema
803
+ * - `undefined`: no additional properties constraint (open object)
804
+ */
805
+ additionalProperties?: SchemaNode | boolean;
806
+ /**
807
+ * Pattern-based property schemas.
808
+ */
809
+ patternProperties?: Record<string, SchemaNode>;
810
+ /**
811
+ * Minimum number of properties allowed.
812
+ */
813
+ minProperties?: number;
814
+ /**
815
+ * Maximum number of properties allowed.
816
+ */
817
+ maxProperties?: number;
818
+ };
819
+ /**
820
+ * Array-like schema (`array` or `tuple`).
821
+ *
822
+ * @example
823
+ * ```ts
824
+ * const arraySchema: ArraySchemaNode = {
825
+ * kind: 'Schema',
826
+ * type: 'array',
827
+ * items: [],
828
+ * }
829
+ * ```
830
+ */
831
+ type ArraySchemaNode = SchemaNodeBase & {
832
+ /**
833
+ * Schema type discriminator (`array` or `tuple`).
834
+ */
835
+ type: 'array' | 'tuple';
836
+ /**
837
+ * Item schemas.
838
+ */
839
+ items?: Array<SchemaNode>;
840
+ /**
841
+ * Tuple rest-item schema for elements beyond positional `items`.
842
+ */
843
+ rest?: SchemaNode;
844
+ /**
845
+ * Minimum item count (or tuple length).
846
+ */
847
+ min?: number;
848
+ /**
849
+ * Maximum item count (or tuple length).
850
+ */
851
+ max?: number;
852
+ /**
853
+ * Whether all items must be unique.
854
+ */
855
+ unique?: boolean;
856
+ };
857
+ /**
858
+ * Shared shape for union and intersection schemas.
859
+ */
860
+ type CompositeSchemaNodeBase = SchemaNodeBase & {
861
+ /**
862
+ * Member schemas.
863
+ */
864
+ members?: Array<SchemaNode>;
865
+ };
866
+ /**
867
+ * Union schema, often from `oneOf` or `anyOf`.
868
+ *
869
+ * @example
870
+ * ```ts
871
+ * const unionSchema: UnionSchemaNode = {
872
+ * kind: 'Schema',
873
+ * type: 'union',
874
+ * members: [],
875
+ * }
876
+ * ```
877
+ */
878
+ type UnionSchemaNode = CompositeSchemaNodeBase & {
879
+ /**
880
+ * Schema type discriminator.
881
+ */
882
+ type: 'union';
883
+ /**
884
+ * Discriminator property name from OpenAPI `discriminator.propertyName`.
885
+ */
886
+ discriminatorPropertyName?: string;
887
+ /**
888
+ * How many union members must be valid.
889
+ * - `'one'`: exactly one member, from `oneOf`
890
+ * - `'any'`: any number of members, from `anyOf`
891
+ */
892
+ strategy?: 'one' | 'any';
893
+ };
894
+ /**
895
+ * Intersection schema, often from `allOf`.
896
+ *
897
+ * @example
898
+ * ```ts
899
+ * const intersectionSchema: IntersectionSchemaNode = {
900
+ * kind: 'Schema',
901
+ * type: 'intersection',
902
+ * members: [],
903
+ * }
904
+ * ```
905
+ */
906
+ type IntersectionSchemaNode = CompositeSchemaNodeBase & {
907
+ /**
908
+ * Schema type discriminator.
909
+ */
910
+ type: 'intersection';
911
+ };
912
+ /**
913
+ * One named enum item.
914
+ */
915
+ type EnumValueNode = {
916
+ /**
917
+ * Enum item name.
918
+ */
919
+ name: string;
920
+ /**
921
+ * Enum item value.
922
+ */
923
+ value: string | number | boolean;
924
+ /**
925
+ * Primitive type of the enum value.
926
+ */
927
+ primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>;
928
+ };
929
+ /**
930
+ * Enum schema node.
931
+ *
932
+ * @example
933
+ * ```ts
934
+ * const enumSchema: EnumSchemaNode = {
935
+ * kind: 'Schema',
936
+ * type: 'enum',
937
+ * enumValues: ['a', 'b'],
938
+ * }
939
+ * ```
940
+ */
941
+ type EnumSchemaNode = SchemaNodeBase & {
942
+ /**
943
+ * Schema type discriminator.
944
+ */
945
+ type: 'enum';
946
+ /**
947
+ * Enum values in simple form.
948
+ */
949
+ enumValues?: Array<string | number | boolean | null>;
950
+ /**
951
+ * Enum values in named form.
952
+ * If present, this is used instead of `enumValues`.
953
+ */
954
+ namedEnumValues?: Array<EnumValueNode>;
955
+ };
956
+ /**
957
+ * Reference schema that points to another schema definition.
958
+ *
959
+ * @example
960
+ * ```ts
961
+ * const refSchema: RefSchemaNode = {
962
+ * kind: 'Schema',
963
+ * type: 'ref',
964
+ * ref: '#/components/schemas/Pet',
965
+ * }
966
+ * ```
967
+ */
968
+ type RefSchemaNode = SchemaNodeBase & {
969
+ /**
970
+ * Schema type discriminator.
971
+ */
972
+ type: 'ref';
973
+ /**
974
+ * Referenced schema name.
975
+ * `null` means Kubb has processed this and determined there is no applicable name.
976
+ */
977
+ name?: string | null;
978
+ /**
979
+ * Original `$ref` path, for example, `#/components/schemas/Order`.
980
+ * Used to resolve names later.
981
+ */
982
+ ref?: string;
983
+ /**
984
+ * Pattern copied from a sibling `pattern` field.
985
+ */
986
+ pattern?: string;
987
+ /**
988
+ * The fully-parsed schema this ref resolves to, so its structure (`primitive`, `properties`)
989
+ * can be read without following the reference. Populated during OAS parsing when the
990
+ * definition resolves, `null` when it can't or the ref is circular, and `undefined` when
991
+ * resolution has not been attempted.
992
+ */
993
+ schema?: SchemaNode | null;
994
+ };
995
+ /**
996
+ * Datetime schema.
997
+ *
998
+ * @example
999
+ * ```ts
1000
+ * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }
1001
+ * ```
1002
+ */
1003
+ type DatetimeSchemaNode = SchemaNodeBase & {
1004
+ /**
1005
+ * Schema type discriminator.
1006
+ */
1007
+ type: 'datetime';
1008
+ /**
1009
+ * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).
1010
+ */
1011
+ offset?: boolean;
1012
+ /**
1013
+ * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).
1014
+ */
1015
+ local?: boolean;
1016
+ };
1017
+ /**
1018
+ * Shared base for `date` and `time` schemas.
1019
+ */
1020
+ type TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {
1021
+ /**
1022
+ * Schema type discriminator.
1023
+ */
1024
+ type: T;
1025
+ /**
1026
+ * Output representation in generated code.
1027
+ */
1028
+ representation: 'date' | 'string';
1029
+ };
1030
+ /**
1031
+ * Date schema node.
1032
+ *
1033
+ * @example
1034
+ * ```ts
1035
+ * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }
1036
+ * ```
1037
+ */
1038
+ type DateSchemaNode = TemporalSchemaNodeBase<'date'>;
1039
+ /**
1040
+ * Time schema node.
1041
+ *
1042
+ * @example
1043
+ * ```ts
1044
+ * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }
1045
+ * ```
1046
+ */
1047
+ type TimeSchemaNode = TemporalSchemaNodeBase<'time'>;
1048
+ /**
1049
+ * String schema node.
1050
+ *
1051
+ * @example
1052
+ * ```ts
1053
+ * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }
1054
+ * ```
1055
+ */
1056
+ type StringSchemaNode = SchemaNodeBase & {
1057
+ /**
1058
+ * Schema type discriminator.
1059
+ */
1060
+ type: 'string';
1061
+ /**
1062
+ * Minimum string length.
1063
+ */
1064
+ min?: number;
1065
+ /**
1066
+ * Maximum string length.
1067
+ */
1068
+ max?: number;
1069
+ /**
1070
+ * Regex pattern.
1071
+ */
1072
+ pattern?: string;
1073
+ };
1074
+ /**
1075
+ * Numeric schema (`number`, `integer`, or `bigint`).
1076
+ *
1077
+ * @example
1078
+ * ```ts
1079
+ * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }
1080
+ * ```
1081
+ */
1082
+ type NumberSchemaNode = SchemaNodeBase & {
1083
+ /**
1084
+ * Schema type discriminator.
1085
+ */
1086
+ type: 'number' | 'integer' | 'bigint';
1087
+ /**
1088
+ * Minimum value.
1089
+ */
1090
+ min?: number;
1091
+ /**
1092
+ * Maximum value.
1093
+ */
1094
+ max?: number;
1095
+ /**
1096
+ * Exclusive minimum value.
1097
+ */
1098
+ exclusiveMinimum?: number;
1099
+ /**
1100
+ * Exclusive maximum value.
1101
+ */
1102
+ exclusiveMaximum?: number;
1103
+ /**
1104
+ * The value must be a multiple of this number.
1105
+ */
1106
+ multipleOf?: number;
1107
+ };
1108
+ /**
1109
+ * Scalar schema with no extra constraints.
1110
+ *
1111
+ * @example
1112
+ * ```ts
1113
+ * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }
1114
+ * ```
1115
+ */
1116
+ type ScalarSchemaNode = SchemaNodeBase & {
1117
+ /**
1118
+ * Schema type discriminator.
1119
+ */
1120
+ type: ScalarSchemaType;
1121
+ };
1122
+ /**
1123
+ * URL schema node.
1124
+ * Can include an OpenAPI-style path template for template literal types.
1125
+ *
1126
+ * @example
1127
+ * ```ts
1128
+ * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }
1129
+ * ```
1130
+ */
1131
+ type UrlSchemaNode = SchemaNodeBase & {
1132
+ /**
1133
+ * Schema type discriminator.
1134
+ */
1135
+ type: 'url';
1136
+ /**
1137
+ * OpenAPI-style path template, for example, `'/pets/{petId}'`.
1138
+ */
1139
+ path?: string;
1140
+ /**
1141
+ * Minimum string length.
1142
+ */
1143
+ min?: number;
1144
+ /**
1145
+ * Maximum string length.
1146
+ */
1147
+ max?: number;
1148
+ };
1149
+ /**
1150
+ * Format-string schema for string-based formats that support length constraints.
1151
+ *
1152
+ * @example
1153
+ * ```ts
1154
+ * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }
1155
+ * ```
1156
+ */
1157
+ type FormatStringSchemaNode = SchemaNodeBase & {
1158
+ /**
1159
+ * Schema type discriminator.
1160
+ */
1161
+ type: 'uuid' | 'email';
1162
+ /**
1163
+ * Minimum string length.
1164
+ */
1165
+ min?: number;
1166
+ /**
1167
+ * Maximum string length.
1168
+ */
1169
+ max?: number;
1170
+ };
1171
+ /**
1172
+ * IPv4 address schema node.
1173
+ *
1174
+ * @example
1175
+ * ```ts
1176
+ * const ipv4Schema: Ipv4SchemaNode = { kind: 'Schema', type: 'ipv4' }
1177
+ * ```
1178
+ */
1179
+ type Ipv4SchemaNode = SchemaNodeBase & {
1180
+ /**
1181
+ * Schema type discriminator.
1182
+ */
1183
+ type: 'ipv4';
1184
+ };
1185
+ /**
1186
+ * IPv6 address schema node.
1187
+ *
1188
+ * @example
1189
+ * ```ts
1190
+ * const ipv6Schema: Ipv6SchemaNode = { kind: 'Schema', type: 'ipv6' }
1191
+ * ```
1192
+ */
1193
+ type Ipv6SchemaNode = SchemaNodeBase & {
1194
+ /**
1195
+ * Schema type discriminator.
1196
+ */
1197
+ type: 'ipv6';
1198
+ };
1199
+ /**
1200
+ * Mapping from schema type literals to concrete schema node types.
1201
+ * Used by `narrowSchema`.
1202
+ */
1203
+ type SchemaNodeByType = {
1204
+ object: ObjectSchemaNode;
1205
+ array: ArraySchemaNode;
1206
+ tuple: ArraySchemaNode;
1207
+ union: UnionSchemaNode;
1208
+ intersection: IntersectionSchemaNode;
1209
+ enum: EnumSchemaNode;
1210
+ ref: RefSchemaNode;
1211
+ datetime: DatetimeSchemaNode;
1212
+ date: DateSchemaNode;
1213
+ time: TimeSchemaNode;
1214
+ string: StringSchemaNode;
1215
+ number: NumberSchemaNode;
1216
+ integer: NumberSchemaNode;
1217
+ bigint: NumberSchemaNode;
1218
+ boolean: ScalarSchemaNode;
1219
+ null: ScalarSchemaNode;
1220
+ any: ScalarSchemaNode;
1221
+ unknown: ScalarSchemaNode;
1222
+ void: ScalarSchemaNode;
1223
+ never: ScalarSchemaNode;
1224
+ uuid: FormatStringSchemaNode;
1225
+ email: FormatStringSchemaNode;
1226
+ url: UrlSchemaNode;
1227
+ ipv4: Ipv4SchemaNode;
1228
+ ipv6: Ipv6SchemaNode;
1229
+ blob: ScalarSchemaNode;
1230
+ };
1231
+ /**
1232
+ * Union of all schema node types.
1233
+ */
1234
+ type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | Ipv4SchemaNode | Ipv6SchemaNode | ScalarSchemaNode;
1235
+ type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & {
1236
+ properties?: Array<PropertyNode>;
1237
+ primitive?: 'object';
1238
+ };
1239
+ type CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>;
1240
+ type CreateSchemaOutput<T extends CreateSchemaInput> = InferSchemaNode<T> & {
1241
+ kind: 'Schema';
1242
+ };
1243
+ /**
1244
+ * Definition for the {@link SchemaNode}. Object schemas default `properties` to an
1245
+ * empty array, and `primitive` is inferred from `type` when not explicitly provided.
1246
+ */
1247
+ declare const schemaDef: NodeDef<SchemaNode, CreateSchemaInput>;
1248
+ /**
1249
+ * Creates a `SchemaNode`, narrowed to the variant of `props.type`.
1250
+ *
1251
+ * @example
1252
+ * ```ts
1253
+ * const scalar = createSchema({ type: 'string' })
1254
+ * // { kind: 'Schema', type: 'string', primitive: 'string' }
1255
+ * ```
1256
+ *
1257
+ * @example
1258
+ * ```ts
1259
+ * const object = createSchema({ type: 'object' })
1260
+ * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }
1261
+ * ```
1262
+ */
1263
+ declare function createSchema<T extends CreateSchemaInput>(props: T): CreateSchemaOutput<T>;
1264
+ declare function createSchema(props: CreateSchemaInput): SchemaNode;
1265
+ //#endregion
1266
+ //#region src/nodes/content.d.ts
1267
+ /**
1268
+ * AST node representing one content-type entry of a request body or response.
1269
+ *
1270
+ * There is one entry per content type declared in the spec (e.g. `application/json`,
1271
+ * `multipart/form-data`), and each entry holds its own body schema.
1272
+ *
1273
+ * @example
1274
+ * ```ts
1275
+ * const content: ContentNode = {
1276
+ * kind: 'Content',
1277
+ * contentType: 'application/json',
1278
+ * schema: createSchema({ type: 'string' }),
1279
+ * }
1280
+ * ```
1281
+ */
1282
+ type ContentNode = BaseNode & {
1283
+ /**
1284
+ * Node kind.
1285
+ */
1286
+ kind: 'Content';
1287
+ /**
1288
+ * The content type for this entry (e.g. `'application/json'`).
1289
+ */
1290
+ contentType: string;
1291
+ /**
1292
+ * Body schema for this content type.
1293
+ */
1294
+ schema?: SchemaNode;
1295
+ /**
1296
+ * Property keys to exclude from the generated type via `Omit<Type, Keys>`.
1297
+ * Set when a referenced schema has `readOnly`/`writeOnly` fields that should be omitted.
1298
+ */
1299
+ keysToOmit?: Array<string> | null;
1300
+ };
1301
+ /**
1302
+ * Definition for the {@link ContentNode}.
1303
+ */
1304
+ declare const contentDef: NodeDef<ContentNode, Omit<ContentNode, "kind">>;
1305
+ /**
1306
+ * Creates a `ContentNode` for a single request-body or response content type.
1307
+ */
1308
+ declare const createContent: (input: Omit<ContentNode, "kind">) => ContentNode;
1309
+ //#endregion
1310
+ //#region src/nodes/file.d.ts
1311
+ /**
1312
+ * Supported file extensions.
1313
+ */
1314
+ type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
1315
+ type ImportName = string | Array<string | {
1316
+ propertyName: string;
1317
+ name?: string;
1318
+ }>;
1319
+ /**
1320
+ * Represents a language-agnostic import/dependency declaration.
1321
+ *
1322
+ * @example Named import (TypeScript: `import { useState } from 'react'`)
1323
+ * ```ts
1324
+ * createImport({ name: ['useState'], path: 'react' })
1325
+ * ```
1326
+ *
1327
+ * @example Default import (TypeScript: `import React from 'react'`)
1328
+ * ```ts
1329
+ * createImport({ name: 'React', path: 'react' })
1330
+ * ```
1331
+ *
1332
+ * @example Type-only import (TypeScript: `import type { FC } from 'react'`)
1333
+ * ```ts
1334
+ * createImport({ name: ['FC'], path: 'react', isTypeOnly: true })
1335
+ * ```
1336
+ *
1337
+ * @example Namespace import (TypeScript: `import * as React from 'react'`)
1338
+ * ```ts
1339
+ * createImport({ name: 'React', path: 'react', isNameSpace: true })
1340
+ * ```
1341
+ */
1342
+ type ImportNode = BaseNode & {
1343
+ kind: 'Import';
1344
+ /**
1345
+ * Import name(s) to be used.
1346
+ *
1347
+ * @example Named imports
1348
+ * `['useState']`
1349
+ *
1350
+ * @example Default import
1351
+ * `'React'`
1352
+ */
1353
+ name: ImportName;
1354
+ /**
1355
+ * Path for the import.
1356
+ *
1357
+ * @example
1358
+ * `'@kubb/core'`
1359
+ */
1360
+ path: string;
1361
+ /**
1362
+ * Add a type-only import prefix.
1363
+ * - `true` generates `import type { Type } from './path'`
1364
+ * - `false` generates `import { Type } from './path'`
1365
+ */
1366
+ isTypeOnly?: boolean | null;
1367
+ /**
1368
+ * Import the entire module as a namespace.
1369
+ * - `true` generates `import * as Name from './path'`
1370
+ * - `false` generates a standard import
1371
+ */
1372
+ isNameSpace?: boolean | null;
1373
+ /**
1374
+ * When set, the import path is resolved relative to this root.
1375
+ */
1376
+ root?: string | null;
1377
+ };
1378
+ /**
1379
+ * Represents a language-agnostic export/public API declaration.
1380
+ *
1381
+ * @example Named export (TypeScript: `export { Pets } from './Pets'`)
1382
+ * ```ts
1383
+ * createExport({ name: ['Pets'], path: './Pets' })
1384
+ * ```
1385
+ *
1386
+ * @example Type-only export (TypeScript: `export type { Pet } from './Pet'`)
1387
+ * ```ts
1388
+ * createExport({ name: ['Pet'], path: './Pet', isTypeOnly: true })
1389
+ * ```
1390
+ *
1391
+ * @example Wildcard export (TypeScript: `export * from './utils'`)
1392
+ * ```ts
1393
+ * createExport({ path: './utils' })
1394
+ * ```
1395
+ *
1396
+ * @example Namespace alias (TypeScript: `export * as utils from './utils'`)
1397
+ * ```ts
1398
+ * createExport({ name: 'utils', path: './utils', asAlias: true })
1399
+ * ```
1400
+ */
1401
+ type ExportNode = BaseNode & {
1402
+ kind: 'Export';
1403
+ /**
1404
+ * Export name(s) to be used. When omitted, generates a wildcard export.
1405
+ *
1406
+ * @example Named exports
1407
+ * `['useState']`
1408
+ *
1409
+ * @example Single export
1410
+ * `'React'`
1411
+ */
1412
+ name?: string | Array<string> | null;
1413
+ /**
1414
+ * Path for the export.
1415
+ *
1416
+ * @example
1417
+ * `'@kubb/core'`
1418
+ */
1419
+ path: string;
1420
+ /**
1421
+ * Add a type-only export prefix.
1422
+ * - `true` generates `export type { Type } from './path'`
1423
+ * - `false` generates `export { Type } from './path'`
1424
+ */
1425
+ isTypeOnly?: boolean | null;
1426
+ /**
1427
+ * Export as an aliased namespace.
1428
+ * - `true` generates `export * as aliasName from './path'`
1429
+ * - `false` generates a standard export
1430
+ */
1431
+ asAlias?: boolean | null;
1432
+ };
1433
+ /**
1434
+ * Represents a fragment of source code within a file.
1435
+ *
1436
+ * @example Named exportable source
1437
+ * ```ts
1438
+ * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true, isIndexable: true })
1439
+ * ```
1440
+ *
1441
+ * @example Inline unnamed code block
1442
+ * ```ts
1443
+ * createSource({ nodes: [createText('const x = 1')] })
1444
+ * ```
1445
+ */
1446
+ type SourceNode = BaseNode & {
1447
+ kind: 'Source';
1448
+ /**
1449
+ * Optional name identifying this source (used for deduplication and barrel generation).
1450
+ */
1451
+ name?: string | null;
1452
+ /**
1453
+ * Mark this source as a type-only export.
1454
+ */
1455
+ isTypeOnly?: boolean | null;
1456
+ /**
1457
+ * Include the `export` keyword in the generated source.
1458
+ */
1459
+ isExportable?: boolean | null;
1460
+ /**
1461
+ * Include this source in barrel/index file generation.
1462
+ */
1463
+ isIndexable?: boolean | null;
1464
+ /**
1465
+ * Child nodes that make up this source fragment, in DOM order.
1466
+ * Use a {@link TextNode} for raw string content.
1467
+ */
1468
+ nodes?: Array<CodeNode>;
1469
+ };
1470
+ /**
1471
+ * Represents a fully resolved file in the AST.
1472
+ *
1473
+ * Created via `createFile()`, which computes the `id`, `name`, and `extname` from the input
1474
+ * and deduplicates `imports`, `exports`, and `sources`.
1475
+ *
1476
+ * @example
1477
+ * ```ts
1478
+ * const file = createFile({
1479
+ * baseName: 'petStore.ts',
1480
+ * path: 'src/models/petStore.ts',
1481
+ * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })],
1482
+ * imports: [createImport({ name: ['z'], path: 'zod' })],
1483
+ * exports: [createExport({ name: ['Pet'], path: './petStore' })],
1484
+ * })
1485
+ * // file.id = SHA256 hash of the path
1486
+ * // file.name = 'petStore'
1487
+ * // file.extname = '.ts'
1488
+ * ```
1489
+ */
1490
+ type FileNode<TMeta extends object = object> = BaseNode & {
1491
+ kind: 'File';
1492
+ /**
1493
+ * Unique identifier derived from a SHA256 hash of the file path. `createFile`
1494
+ * computes it, so callers do not need to provide it.
1495
+ */
1496
+ id: string;
1497
+ /**
1498
+ * File name without extension, derived from `baseName`.
1499
+ *
1500
+ * @see https://nodejs.org/api/path.html#pathformatpathobject
1501
+ */
1502
+ name: string;
1503
+ /**
1504
+ * File base name, including extension, shaped like `${name}${extname}`.
1505
+ *
1506
+ * @see https://nodejs.org/api/path.html#pathbasenamepath-suffix
1507
+ */
1508
+ baseName: `${string}.${string}`;
1509
+ /**
1510
+ * Full qualified path to the file.
1511
+ */
1512
+ path: string;
1513
+ /**
1514
+ * File extension extracted from `baseName`.
1515
+ */
1516
+ extname: Extname;
1517
+ /**
1518
+ * Deduplicated list of source code fragments.
1519
+ */
1520
+ sources: Array<SourceNode>;
1521
+ /**
1522
+ * Deduplicated list of import declarations.
1523
+ */
1524
+ imports: Array<ImportNode>;
1525
+ /**
1526
+ * Deduplicated list of export declarations.
1527
+ */
1528
+ exports: Array<ExportNode>;
1529
+ /**
1530
+ * Optional metadata attached to this file, read by plugins during barrel generation.
1531
+ */
1532
+ meta?: TMeta;
1533
+ /**
1534
+ * Optional banner prepended to the generated file content.
1535
+ * Accepts `null` so `resolver.resolveBanner()` results can be passed directly.
1536
+ */
1537
+ banner?: string | null;
1538
+ /**
1539
+ * Optional footer appended to the generated file content.
1540
+ * Accepts `null` so `resolver.resolveFooter()` results can be passed directly.
1541
+ */
1542
+ footer?: string | null;
1543
+ /**
1544
+ * Absolute on-disk path to copy verbatim into the output, bypassing the parser.
1545
+ *
1546
+ * Use to emit a real source file shipped inside a package (a template) into the generated
1547
+ * folder without reformatting or import reordering. Only `banner` and `footer` are applied
1548
+ * around the copied content. When set, `copy` provides the file content and any `sources`
1549
+ * nodes are ignored for output; `sources` may still carry `name`/`isExportable`/`isIndexable`
1550
+ * so barrel generation treats the file the same as a rendered one.
1551
+ */
1552
+ copy?: string | null;
1553
+ };
1554
+ /**
1555
+ * Definition for the {@link ImportNode}.
1556
+ */
1557
+ declare const importDef: NodeDef<ImportNode, Omit<ImportNode, "kind">>;
1558
+ /**
1559
+ * Definition for the {@link ExportNode}.
1560
+ */
1561
+ declare const exportDef: NodeDef<ExportNode, Omit<ExportNode, "kind">>;
1562
+ /**
1563
+ * Definition for the {@link SourceNode}.
1564
+ */
1565
+ declare const sourceDef: NodeDef<SourceNode, Omit<SourceNode, "kind">>;
1566
+ /**
1567
+ * Definition for the {@link FileNode}. The fully resolved builder lives in
1568
+ * `createFile`, so this definition only supplies the guard.
1569
+ */
1570
+ declare const fileDef: NodeDef<FileNode<object>, Omit<FileNode<object>, "kind">>;
1571
+ /**
1572
+ * Creates an `ImportNode` representing a language-agnostic import/dependency declaration.
1573
+ *
1574
+ * @example Named import
1575
+ * ```ts
1576
+ * createImport({ name: ['useState'], path: 'react' })
1577
+ * // import { useState } from 'react'
1578
+ * ```
1579
+ */
1580
+ declare const createImport: (input: Omit<ImportNode, "kind">) => ImportNode;
1581
+ /**
1582
+ * Creates an `ExportNode` representing a language-agnostic export/public API declaration.
1583
+ *
1584
+ * @example Named export
1585
+ * ```ts
1586
+ * createExport({ name: ['Pet'], path: './Pet' })
1587
+ * // export { Pet } from './Pet'
1588
+ * ```
1589
+ */
1590
+ declare const createExport: (input: Omit<ExportNode, "kind">) => ExportNode;
1591
+ /**
1592
+ * Creates a `SourceNode` representing a fragment of source code within a file.
1593
+ *
1594
+ * @example
1595
+ * ```ts
1596
+ * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })
1597
+ * ```
1598
+ */
1599
+ declare const createSource: (input: Omit<SourceNode, "kind">) => SourceNode;
1600
+ /**
1601
+ * Input descriptor for {@link createFile}, before `id`, `name`, and `extname` are computed
1602
+ * and `imports`/`exports`/`sources` are deduplicated.
1603
+ */
1604
+ type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind' | 'id' | 'name' | 'extname' | 'imports' | 'exports' | 'sources'> & Pick<Partial<FileNode<TMeta>>, 'imports' | 'exports' | 'sources'>;
1605
+ /**
1606
+ * Creates a fully resolved `FileNode` from a file input descriptor.
1607
+ *
1608
+ * Computes:
1609
+ * - `id` SHA256 hash of the file path
1610
+ * - `name` `baseName` without extension
1611
+ * - `extname` extension extracted from `baseName`
1612
+ *
1613
+ * Deduplicates:
1614
+ * - `sources` via `combineSources`
1615
+ * - `exports` via `combineExports`
1616
+ * - `imports` via `combineImports` (also filters unused imports)
1617
+ *
1618
+ * @throws {Error} when `baseName` has no extension.
1619
+ *
1620
+ * @example
1621
+ * ```ts
1622
+ * const file = createFile({
1623
+ * baseName: 'petStore.ts',
1624
+ * path: 'src/models/petStore.ts',
1625
+ * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')] })],
1626
+ * imports: [createImport({ name: ['z'], path: 'zod' })],
1627
+ * exports: [createExport({ name: ['Pet'], path: './petStore' })],
1628
+ * })
1629
+ * // file.id = SHA256 hash of 'src/models/petStore.ts'
1630
+ * // file.name = 'petStore'
1631
+ * // file.extname = '.ts'
1632
+ * ```
1633
+ *
1634
+ * @example Copy a real file into the output verbatim
1635
+ * ```ts
1636
+ * const file = createFile({
1637
+ * baseName: 'client.ts',
1638
+ * path: 'src/gen/client.ts',
1639
+ * copy: '/abs/path/to/templates/client.ts',
1640
+ * })
1641
+ * ```
1642
+ */
1643
+ declare function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta>;
1644
+ //#endregion
1645
+ //#region src/nodes/function.d.ts
1646
+ /**
1647
+ * A language-agnostic type expression used as a function parameter type annotation.
1648
+ *
1649
+ * - a plain `string` is a type reference rendered as-is, e.g. `'string'`, `'QueryParams'`, `'Partial<Config>'`
1650
+ * - a {@link TypeLiteralNode} is an inline anonymous type, e.g. `{ petId: string; name?: string }`
1651
+ * - an {@link IndexedAccessTypeNode} is a single field accessed from a named type, e.g. `PathParams['petId']`
1652
+ */
1653
+ type TypeExpression = string | TypeLiteralNode | IndexedAccessTypeNode;
1654
+ /**
1655
+ * AST node for an inline anonymous object type grouping named fields.
1656
+ * TypeScript renders as `{ key: Type; other?: OtherType }`.
1657
+ *
1658
+ * @example
1659
+ * ```ts
1660
+ * createTypeLiteral({ members: [{ name: 'petId', type: 'string', optional: false }] })
1661
+ * // { petId: string }
1662
+ * ```
1663
+ */
1664
+ type TypeLiteralNode = BaseNode & {
1665
+ kind: 'TypeLiteral';
1666
+ /**
1667
+ * Members of the object type, rendered in order.
1668
+ */
1669
+ members: Array<{
1670
+ /**
1671
+ * Member key.
1672
+ */
1673
+ name: string;
1674
+ /**
1675
+ * Member type expression.
1676
+ */
1677
+ type: TypeExpression;
1678
+ /**
1679
+ * Whether the member is optional, rendered with `?`.
1680
+ */
1681
+ optional?: boolean;
1682
+ }>;
1683
+ };
1684
+ /**
1685
+ * AST node for a single field accessed from a named group type.
1686
+ * TypeScript renders as `target['key']`.
1687
+ *
1688
+ * @example
1689
+ * ```ts
1690
+ * createIndexedAccessType({ target: 'GetPetPathParams', key: 'petId' })
1691
+ * // GetPetPathParams['petId']
1692
+ * ```
1693
+ */
1694
+ type IndexedAccessTypeNode = BaseNode & {
1695
+ kind: 'IndexedAccessType';
1696
+ /**
1697
+ * Name of the type being indexed, e.g. `'GetPetPathParams'`.
1698
+ */
1699
+ target: string;
1700
+ /**
1701
+ * Field key to access, e.g. `'petId'`.
1702
+ */
1703
+ key: string;
1704
+ };
1705
+ /**
1706
+ * AST node for an object destructuring binding, used as the name of a grouped function parameter.
1707
+ * TypeScript renders as `{ id, name }` or `{ id: renamed }` when `propertyName` differs.
1708
+ *
1709
+ * @example
1710
+ * ```ts
1711
+ * createObjectBindingPattern({ elements: [{ name: 'id' }, { name: 'name' }] })
1712
+ * // { id, name }
1713
+ * ```
1714
+ */
1715
+ type ObjectBindingPatternNode = BaseNode & {
1716
+ kind: 'ObjectBindingPattern';
1717
+ /**
1718
+ * Bound elements, rendered in order.
1719
+ */
1720
+ elements: Array<{
1721
+ /**
1722
+ * Local binding name.
1723
+ */
1724
+ name: string;
1725
+ /**
1726
+ * Source key when it differs from the binding name, rendered as `propertyName: name`.
1727
+ */
1728
+ propertyName?: string;
1729
+ }>;
1730
+ };
1731
+ /**
1732
+ * AST node for one function parameter.
1733
+ *
1734
+ * A simple parameter has a `string` name. A destructured group has an
1735
+ * {@link ObjectBindingPatternNode} name paired with a {@link TypeLiteralNode} type.
1736
+ *
1737
+ * @example Required parameter
1738
+ * `name: Type`
1739
+ *
1740
+ * @example Optional parameter
1741
+ * `name?: Type`
1742
+ *
1743
+ * @example Parameter with default value
1744
+ * `name: Type = defaultValue`
1745
+ *
1746
+ * @example Rest parameter
1747
+ * `...name: Type[]`
1748
+ *
1749
+ * @example Destructured group
1750
+ * `{ id, name? }: { id: string; name?: string } = {}`
1751
+ */
1752
+ type FunctionParameterNode = BaseNode & {
1753
+ kind: 'FunctionParameter';
1754
+ /**
1755
+ * Parameter name, or an {@link ObjectBindingPatternNode} for a destructured group.
1756
+ */
1757
+ name: string | ObjectBindingPatternNode;
1758
+ /**
1759
+ * Type annotation as a {@link TypeExpression}. Omit for untyped output.
1760
+ */
1761
+ type?: TypeExpression;
1762
+ /**
1763
+ * Whether the parameter is optional, rendered with `?`.
1764
+ */
1765
+ optional?: boolean;
1766
+ /**
1767
+ * Default value, written verbatim after `=`. Commonly `'{}'` for a destructured group.
1768
+ */
1769
+ default?: string;
1770
+ /**
1771
+ * When `true` the parameter is emitted as a rest parameter, e.g. `...name: Type[]`.
1772
+ */
1773
+ rest?: boolean;
1774
+ };
1775
+ /**
1776
+ * AST node for a complete function parameter list.
1777
+ *
1778
+ * Printers are responsible for sorting (`required` → `optional` → `defaulted`).
1779
+ * Nodes are plain immutable data.
1780
+ *
1781
+ * Renders differently depending on the output mode:
1782
+ * - `declaration` → `(id: string, config: Config = {})` function declaration parameters
1783
+ * - `call` → `(id, { method, url })` function call arguments
1784
+ */
1785
+ type FunctionParametersNode = BaseNode & {
1786
+ kind: 'FunctionParameters';
1787
+ /**
1788
+ * Ordered parameter nodes.
1789
+ */
1790
+ params: ReadonlyArray<FunctionParameterNode>;
1791
+ };
1792
+ /**
1793
+ * Union of all function-parameter AST node variants used by the function-parameter printer.
1794
+ */
1795
+ type FunctionParamNode = FunctionParameterNode | FunctionParametersNode | TypeLiteralNode | IndexedAccessTypeNode | ObjectBindingPatternNode;
1796
+ /**
1797
+ * Handler-map keys for the function-parameter printer, one per {@link FunctionParamNode} kind.
1798
+ */
1799
+ type FunctionParamKind = FunctionParamNode['kind'];
1800
+ /**
1801
+ * Definition for the {@link TypeLiteralNode}.
1802
+ */
1803
+ declare const typeLiteralDef: NodeDef<TypeLiteralNode, Pick<TypeLiteralNode, "members">>;
1804
+ /**
1805
+ * Definition for the {@link IndexedAccessTypeNode}.
1806
+ */
1807
+ declare const indexedAccessTypeDef: NodeDef<IndexedAccessTypeNode, Omit<IndexedAccessTypeNode, "kind">>;
1808
+ /**
1809
+ * Definition for the {@link ObjectBindingPatternNode}.
1810
+ */
1811
+ declare const objectBindingPatternDef: NodeDef<ObjectBindingPatternNode, Pick<ObjectBindingPatternNode, "elements">>;
1812
+ /**
1813
+ * Plain property descriptor for a destructured group built by {@link createFunctionParameter}.
1814
+ */
1815
+ type FunctionParameterProperty = {
1816
+ name: string;
1817
+ type: TypeExpression;
1818
+ optional?: boolean;
1819
+ };
1820
+ type FunctionParameterInput = {
1821
+ name: string | ObjectBindingPatternNode;
1822
+ type?: TypeExpression;
1823
+ optional?: boolean;
1824
+ default?: string;
1825
+ rest?: boolean;
1826
+ } | {
1827
+ properties: Array<FunctionParameterProperty>;
1828
+ optional?: boolean;
1829
+ default?: string;
1830
+ };
1831
+ /**
1832
+ * Definition for the {@link FunctionParameterNode}. `optional` defaults to `false`.
1833
+ * Passing `properties` builds a destructured group: an {@link ObjectBindingPatternNode} name
1834
+ * paired with a {@link TypeLiteralNode} type.
1835
+ */
1836
+ declare const functionParameterDef: NodeDef<FunctionParameterNode, FunctionParameterInput>;
1837
+ /**
1838
+ * Definition for the {@link FunctionParametersNode}.
1839
+ */
1840
+ declare const functionParametersDef: NodeDef<FunctionParametersNode, Partial<Omit<FunctionParametersNode, "kind">>>;
1841
+ /**
1842
+ * Creates a {@link TypeLiteralNode} representing an inline anonymous object type.
1843
+ *
1844
+ * @example
1845
+ * ```ts
1846
+ * createTypeLiteral({ members: [{ name: 'petId', type: 'string', optional: false }] })
1847
+ * // { petId: string }
1848
+ * ```
1849
+ */
1850
+ declare const createTypeLiteral: (input: Pick<TypeLiteralNode, "members">) => TypeLiteralNode;
1851
+ /**
1852
+ * Creates an {@link IndexedAccessTypeNode} representing a single field accessed from a named type.
1853
+ *
1854
+ * @example
1855
+ * ```ts
1856
+ * createIndexedAccessType({ target: 'DeletePetPathParams', key: 'petId' })
1857
+ * // DeletePetPathParams['petId']
1858
+ * ```
1859
+ */
1860
+ declare const createIndexedAccessType: (input: Omit<IndexedAccessTypeNode, "kind">) => IndexedAccessTypeNode;
1861
+ /**
1862
+ * Creates an {@link ObjectBindingPatternNode} for a destructured parameter binding.
1863
+ *
1864
+ * @example
1865
+ * ```ts
1866
+ * createObjectBindingPattern({ elements: [{ name: 'id' }, { name: 'name' }] })
1867
+ * // { id, name }
1868
+ * ```
1869
+ */
1870
+ declare const createObjectBindingPattern: (input: Pick<ObjectBindingPatternNode, "elements">) => ObjectBindingPatternNode;
1871
+ /**
1872
+ * Creates a `FunctionParameterNode`. `optional` defaults to `false`.
1873
+ *
1874
+ * @example Optional param
1875
+ * ```ts
1876
+ * createFunctionParameter({ name: 'params', type: 'QueryParams', optional: true })
1877
+ * // → params?: QueryParams
1878
+ * ```
1879
+ *
1880
+ * @example Destructured group
1881
+ * ```ts
1882
+ * createFunctionParameter({ properties: [{ name: 'id', type: 'string' }, { name: 'name', type: 'string', optional: true }], default: '{}' })
1883
+ * // → { id, name }: { id: string; name?: string } = {}
1884
+ * ```
1885
+ *
1886
+ * @example Destructured group typed from a single reference
1887
+ * ```ts
1888
+ * createFunctionParameter({ name: createObjectBindingPattern({ elements: [{ name: 'path' }] }), type: "Omit<Config, 'url'>", default: '{}' })
1889
+ * // → { path }: Omit<Config, 'url'> = {}
1890
+ * ```
1891
+ */
1892
+ declare const createFunctionParameter: (input: FunctionParameterInput) => FunctionParameterNode;
1893
+ /**
1894
+ * Creates a `FunctionParametersNode` from an ordered list of parameters.
1895
+ *
1896
+ * @example
1897
+ * ```ts
1898
+ * const empty = createFunctionParameters()
1899
+ * // { kind: 'FunctionParameters', params: [] }
1900
+ * ```
1901
+ */
1902
+ declare function createFunctionParameters(props?: Partial<Omit<FunctionParametersNode, 'kind'>>): FunctionParametersNode;
1903
+ //#endregion
1904
+ //#region ../../internals/utils/src/promise.d.ts
1905
+ /**
1906
+ * Container that switches between an eager `Array<T>` and a lazy `AsyncIterable<T>`.
1907
+ *
1908
+ * `Array<T>` by default. With `Stream` set to `true` it becomes `AsyncIterable<T>`, so large
1909
+ * collections can be produced lazily without holding every item in memory. Pairs with
1910
+ * {@link arrayToAsyncIterable}, which lifts a plain array into the streaming form.
1911
+ *
1912
+ * @example
1913
+ * ```ts
1914
+ * type Eager = Streamable<number> // Array<number>
1915
+ * type Lazy = Streamable<number, true> // AsyncIterable<number>
1916
+ * ```
1917
+ */
1918
+ type Streamable<T, Stream extends boolean = false> = Stream extends true ? AsyncIterable<T> : Array<T>;
1919
+ //#endregion
1920
+ //#region src/nodes/parameter.d.ts
1921
+ type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
1922
+ /**
1923
+ * AST node representing one operation parameter.
1924
+ *
1925
+ * @example
1926
+ * ```ts
1927
+ * const param: ParameterNode = {
1928
+ * kind: 'Parameter',
1929
+ * name: 'petId',
1930
+ * in: 'path',
1931
+ * schema: createSchema({ type: 'string' }),
1932
+ * required: true,
1933
+ * }
1934
+ * ```
1935
+ */
1936
+ type ParameterNode = BaseNode & {
1937
+ kind: 'Parameter';
1938
+ /**
1939
+ * Parameter name.
1940
+ */
1941
+ name: string;
1942
+ /**
1943
+ * Parameter location (`path`, `query`, `header`, or `cookie`).
1944
+ */
1945
+ in: ParameterLocation;
1946
+ /**
1947
+ * Parameter schema.
1948
+ */
1949
+ schema: SchemaNode;
1950
+ /**
1951
+ * Whether the parameter is required.
1952
+ */
1953
+ required: boolean;
1954
+ };
1955
+ type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>;
1956
+ /**
1957
+ * Definition for the {@link ParameterNode}. `required` defaults to `false`, and the schema's
1958
+ * `optional`/`nullish` flags are derived from it through {@link optionality}.
1959
+ */
1960
+ declare const parameterDef: NodeDef<ParameterNode, UserParameterNode>;
1961
+ /**
1962
+ * Creates a `ParameterNode`.
1963
+ *
1964
+ * @example
1965
+ * ```ts
1966
+ * const param = createParameter({
1967
+ * name: 'petId',
1968
+ * in: 'path',
1969
+ * required: true,
1970
+ * schema: createSchema({ type: 'string' }),
1971
+ * })
1972
+ * ```
1973
+ */
1974
+ declare const createParameter: (input: UserParameterNode) => ParameterNode;
1975
+ //#endregion
1976
+ //#region src/nodes/requestBody.d.ts
1977
+ /**
1978
+ * AST node representing an operation request body.
1979
+ *
1980
+ * Body schemas live exclusively inside the `content` array (one entry per content type),
1981
+ * mirroring {@link ResponseNode}.
1982
+ *
1983
+ * @example
1984
+ * ```ts
1985
+ * const requestBody: RequestBodyNode = {
1986
+ * kind: 'RequestBody',
1987
+ * required: true,
1988
+ * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
1989
+ * }
1990
+ * ```
1991
+ */
1992
+ type RequestBodyNode = BaseNode & {
1993
+ kind: 'RequestBody';
1994
+ /**
1995
+ * Request body description carried over from the spec.
1996
+ */
1997
+ description?: string;
1998
+ /**
1999
+ * Whether the request body is required (`requestBody.required: true` in the spec).
2000
+ * When `false` or absent, the generated `data` parameter should be optional.
2001
+ */
2002
+ required?: boolean;
2003
+ /**
2004
+ * Content type entries for this request body.
2005
+ *
2006
+ * When the adapter `contentType` option is set, this array contains exactly one entry for
2007
+ * that content type. Otherwise it contains one entry per content type declared in the spec,
2008
+ * so plugins can generate code for every variant (for example, separate hooks for
2009
+ * `application/json` and `multipart/form-data`).
2010
+ */
2011
+ content?: Array<ContentNode>;
2012
+ };
2013
+ /**
2014
+ * Definition for the {@link RequestBodyNode}. Content entries are built upfront with
2015
+ * {@link createContent}, mirroring how `parameters` and `responses` take prebuilt nodes.
2016
+ */
2017
+ declare const requestBodyDef: NodeDef<RequestBodyNode, Omit<RequestBodyNode, "kind">>;
2018
+ /**
2019
+ * Creates a `RequestBodyNode`.
2020
+ */
2021
+ declare const createRequestBody: (input: Omit<RequestBodyNode, "kind">) => RequestBodyNode;
2022
+ //#endregion
2023
+ //#region src/nodes/response.d.ts
2024
+ /**
2025
+ * All supported HTTP status code literals as strings, as used in API specs
2026
+ * (for example, `"200"` and `"404"`).
2027
+ */
2028
+ type HttpStatusCode = '100' | '101' | '102' | '103' | '200' | '201' | '202' | '203' | '204' | '205' | '206' | '207' | '208' | '226' | '300' | '301' | '302' | '303' | '304' | '305' | '307' | '308' | '400' | '401' | '402' | '403' | '404' | '405' | '406' | '407' | '408' | '409' | '410' | '411' | '412' | '413' | '414' | '415' | '416' | '417' | '418' | '421' | '422' | '423' | '424' | '425' | '426' | '428' | '429' | '431' | '451' | '500' | '501' | '502' | '503' | '504' | '505' | '506' | '507' | '508' | '510' | '511';
2029
+ /**
2030
+ * Response status code literal used by operations.
2031
+ *
2032
+ * Includes specific HTTP status code strings and `"default"` for catch-all responses.
2033
+ *
2034
+ * @example
2035
+ * ```ts
2036
+ * const status: StatusCode = '200'
2037
+ * const fallback: StatusCode = 'default'
2038
+ * ```
2039
+ */
2040
+ type StatusCode = HttpStatusCode | 'default';
2041
+ /**
2042
+ * AST node representing one operation response variant.
2043
+ *
2044
+ * Mirrors {@link OperationNode.requestBody}: the response body schemas live exclusively inside
2045
+ * the `content` array (one entry per content type), so the same schema is never duplicated at the
2046
+ * node root and inside `content`.
2047
+ *
2048
+ * @example
2049
+ * ```ts
2050
+ * const response: ResponseNode = {
2051
+ * kind: 'Response',
2052
+ * statusCode: '200',
2053
+ * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
2054
+ * }
2055
+ * ```
2056
+ */
2057
+ type ResponseNode = BaseNode & {
2058
+ /**
2059
+ * Node kind.
2060
+ */
2061
+ kind: 'Response';
2062
+ /**
2063
+ * HTTP status code or `'default'` for a fallback response.
2064
+ */
2065
+ statusCode: StatusCode;
2066
+ /**
2067
+ * Optional response description.
2068
+ */
2069
+ description?: string;
2070
+ /**
2071
+ * All available content type entries for this response.
2072
+ *
2073
+ * When the adapter `contentType` option is set, this array contains exactly one entry for that
2074
+ * content type. Otherwise it contains one entry per content type declared in the spec, so that
2075
+ * plugins can generate a union of response types (e.g. `application/json` and `application/xml`).
2076
+ * Body-less responses keep a single entry whose `schema` is the empty/`void` placeholder.
2077
+ *
2078
+ * @example
2079
+ * ```ts
2080
+ * // spec response declares both application/json and application/xml
2081
+ * response.content[0].contentType // 'application/json'
2082
+ * response.content[1].contentType // 'application/xml'
2083
+ * ```
2084
+ */
2085
+ content?: Array<ContentNode>;
2086
+ };
2087
+ type ResponseInput = Pick<ResponseNode, 'statusCode'> & Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'content'>> & {
2088
+ content?: Array<ContentNode>;
2089
+ schema?: SchemaNode;
2090
+ mediaType?: string | null;
2091
+ keysToOmit?: Array<string> | null;
2092
+ };
2093
+ /**
2094
+ * Definition for the {@link ResponseNode}. A single legacy `schema` (with optional
2095
+ * `mediaType`/`keysToOmit`) is normalized into one `content` entry.
2096
+ */
2097
+ declare const responseDef: NodeDef<ResponseNode, ResponseInput>;
2098
+ /**
2099
+ * Creates a `ResponseNode`.
2100
+ *
2101
+ * @example
2102
+ * ```ts
2103
+ * const response = createResponse({
2104
+ * statusCode: '200',
2105
+ * content: [createContent({ contentType: 'application/json', schema: createSchema({ type: 'object', properties: [] }) })],
2106
+ * })
2107
+ * ```
2108
+ */
2109
+ declare const createResponse: (input: ResponseInput) => ResponseNode;
2110
+ //#endregion
2111
+ //#region src/nodes/operation.d.ts
2112
+ /**
2113
+ * HTTP method an operation responds to.
2114
+ */
2115
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE';
2116
+ /**
2117
+ * Transport an operation belongs to.
2118
+ */
2119
+ type OperationProtocol = 'http';
2120
+ /**
2121
+ * Fields shared by every operation, regardless of transport.
2122
+ */
2123
+ type OperationNodeBase = BaseNode & {
2124
+ /**
2125
+ * Node kind.
2126
+ */
2127
+ kind: 'Operation';
2128
+ /**
2129
+ * Operation identifier, usually from OpenAPI `operationId`.
2130
+ */
2131
+ operationId: string;
2132
+ /**
2133
+ * Group labels for the operation.
2134
+ * Usually copied from OpenAPI `tags`.
2135
+ */
2136
+ tags: Array<string>;
2137
+ /**
2138
+ * Short one-line operation summary.
2139
+ */
2140
+ summary?: string;
2141
+ /**
2142
+ * Full operation description.
2143
+ */
2144
+ description?: string;
2145
+ /**
2146
+ * Marks the operation as deprecated.
2147
+ */
2148
+ deprecated?: boolean;
2149
+ /**
2150
+ * Query, path, header, and cookie parameters for the operation.
2151
+ */
2152
+ parameters: Array<ParameterNode>;
2153
+ /**
2154
+ * Request body for the operation.
2155
+ */
2156
+ requestBody?: RequestBodyNode;
2157
+ /**
2158
+ * Operation responses.
2159
+ */
2160
+ responses: Array<ResponseNode>;
2161
+ };
2162
+ /**
2163
+ * Operation served over HTTP/REST (OpenAPI). `method` and `path` are guaranteed.
2164
+ *
2165
+ * @example
2166
+ * ```ts
2167
+ * const operation: HttpOperationNode = {
2168
+ * kind: 'Operation',
2169
+ * operationId: 'listPets',
2170
+ * protocol: 'http',
2171
+ * method: 'GET',
2172
+ * path: '/pets',
2173
+ * tags: [],
2174
+ * parameters: [],
2175
+ * responses: [],
2176
+ * }
2177
+ * ```
2178
+ */
2179
+ type HttpOperationNode = OperationNodeBase & {
2180
+ /**
2181
+ * Transport the operation belongs to.
2182
+ */
2183
+ protocol?: 'http';
2184
+ /**
2185
+ * HTTP method like `'GET'`.
2186
+ */
2187
+ method: HttpMethod;
2188
+ /**
2189
+ * OpenAPI-style path string, for example `/pets/{petId}`, with `{param}` notation preserved.
2190
+ */
2191
+ path: string;
2192
+ };
2193
+ /**
2194
+ * Operation for a non-HTTP transport. HTTP-only fields are forbidden.
2195
+ */
2196
+ type GenericOperationNode = OperationNodeBase & {
2197
+ /**
2198
+ * Transport the operation belongs to.
2199
+ */
2200
+ protocol?: Exclude<OperationProtocol, 'http'>;
2201
+ method?: never;
2202
+ path?: never;
2203
+ };
2204
+ /**
2205
+ * AST node representing one API operation.
2206
+ *
2207
+ * Discriminated on `protocol`: an {@link HttpOperationNode} (`protocol: 'http'`) guarantees
2208
+ * `method` and `path`, while a {@link GenericOperationNode} omits them. Narrow with
2209
+ * `isHttpOperationNode(node)` or `node.protocol === 'http'` before reading `method`/`path`.
2210
+ */
2211
+ type OperationNode = HttpOperationNode | GenericOperationNode;
2212
+ type OperationInput = {
2213
+ operationId: string;
2214
+ method?: HttpOperationNode['method'];
2215
+ path?: HttpOperationNode['path'];
2216
+ requestBody?: Omit<RequestBodyNode, 'kind'>;
2217
+ [key: string]: unknown;
2218
+ };
2219
+ /**
2220
+ * Definition for the {@link OperationNode}. HTTP operations (those carrying both
2221
+ * `method` and `path`) are tagged with `protocol: 'http'`, and the request body is
2222
+ * normalized into a `RequestBodyNode`.
2223
+ */
2224
+ declare const operationDef: NodeDef<OperationNode, OperationInput>;
2225
+ /**
2226
+ * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.
2227
+ *
2228
+ * @example
2229
+ * ```ts
2230
+ * const operation = createOperation({ operationId: 'getPetById', method: 'GET', path: '/pet/{petId}' })
2231
+ * // tags, parameters, and responses are []
2232
+ * ```
2233
+ */
2234
+ declare function createOperation(props: Pick<HttpOperationNode, 'operationId' | 'method' | 'path'> & Partial<Omit<HttpOperationNode, 'kind' | 'operationId' | 'method' | 'path' | 'requestBody'>> & {
2235
+ requestBody?: Omit<RequestBodyNode, 'kind'>;
2236
+ }): HttpOperationNode;
2237
+ declare function createOperation(props: Pick<GenericOperationNode, 'operationId'> & Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {
2238
+ requestBody?: Omit<RequestBodyNode, 'kind'>;
2239
+ }): GenericOperationNode;
2240
+ //#endregion
2241
+ //#region src/nodes/input.d.ts
2242
+ /**
2243
+ * Metadata for an API document, populated by the adapter and available to every generator.
2244
+ *
2245
+ * All fields are plain JSON-serializable values, no `Set`, no `Map`, no class instances.
2246
+ * Computed fields (`circularNames`, `enumNames`) are pre-calculated once during the adapter
2247
+ * pre-scan so generators never need to iterate the full schema list themselves.
2248
+ *
2249
+ * @example
2250
+ * ```ts
2251
+ * const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://petstore.swagger.io/v2', circularNames: [], enumNames: [] }
2252
+ * ```
2253
+ */
2254
+ type InputMeta = {
2255
+ /**
2256
+ * API title from `info.title` in the source document.
2257
+ */
2258
+ title?: string;
2259
+ /**
2260
+ * API description from `info.description` in the source document.
2261
+ */
2262
+ description?: string;
2263
+ /**
2264
+ * API version string from `info.version` in the source document.
2265
+ */
2266
+ version?: string;
2267
+ /**
2268
+ * Resolved base URL from the first matching server entry in the source document.
2269
+ */
2270
+ baseURL?: string | null;
2271
+ /**
2272
+ * Names of schemas that participate in a circular reference chain.
2273
+ * Computed once during the adapter pre-scan, so a generator never has to
2274
+ * call `findCircularSchemas` itself.
2275
+ *
2276
+ * Convert to a `Set` once at the start of a generator, not per-schema,
2277
+ * so lookups stay O(1) without repeated allocations.
2278
+ *
2279
+ * @example Wrap a circular schema in z.lazy()
2280
+ * ```ts
2281
+ * const circular = new Set(meta.circularNames)
2282
+ * if (circular.has(schema.name)) { ... }
2283
+ * ```
2284
+ */
2285
+ circularNames: ReadonlyArray<string>;
2286
+ /**
2287
+ * Names of schemas whose type is `enum`.
2288
+ * Computed once during the adapter pre-scan, so a generator never has to
2289
+ * filter the schema list itself.
2290
+ *
2291
+ * Convert to a `Set` once at the start of a generator when you need repeated
2292
+ * membership checks, so each check stays O(1) instead of an array scan.
2293
+ *
2294
+ * @example Check if a referenced schema is an enum
2295
+ * `const enums = new Set(meta.enumNames)`
2296
+ * `const isEnum = enums.has(schemaName)`
2297
+ */
2298
+ enumNames: ReadonlyArray<string>;
2299
+ };
2300
+ /**
2301
+ * Input AST node that contains all schemas and operations for one API document.
2302
+ * Produced by the adapter and consumed by all Kubb plugins.
2303
+ *
2304
+ * `Stream` switches `schemas` and `operations` between eager `Array`s (the default) and lazy
2305
+ * `AsyncIterable`s. The streaming variant `InputNode<true>` yields nodes one at a time.
2306
+ *
2307
+ * @example
2308
+ * ```ts
2309
+ * const input: InputNode = {
2310
+ * kind: 'Input',
2311
+ * schemas: [],
2312
+ * operations: [],
2313
+ * meta: { circularNames: [], enumNames: [] },
2314
+ * }
2315
+ * ```
2316
+ *
2317
+ * @example Streaming variant for large specs
2318
+ * ```ts
2319
+ * for await (const schema of inputNode.schemas) {
2320
+ * // only this one SchemaNode is live here. Previous ones are GC-eligible
2321
+ * }
2322
+ * ```
2323
+ */
2324
+ type InputNode<Stream extends boolean = false> = BaseNode & {
2325
+ /**
2326
+ * Node kind.
2327
+ */
2328
+ kind: 'Input';
2329
+ /**
2330
+ * All schema nodes in the document.
2331
+ */
2332
+ schemas: Streamable<SchemaNode, Stream>;
2333
+ /**
2334
+ * All operation nodes in the document.
2335
+ */
2336
+ operations: Streamable<OperationNode, Stream>;
2337
+ /**
2338
+ * Document metadata populated by the adapter.
2339
+ */
2340
+ meta: InputMeta;
2341
+ };
2342
+ /**
2343
+ * Definition for the {@link InputNode}.
2344
+ */
2345
+ declare const inputDef: NodeDef<InputNode<false>, Partial<Omit<InputNode<false>, "kind">>>;
2346
+ /**
2347
+ * Creates an `InputNode`. Pass `stream: true` for the streaming variant whose `schemas` and
2348
+ * `operations` are `AsyncIterable` sources. Otherwise it builds the eager variant with array
2349
+ * `schemas`/`operations`. Both variants get the defaulted `meta`.
2350
+ *
2351
+ * @example Eager
2352
+ * ```ts
2353
+ * const input = createInput()
2354
+ * // { kind: 'Input', schemas: [], operations: [] }
2355
+ * ```
2356
+ *
2357
+ * @example Streaming
2358
+ * ```ts
2359
+ * const node = createInput({ stream: true, schemas: schemasIterable, operations: operationsIterable, meta: { title: 'My API' } })
2360
+ * ```
2361
+ */
2362
+ declare function createInput<Stream extends boolean = false>(options?: Partial<Omit<InputNode<Stream>, 'kind'>> & {
2363
+ stream?: Stream;
2364
+ }): InputNode<Stream>;
2365
+ //#endregion
2366
+ //#region src/nodes/output.d.ts
2367
+ /**
2368
+ * Output AST node that groups all generated file output for one API document.
2369
+ *
2370
+ * Produced by generators and consumed by the build pipeline to write files.
2371
+ *
2372
+ * @example
2373
+ * ```ts
2374
+ * const output: OutputNode = {
2375
+ * kind: 'Output',
2376
+ * files: [],
2377
+ * }
2378
+ * ```
2379
+ */
2380
+ type OutputNode = BaseNode & {
2381
+ /**
2382
+ * Node kind.
2383
+ */
2384
+ kind: 'Output';
2385
+ /**
2386
+ * Generated file nodes.
2387
+ */
2388
+ files: Array<FileNode>;
2389
+ };
2390
+ /**
2391
+ * Definition for the {@link OutputNode}.
2392
+ */
2393
+ declare const outputDef: NodeDef<OutputNode, Partial<Omit<OutputNode, "kind">>>;
2394
+ /**
2395
+ * Creates an `OutputNode` with a stable default for `files`.
2396
+ *
2397
+ * @example
2398
+ * ```ts
2399
+ * const output = createOutput()
2400
+ * // { kind: 'Output', files: [] }
2401
+ * ```
2402
+ */
2403
+ declare function createOutput(overrides?: Partial<Omit<OutputNode, 'kind'>>): OutputNode;
2404
+ //#endregion
2405
+ //#region src/nodes/index.d.ts
2406
+ /**
2407
+ * Union of all AST node types.
2408
+ *
2409
+ * This lets TypeScript narrow types in `switch (node.kind)` blocks.
2410
+ *
2411
+ * @example
2412
+ * ```ts
2413
+ * function getKind(node: Node): string {
2414
+ * switch (node.kind) {
2415
+ * case 'Input':
2416
+ * return 'input'
2417
+ * case 'Output':
2418
+ * return 'output'
2419
+ * default:
2420
+ * return 'other'
2421
+ * }
2422
+ * }
2423
+ * ```
2424
+ */
2425
+ type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FunctionParamNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | FunctionNode | ArrowFunctionNode;
2426
+ //#endregion
2427
+ export { exportDef as $, textDef as $t, IndexedAccessTypeNode as A, InferSchemaNode as At, functionParametersDef as B, TypeNode as Bt, ParameterNode as C, UrlSchemaNode as Ct, FunctionParamNode as D, UserPropertyNode as Dt, FunctionParamKind as E, PropertyNode as Et, createFunctionParameters as F, ConstNode as Ft, FileNode as G, createBreak as Gt, objectBindingPatternDef as H, breakDef as Ht, createIndexedAccessType as I, FunctionNode as It, UserFileNode as J, createJsx as Jt, ImportNode as K, createConst as Kt, createObjectBindingPattern as L, JSDocNode as Lt, TypeExpression as M, ArrowFunctionNode as Mt, TypeLiteralNode as N, BreakNode as Nt, FunctionParameterNode as O, createProperty as Ot, createFunctionParameter as P, CodeNode as Pt, createSource as Q, jsxDef as Qt, createTypeLiteral as R, JsxNode as Rt, ParameterLocation as S, UnionSchemaNode as St, parameterDef as T, schemaDef as Tt, typeLiteralDef as U, constDef as Ut, indexedAccessTypeDef as V, arrowFunctionDef as Vt, ExportNode as W, createArrowFunction as Wt, createFile as X, createType as Xt, createExport as Y, createText as Yt, createImport as Z, functionDef as Zt, createResponse as _, SchemaNode as _t, InputMeta as a, NodeKind as an, createContent as at, createRequestBody as b, StringSchemaNode as bt, inputDef as c, DatetimeSchemaNode as ct, HttpOperationNode as d, NumberSchemaNode as dt, typeDef as en, fileDef as et, OperationNode as f, ObjectSchemaNode as ft, StatusCode as g, ScalarSchemaType as gt, ResponseNode as h, ScalarSchemaNode as ht, outputDef as i, BaseNode as in, contentDef as it, ObjectBindingPatternNode as j, ParserOptions as jt, FunctionParametersNode as k, propertyDef as kt, GenericOperationNode as l, EnumSchemaNode as lt, operationDef as m, RefSchemaNode as mt, OutputNode as n, NodeDef as nn, sourceDef as nt, InputNode as o, ArraySchemaNode as ot, createOperation as p, PrimitiveSchemaType as pt, SourceNode as q, createFunction as qt, createOutput as r, defineNode as rn, ContentNode as rt, createInput as s, DateSchemaNode as st, Node as t, DistributiveOmit as tn, importDef as tt, HttpMethod as u, IntersectionSchemaNode as ut, responseDef as v, SchemaNodeByType as vt, createParameter as w, createSchema as wt, requestBodyDef as x, TimeSchemaNode as xt, RequestBodyNode as y, SchemaType as yt, functionParameterDef as z, TextNode as zt };
2428
+ //# sourceMappingURL=index-DJEyS5y6.d.ts.map