@kubb/ast 5.0.0-beta.32 → 5.0.0-beta.33

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.
@@ -0,0 +1,3605 @@
1
+ import { t as __name } from "./chunk-C0LytTxp.js";
2
+
3
+ //#region src/constants.d.ts
4
+ /**
5
+ * Traversal depth for AST visitor utilities.
6
+ *
7
+ * - `'shallow'` — visits only the immediate node, skipping children.
8
+ * - `'deep'` — recursively visits all descendant nodes.
9
+ */
10
+ type VisitorDepth = 'shallow' | 'deep';
11
+ /**
12
+ * Schema type discriminators used by all AST schema nodes.
13
+ *
14
+ * These values serve as stable discriminators across the AST (e.g., `schema.type === schemaTypes.object`).
15
+ * Grouped by category: primitives (`string`, `number`, `boolean`), structural types (`object`, `array`, `union`),
16
+ * and format-specific types (`date`, `uuid`, `email`). Use `isScalarPrimitive()` to check for scalar types.
17
+ */
18
+ declare const schemaTypes: {
19
+ /**
20
+ * Text value.
21
+ */
22
+ readonly string: "string";
23
+ /**
24
+ * Floating-point number (`float`, `double`).
25
+ */
26
+ readonly number: "number";
27
+ /**
28
+ * Whole number (`int32`). Use `bigint` for `int64`.
29
+ */
30
+ readonly integer: "integer";
31
+ /**
32
+ * 64-bit integer (`int64`). Only used when `integerType` is set to `'bigint'`.
33
+ */
34
+ readonly bigint: "bigint";
35
+ /**
36
+ * Boolean value
37
+ */
38
+ readonly boolean: "boolean";
39
+ /**
40
+ * Explicit null value.
41
+ */
42
+ readonly null: "null";
43
+ /**
44
+ * Any value (no type restriction).
45
+ */
46
+ readonly any: "any";
47
+ /**
48
+ * Unknown value (must be narrowed before usage).
49
+ */
50
+ readonly unknown: "unknown";
51
+ /**
52
+ * No return value (`void`).
53
+ */
54
+ readonly void: "void";
55
+ /**
56
+ * Object with named properties.
57
+ */
58
+ readonly object: "object";
59
+ /**
60
+ * Sequential list of items.
61
+ */
62
+ readonly array: "array";
63
+ /**
64
+ * Fixed-length list with position-specific items.
65
+ */
66
+ readonly tuple: "tuple";
67
+ /**
68
+ * "One of" multiple schema members.
69
+ */
70
+ readonly union: "union";
71
+ /**
72
+ * "All of" multiple schema members.
73
+ */
74
+ readonly intersection: "intersection";
75
+ /**
76
+ * Enum schema.
77
+ */
78
+ readonly enum: "enum";
79
+ /**
80
+ * Reference to another schema.
81
+ */
82
+ readonly ref: "ref";
83
+ /**
84
+ * Calendar date (for example `2026-03-24`).
85
+ */
86
+ readonly date: "date";
87
+ /**
88
+ * Date-time value (for example `2026-03-24T09:00:00Z`).
89
+ */
90
+ readonly datetime: "datetime";
91
+ /**
92
+ * Time-only value (for example `09:00:00`).
93
+ */
94
+ readonly time: "time";
95
+ /**
96
+ * UUID value.
97
+ */
98
+ readonly uuid: "uuid";
99
+ /**
100
+ * Email address value.
101
+ */
102
+ readonly email: "email";
103
+ /**
104
+ * URL value.
105
+ */
106
+ readonly url: "url";
107
+ /**
108
+ * IPv4 address value.
109
+ */
110
+ readonly ipv4: "ipv4";
111
+ /**
112
+ * IPv6 address value.
113
+ */
114
+ readonly ipv6: "ipv6";
115
+ /**
116
+ * Binary/blob value.
117
+ */
118
+ readonly blob: "blob";
119
+ /**
120
+ * Impossible value (`never`).
121
+ */
122
+ readonly never: "never";
123
+ };
124
+ type ScalarPrimitive = 'string' | 'number' | 'integer' | 'bigint' | 'boolean';
125
+ /**
126
+ * HTTP method identifiers used by operation nodes.
127
+ *
128
+ * Includes all standard HTTP methods (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE).
129
+ */
130
+ declare const httpMethods: {
131
+ readonly get: "GET";
132
+ readonly post: "POST";
133
+ readonly put: "PUT";
134
+ readonly patch: "PATCH";
135
+ readonly delete: "DELETE";
136
+ readonly head: "HEAD";
137
+ readonly options: "OPTIONS";
138
+ readonly trace: "TRACE";
139
+ };
140
+ //#endregion
141
+ //#region src/nodes/base.d.ts
142
+ /**
143
+ * `kind` values used by AST nodes.
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * const kind: NodeKind = 'Schema'
148
+ * ```
149
+ */
150
+ type NodeKind = 'Input' | 'Output' | 'Operation' | 'Schema' | 'Property' | 'Parameter' | 'Response' | 'RequestBody' | 'Content' | 'FunctionParameter' | 'ParameterGroup' | 'FunctionParameters' | 'Type' | 'ParamsType' | 'File' | 'Import' | 'Export' | 'Source' | 'Const' | 'Function' | 'ArrowFunction' | 'Text' | 'Break' | 'Jsx';
151
+ /**
152
+ * Base shape shared by all AST nodes.
153
+ *
154
+ * @example
155
+ * ```ts
156
+ * const base: BaseNode = { kind: 'Input' }
157
+ * ```
158
+ */
159
+ type BaseNode = {
160
+ /**
161
+ * Node discriminator.
162
+ */
163
+ kind: NodeKind;
164
+ };
165
+ //#endregion
166
+ //#region src/nodes/code.d.ts
167
+ /**
168
+ * JSDoc documentation metadata attached to code declarations.
169
+ */
170
+ type JSDocNode = {
171
+ /**
172
+ * JSDoc comment lines. `undefined` entries are filtered out during rendering.
173
+ * @example ['@description A pet resource', '@deprecated']
174
+ */
175
+ comments?: Array<string | undefined>;
176
+ };
177
+ /**
178
+ * AST node representing a TypeScript `const` declaration.
179
+ *
180
+ * Mirrors the props of the `Const` component from `@kubb/renderer-jsx`.
181
+ * The `children` prop of the component is represented as `nodes`.
182
+ *
183
+ * @example
184
+ * ```ts
185
+ * createConst({ name: 'pet', export: true, asConst: true })
186
+ * // export const pet = ... as const
187
+ * ```
188
+ */
189
+ type ConstNode = BaseNode & {
190
+ /**
191
+ * Node kind.
192
+ */
193
+ kind: 'Const';
194
+ /**
195
+ * Name of the constant declaration.
196
+ */
197
+ name: string;
198
+ /**
199
+ * Whether the declaration should be exported.
200
+ * @default false
201
+ */
202
+ export?: boolean | null;
203
+ /**
204
+ * Optional explicit type annotation.
205
+ * @example 'Pet'
206
+ */
207
+ type?: string | null;
208
+ /**
209
+ * JSDoc documentation metadata.
210
+ */
211
+ JSDoc?: JSDocNode | null;
212
+ /**
213
+ * Whether to append `as const` to the declaration.
214
+ * @default false
215
+ */
216
+ asConst?: boolean | null;
217
+ /**
218
+ * Child nodes representing the value of the constant (children of the `Const` component).
219
+ * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
220
+ */
221
+ nodes?: Array<CodeNode>;
222
+ };
223
+ /**
224
+ * AST node representing a TypeScript `type` alias declaration.
225
+ *
226
+ * Mirrors the props of the `Type` component from `@kubb/renderer-jsx`.
227
+ * The `children` prop of the component is represented as `nodes`.
228
+ *
229
+ * @example
230
+ * ```ts
231
+ * createType({ name: 'Pet', export: true })
232
+ * // export type Pet = ...
233
+ * ```
234
+ */
235
+ type TypeNode = BaseNode & {
236
+ /**
237
+ * Node kind.
238
+ */
239
+ kind: 'Type';
240
+ /**
241
+ * Name of the type alias.
242
+ */
243
+ name: string;
244
+ /**
245
+ * Whether the declaration should be exported.
246
+ * @default false
247
+ */
248
+ export?: boolean | null;
249
+ /**
250
+ * JSDoc documentation metadata.
251
+ */
252
+ JSDoc?: JSDocNode | null;
253
+ /**
254
+ * Child nodes representing the type body (children of the `Type` component).
255
+ * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
256
+ */
257
+ nodes?: Array<CodeNode>;
258
+ };
259
+ /**
260
+ * Convenience alias for {@link TypeNode}.
261
+ * @deprecated Use `TypeNode` directly.
262
+ */
263
+ type TypeDeclarationNode = TypeNode;
264
+ /**
265
+ * AST node representing a TypeScript `function` declaration.
266
+ *
267
+ * Mirrors the props of the `Function` component from `@kubb/renderer-jsx`.
268
+ * The `children` prop of the component is represented as `nodes`.
269
+ *
270
+ * @example
271
+ * ```ts
272
+ * createFunctionDeclaration({ name: 'getPet', export: true, async: true, returnType: 'Pet' })
273
+ * // export async function getPet(): Promise<Pet> { ... }
274
+ * ```
275
+ */
276
+ type FunctionNode = BaseNode & {
277
+ /**
278
+ * Node kind.
279
+ */
280
+ kind: 'Function';
281
+ /**
282
+ * Name of the function.
283
+ */
284
+ name: string;
285
+ /**
286
+ * Whether the function is a default export.
287
+ * @default false
288
+ */
289
+ default?: boolean | null;
290
+ /**
291
+ * Function parameter list rendered as a string (e.g. from `FunctionParams.toConstructor()`).
292
+ */
293
+ params?: string | null;
294
+ /**
295
+ * Whether the function should be exported.
296
+ * @default false
297
+ */
298
+ export?: boolean | null;
299
+ /**
300
+ * Whether the function is async. When `true`, the return type is wrapped in `Promise<>`.
301
+ * @default false
302
+ */
303
+ async?: boolean | null;
304
+ /**
305
+ * TypeScript generic type parameters.
306
+ * @example ['T', 'U extends string']
307
+ */
308
+ generics?: string | Array<string> | null;
309
+ /**
310
+ * Return type annotation.
311
+ * @example 'Pet'
312
+ */
313
+ returnType?: string | null;
314
+ /**
315
+ * JSDoc documentation metadata.
316
+ */
317
+ JSDoc?: JSDocNode | null;
318
+ /**
319
+ * Child nodes representing the function body (children of the `Function` component).
320
+ * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
321
+ */
322
+ nodes?: Array<CodeNode>;
323
+ };
324
+ /**
325
+ * AST node representing a TypeScript arrow function (`const name = () => { ... }`).
326
+ *
327
+ * Mirrors the props of the `Function.Arrow` component from `@kubb/renderer-jsx`.
328
+ * The `children` prop of the component is represented as `nodes`.
329
+ *
330
+ * @example
331
+ * ```ts
332
+ * createArrowFunctionDeclaration({ name: 'getPet', export: true, singleLine: true })
333
+ * // export const getPet = () => ...
334
+ * ```
335
+ */
336
+ type ArrowFunctionNode = BaseNode & {
337
+ /**
338
+ * Node kind.
339
+ */
340
+ kind: 'ArrowFunction';
341
+ /**
342
+ * Name of the arrow function (used as the `const` variable name).
343
+ */
344
+ name: string;
345
+ /**
346
+ * Whether the function is a default export.
347
+ * @default false
348
+ */
349
+ default?: boolean | null;
350
+ /**
351
+ * Function parameter list rendered as a string (e.g. from `FunctionParams.toConstructor()`).
352
+ */
353
+ params?: string | null;
354
+ /**
355
+ * Whether the arrow function should be exported.
356
+ * @default false
357
+ */
358
+ export?: boolean | null;
359
+ /**
360
+ * Whether the arrow function is async. When `true`, the return type is wrapped in `Promise<>`.
361
+ * @default false
362
+ */
363
+ async?: boolean | null;
364
+ /**
365
+ * TypeScript generic type parameters.
366
+ * @example ['T', 'U extends string']
367
+ */
368
+ generics?: string | Array<string> | null;
369
+ /**
370
+ * Return type annotation.
371
+ * @example 'Pet'
372
+ */
373
+ returnType?: string | null;
374
+ /**
375
+ * JSDoc documentation metadata.
376
+ */
377
+ JSDoc?: JSDocNode | null;
378
+ /**
379
+ * Render the arrow function body as a single-line expression.
380
+ * @default false
381
+ */
382
+ singleLine?: boolean | null;
383
+ /**
384
+ * Child nodes representing the function body (children of the `Function.Arrow` component).
385
+ * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
386
+ */
387
+ nodes?: Array<CodeNode>;
388
+ };
389
+ /**
390
+ * AST node representing a raw text/string fragment in the source output.
391
+ *
392
+ * Used instead of bare `string` values so that all entries in `nodes` arrays
393
+ * are typed `CodeNode` objects rather than a mixed `CodeNode | string` union.
394
+ *
395
+ * @example
396
+ * ```ts
397
+ * createText('return fetch(id)')
398
+ * // { kind: 'Text', value: 'return fetch(id)' }
399
+ * ```
400
+ */
401
+ type TextNode = BaseNode & {
402
+ /**
403
+ * Node kind.
404
+ */
405
+ kind: 'Text';
406
+ /**
407
+ * The raw string content.
408
+ */
409
+ value: string;
410
+ };
411
+ /**
412
+ * AST node representing a line break in the source output.
413
+ *
414
+ * Corresponds to `<br/>` in JSX components. When printed, produces an empty
415
+ * string that — joined with `\n` by `printNodes` — creates a blank line
416
+ * between surrounding code nodes.
417
+ *
418
+ * @example
419
+ * ```ts
420
+ * createBreak()
421
+ * // { kind: 'Break' }
422
+ * // prints as '' → blank line when surrounded by other nodes
423
+ * ```
424
+ */
425
+ type BreakNode = BaseNode & {
426
+ /**
427
+ * Node kind.
428
+ */
429
+ kind: 'Break';
430
+ };
431
+ /**
432
+ * AST node representing a raw JSX fragment in the source output.
433
+ *
434
+ * Mirrors the `Jsx` component from `@kubb/renderer-jsx`. Use this to embed raw
435
+ * JSX/TSX markup (including fragments `<>…</>`) directly in generated code.
436
+ *
437
+ * @example
438
+ * ```ts
439
+ * createJsx('<>\n <a href={href}>Open</a>\n</>')
440
+ * // { kind: 'Jsx', value: '<>\n <a href={href}>Open</a>\n</>' }
441
+ * ```
442
+ */
443
+ type JsxNode = BaseNode & {
444
+ /**
445
+ * Node kind.
446
+ */
447
+ kind: 'Jsx';
448
+ /**
449
+ * The raw JSX string content.
450
+ */
451
+ value: string;
452
+ };
453
+ /**
454
+ * Union of all code-generation AST nodes.
455
+ *
456
+ * These nodes mirror the JSX components from `@kubb/renderer-jsx` and are used as
457
+ * structured children in {@link SourceNode.nodes}.
458
+ */
459
+ type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
460
+ //#endregion
461
+ //#region src/nodes/property.d.ts
462
+ /**
463
+ * AST node representing one named object property.
464
+ *
465
+ * @example
466
+ * ```ts
467
+ * const property: PropertyNode = {
468
+ * kind: 'Property',
469
+ * name: 'id',
470
+ * schema: createSchema({ type: 'integer' }),
471
+ * required: true,
472
+ * }
473
+ * ```
474
+ */
475
+ type PropertyNode = BaseNode & {
476
+ /**
477
+ * Node kind.
478
+ */
479
+ kind: 'Property';
480
+ /**
481
+ * Property key.
482
+ */
483
+ name: string;
484
+ /**
485
+ * Property schema.
486
+ */
487
+ schema: SchemaNode;
488
+ /**
489
+ * Whether the property is required.
490
+ */
491
+ required: boolean;
492
+ };
493
+ //#endregion
494
+ //#region src/nodes/schema.d.ts
495
+ type PrimitiveSchemaType =
496
+ /**
497
+ * Text value.
498
+ */
499
+ 'string'
500
+ /**
501
+ * Floating-point number.
502
+ */
503
+ | 'number'
504
+ /**
505
+ * Integer number.
506
+ */
507
+ | 'integer'
508
+ /**
509
+ * Big integer number.
510
+ */
511
+ | 'bigint'
512
+ /**
513
+ * Boolean value.
514
+ */
515
+ | 'boolean'
516
+ /**
517
+ * Null value.
518
+ */
519
+ | 'null'
520
+ /**
521
+ * Any value.
522
+ */
523
+ | 'any'
524
+ /**
525
+ * Unknown value.
526
+ */
527
+ | 'unknown'
528
+ /**
529
+ * No value (`void`).
530
+ */
531
+ | 'void'
532
+ /**
533
+ * Never value.
534
+ */
535
+ | 'never'
536
+ /**
537
+ * Object value.
538
+ */
539
+ | 'object'
540
+ /**
541
+ * Array value.
542
+ */
543
+ | 'array'
544
+ /**
545
+ * Date value.
546
+ */
547
+ | 'date';
548
+ /**
549
+ * Composite schema types.
550
+ */
551
+ type ComplexSchemaType = 'tuple' | 'union' | 'intersection' | 'enum';
552
+ /**
553
+ * Schema types that need special handling in generators.
554
+ */
555
+ type SpecialSchemaType = 'ref' | 'datetime' | 'time' | 'uuid' | 'email' | 'url' | 'ipv4' | 'ipv6' | 'blob';
556
+ /**
557
+ * All schema type strings.
558
+ */
559
+ type SchemaType = PrimitiveSchemaType | ComplexSchemaType | SpecialSchemaType;
560
+ /**
561
+ * Scalar schema types without extra object/array/ref structure.
562
+ */
563
+ type ScalarSchemaType = Exclude<SchemaType, 'object' | 'array' | 'tuple' | 'union' | 'intersection' | 'enum' | 'ref' | 'datetime' | 'date' | 'time' | 'string' | 'number' | 'integer' | 'bigint' | 'url' | 'uuid' | 'email'>;
564
+ /**
565
+ * Fields shared by all schema nodes.
566
+ */
567
+ type SchemaNodeBase = BaseNode & {
568
+ /**
569
+ * Node kind.
570
+ */
571
+ kind: 'Schema';
572
+ /**
573
+ * Schema name for named definitions (for example, `"Pet"`).
574
+ * Inline schemas omit this field.
575
+ * `null` means kubb has processed this and determined there is no applicable name.
576
+ * `undefined` means the name has not been set yet.
577
+ */
578
+ name?: string | null;
579
+ /**
580
+ * Short schema title.
581
+ */
582
+ title?: string;
583
+ /**
584
+ * Schema description text.
585
+ */
586
+ description?: string;
587
+ /**
588
+ * Whether `null` is allowed.
589
+ */
590
+ nullable?: boolean;
591
+ /**
592
+ * Whether the field is optional.
593
+ */
594
+ optional?: boolean;
595
+ /**
596
+ * Both optional and nullable (`optional` + `nullable`).
597
+ */
598
+ nullish?: boolean;
599
+ /**
600
+ * Whether the schema is deprecated.
601
+ */
602
+ deprecated?: boolean;
603
+ /**
604
+ * Whether the schema is read-only.
605
+ */
606
+ readOnly?: boolean;
607
+ /**
608
+ * Whether the schema is write-only.
609
+ */
610
+ writeOnly?: boolean;
611
+ /**
612
+ * Default value.
613
+ */
614
+ default?: unknown;
615
+ /**
616
+ * Example value.
617
+ */
618
+ example?: unknown;
619
+ /**
620
+ * Base primitive type.
621
+ * For example, this is `'string'` for a `uuid` schema.
622
+ */
623
+ primitive?: PrimitiveSchemaType;
624
+ /**
625
+ * Schema `format` value.
626
+ */
627
+ format?: string;
628
+ };
629
+ /**
630
+ * Object schema with ordered properties.
631
+ *
632
+ * @example
633
+ * ```ts
634
+ * const objectSchema: ObjectSchemaNode = {
635
+ * kind: 'Schema',
636
+ * type: 'object',
637
+ * properties: [],
638
+ * }
639
+ * ```
640
+ */
641
+ type ObjectSchemaNode = SchemaNodeBase & {
642
+ /**
643
+ * Schema type discriminator.
644
+ */
645
+ type: 'object';
646
+ /**
647
+ * Primitive type — always `'object'` for object schemas.
648
+ */
649
+ primitive: 'object';
650
+ /**
651
+ * Ordered object properties.
652
+ */
653
+ properties: Array<PropertyNode>;
654
+ /**
655
+ * Additional object properties behavior:
656
+ * - `true`: allow any value
657
+ * - `false`: reject unknown properties (maps to `.strict()` in Zod)
658
+ * - `SchemaNode`: allow values that match that schema
659
+ * - `undefined`: no additional properties constraint (open object)
660
+ */
661
+ additionalProperties?: SchemaNode | boolean;
662
+ /**
663
+ * Pattern-based property schemas.
664
+ */
665
+ patternProperties?: Record<string, SchemaNode>;
666
+ /**
667
+ * Minimum number of properties allowed.
668
+ */
669
+ minProperties?: number;
670
+ /**
671
+ * Maximum number of properties allowed.
672
+ */
673
+ maxProperties?: number;
674
+ };
675
+ /**
676
+ * Array-like schema (`array` or `tuple`).
677
+ *
678
+ * @example
679
+ * ```ts
680
+ * const arraySchema: ArraySchemaNode = {
681
+ * kind: 'Schema',
682
+ * type: 'array',
683
+ * items: [],
684
+ * }
685
+ * ```
686
+ */
687
+ type ArraySchemaNode = SchemaNodeBase & {
688
+ /**
689
+ * Schema type discriminator (`array` or `tuple`).
690
+ */
691
+ type: 'array' | 'tuple';
692
+ /**
693
+ * Item schemas.
694
+ */
695
+ items?: Array<SchemaNode>;
696
+ /**
697
+ * Tuple rest-item schema for elements beyond positional `items`.
698
+ */
699
+ rest?: SchemaNode;
700
+ /**
701
+ * Minimum item count (or tuple length).
702
+ */
703
+ min?: number;
704
+ /**
705
+ * Maximum item count (or tuple length).
706
+ */
707
+ max?: number;
708
+ /**
709
+ * Whether all items must be unique.
710
+ */
711
+ unique?: boolean;
712
+ };
713
+ /**
714
+ * Shared shape for union and intersection schemas.
715
+ */
716
+ type CompositeSchemaNodeBase = SchemaNodeBase & {
717
+ /**
718
+ * Member schemas.
719
+ */
720
+ members?: Array<SchemaNode>;
721
+ };
722
+ /**
723
+ * Union schema, often from `oneOf` or `anyOf`.
724
+ *
725
+ * @example
726
+ * ```ts
727
+ * const unionSchema: UnionSchemaNode = {
728
+ * kind: 'Schema',
729
+ * type: 'union',
730
+ * members: [],
731
+ * }
732
+ * ```
733
+ */
734
+ type UnionSchemaNode = CompositeSchemaNodeBase & {
735
+ /**
736
+ * Schema type discriminator.
737
+ */
738
+ type: 'union';
739
+ /**
740
+ * Discriminator property name from OpenAPI `discriminator.propertyName`.
741
+ */
742
+ discriminatorPropertyName?: string;
743
+ /**
744
+ * Logical strategy applied to union members: 'one' means exactly one member must be valid (from `oneOf`),
745
+ * 'any' means any number of members can be valid (from `anyOf`).
746
+ */
747
+ strategy?: 'one' | 'any';
748
+ };
749
+ /**
750
+ * Intersection schema, often from `allOf`.
751
+ *
752
+ * @example
753
+ * ```ts
754
+ * const intersectionSchema: IntersectionSchemaNode = {
755
+ * kind: 'Schema',
756
+ * type: 'intersection',
757
+ * members: [],
758
+ * }
759
+ * ```
760
+ */
761
+ type IntersectionSchemaNode = CompositeSchemaNodeBase & {
762
+ /**
763
+ * Schema type discriminator.
764
+ */
765
+ type: 'intersection';
766
+ };
767
+ /**
768
+ * One named enum item.
769
+ */
770
+ type EnumValueNode = {
771
+ /**
772
+ * Enum item name.
773
+ */
774
+ name: string;
775
+ /**
776
+ * Enum item value.
777
+ */
778
+ value: string | number | boolean;
779
+ /**
780
+ * Primitive type of the enum value.
781
+ */
782
+ primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>;
783
+ };
784
+ /**
785
+ * Enum schema node.
786
+ *
787
+ * @example
788
+ * ```ts
789
+ * const enumSchema: EnumSchemaNode = {
790
+ * kind: 'Schema',
791
+ * type: 'enum',
792
+ * enumValues: ['a', 'b'],
793
+ * }
794
+ * ```
795
+ */
796
+ type EnumSchemaNode = SchemaNodeBase & {
797
+ /**
798
+ * Schema type discriminator.
799
+ */
800
+ type: 'enum';
801
+ /**
802
+ * Enum values in simple form.
803
+ */
804
+ enumValues?: Array<string | number | boolean | null>;
805
+ /**
806
+ * Enum values in named form.
807
+ * If present, this is used instead of `enumValues`.
808
+ */
809
+ namedEnumValues?: Array<EnumValueNode>;
810
+ };
811
+ /**
812
+ * Reference schema that points to another schema definition.
813
+ *
814
+ * @example
815
+ * ```ts
816
+ * const refSchema: RefSchemaNode = {
817
+ * kind: 'Schema',
818
+ * type: 'ref',
819
+ * ref: '#/components/schemas/Pet',
820
+ * }
821
+ * ```
822
+ */
823
+ type RefSchemaNode = SchemaNodeBase & {
824
+ /**
825
+ * Schema type discriminator.
826
+ */
827
+ type: 'ref';
828
+ /**
829
+ * Referenced schema name.
830
+ * `null` means Kubb has processed this and determined there is no applicable name.
831
+ */
832
+ name?: string | null;
833
+ /**
834
+ * Original `$ref` path, for example, `#/components/schemas/Order`.
835
+ * Used to resolve names later.
836
+ */
837
+ ref?: string;
838
+ /**
839
+ * Pattern copied from a sibling `pattern` field.
840
+ */
841
+ pattern?: string;
842
+ /**
843
+ * The fully-parsed schema that this ref resolves to.
844
+ * Populated during OAS parsing when the referenced definition can be resolved.
845
+ * `null` when the ref cannot be resolved or is part of a circular chain.
846
+ * `undefined` when resolution has not been attempted.
847
+ *
848
+ * Useful for inspecting the referenced schema's structure (e.g. `primitive`, `properties`)
849
+ * without following the reference manually.
850
+ */
851
+ schema?: SchemaNode | null;
852
+ };
853
+ /**
854
+ * Datetime schema.
855
+ *
856
+ * @example
857
+ * ```ts
858
+ * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }
859
+ * ```
860
+ */
861
+ type DatetimeSchemaNode = SchemaNodeBase & {
862
+ /**
863
+ * Schema type discriminator.
864
+ */
865
+ type: 'datetime';
866
+ /**
867
+ * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).
868
+ */
869
+ offset?: boolean;
870
+ /**
871
+ * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).
872
+ */
873
+ local?: boolean;
874
+ };
875
+ /**
876
+ * Shared base for `date` and `time` schemas.
877
+ */
878
+ type TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {
879
+ /**
880
+ * Schema type discriminator.
881
+ */
882
+ type: T;
883
+ /**
884
+ * Output representation in generated code.
885
+ */
886
+ representation: 'date' | 'string';
887
+ };
888
+ /**
889
+ * Date schema node.
890
+ *
891
+ * @example
892
+ * ```ts
893
+ * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }
894
+ * ```
895
+ */
896
+ type DateSchemaNode = TemporalSchemaNodeBase<'date'>;
897
+ /**
898
+ * Time schema node.
899
+ *
900
+ * @example
901
+ * ```ts
902
+ * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }
903
+ * ```
904
+ */
905
+ type TimeSchemaNode = TemporalSchemaNodeBase<'time'>;
906
+ /**
907
+ * String schema node.
908
+ *
909
+ * @example
910
+ * ```ts
911
+ * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }
912
+ * ```
913
+ */
914
+ type StringSchemaNode = SchemaNodeBase & {
915
+ /**
916
+ * Schema type discriminator.
917
+ */
918
+ type: 'string';
919
+ /**
920
+ * Minimum string length.
921
+ */
922
+ min?: number;
923
+ /**
924
+ * Maximum string length.
925
+ */
926
+ max?: number;
927
+ /**
928
+ * Regex pattern.
929
+ */
930
+ pattern?: string;
931
+ };
932
+ /**
933
+ * Numeric schema (`number`, `integer`, or `bigint`).
934
+ *
935
+ * @example
936
+ * ```ts
937
+ * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }
938
+ * ```
939
+ */
940
+ type NumberSchemaNode = SchemaNodeBase & {
941
+ /**
942
+ * Schema type discriminator.
943
+ */
944
+ type: 'number' | 'integer' | 'bigint';
945
+ /**
946
+ * Minimum value.
947
+ */
948
+ min?: number;
949
+ /**
950
+ * Maximum value.
951
+ */
952
+ max?: number;
953
+ /**
954
+ * Exclusive minimum value.
955
+ */
956
+ exclusiveMinimum?: number;
957
+ /**
958
+ * Exclusive maximum value.
959
+ */
960
+ exclusiveMaximum?: number;
961
+ /**
962
+ * The value must be a multiple of this number.
963
+ */
964
+ multipleOf?: number;
965
+ };
966
+ /**
967
+ * Scalar schema with no extra constraints.
968
+ *
969
+ * @example
970
+ * ```ts
971
+ * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }
972
+ * ```
973
+ */
974
+ type ScalarSchemaNode = SchemaNodeBase & {
975
+ /**
976
+ * Schema type discriminator.
977
+ */
978
+ type: ScalarSchemaType;
979
+ };
980
+ /**
981
+ * URL schema node.
982
+ * Can include an OpenAPI-style path template for template literal types.
983
+ *
984
+ * @example
985
+ * ```ts
986
+ * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }
987
+ * ```
988
+ */
989
+ type UrlSchemaNode = SchemaNodeBase & {
990
+ /**
991
+ * Schema type discriminator.
992
+ */
993
+ type: 'url';
994
+ /**
995
+ * OpenAPI-style path template, for example, `'/pets/{petId}'`.
996
+ */
997
+ path?: string;
998
+ /**
999
+ * Minimum string length.
1000
+ */
1001
+ min?: number;
1002
+ /**
1003
+ * Maximum string length.
1004
+ */
1005
+ max?: number;
1006
+ };
1007
+ /**
1008
+ * Format-string schema for string-based formats that support length constraints.
1009
+ *
1010
+ * @example
1011
+ * ```ts
1012
+ * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }
1013
+ * ```
1014
+ */
1015
+ type FormatStringSchemaNode = SchemaNodeBase & {
1016
+ /**
1017
+ * Schema type discriminator.
1018
+ */
1019
+ type: 'uuid' | 'email';
1020
+ /**
1021
+ * Minimum string length.
1022
+ */
1023
+ min?: number;
1024
+ /**
1025
+ * Maximum string length.
1026
+ */
1027
+ max?: number;
1028
+ };
1029
+ /**
1030
+ * IPv4 address schema node.
1031
+ *
1032
+ * @example
1033
+ * ```ts
1034
+ * const ipv4Schema: Ipv4SchemaNode = { kind: 'Schema', type: 'ipv4' }
1035
+ * ```
1036
+ */
1037
+ type Ipv4SchemaNode = SchemaNodeBase & {
1038
+ /**
1039
+ * Schema type discriminator.
1040
+ */
1041
+ type: 'ipv4';
1042
+ };
1043
+ /**
1044
+ * IPv6 address schema node.
1045
+ *
1046
+ * @example
1047
+ * ```ts
1048
+ * const ipv6Schema: Ipv6SchemaNode = { kind: 'Schema', type: 'ipv6' }
1049
+ * ```
1050
+ */
1051
+ type Ipv6SchemaNode = SchemaNodeBase & {
1052
+ /**
1053
+ * Schema type discriminator.
1054
+ */
1055
+ type: 'ipv6';
1056
+ };
1057
+ /**
1058
+ * Mapping from schema type literals to concrete schema node types.
1059
+ * Used by `narrowSchema`.
1060
+ */
1061
+ type SchemaNodeByType = {
1062
+ object: ObjectSchemaNode;
1063
+ array: ArraySchemaNode;
1064
+ tuple: ArraySchemaNode;
1065
+ union: UnionSchemaNode;
1066
+ intersection: IntersectionSchemaNode;
1067
+ enum: EnumSchemaNode;
1068
+ ref: RefSchemaNode;
1069
+ datetime: DatetimeSchemaNode;
1070
+ date: DateSchemaNode;
1071
+ time: TimeSchemaNode;
1072
+ string: StringSchemaNode;
1073
+ number: NumberSchemaNode;
1074
+ integer: NumberSchemaNode;
1075
+ bigint: NumberSchemaNode;
1076
+ boolean: ScalarSchemaNode;
1077
+ null: ScalarSchemaNode;
1078
+ any: ScalarSchemaNode;
1079
+ unknown: ScalarSchemaNode;
1080
+ void: ScalarSchemaNode;
1081
+ never: ScalarSchemaNode;
1082
+ uuid: FormatStringSchemaNode;
1083
+ email: FormatStringSchemaNode;
1084
+ url: UrlSchemaNode;
1085
+ ipv4: Ipv4SchemaNode;
1086
+ ipv6: Ipv6SchemaNode;
1087
+ blob: ScalarSchemaNode;
1088
+ };
1089
+ /**
1090
+ * Union of all schema node types.
1091
+ */
1092
+ type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | Ipv4SchemaNode | Ipv6SchemaNode | ScalarSchemaNode;
1093
+ //#endregion
1094
+ //#region src/nodes/content.d.ts
1095
+ /**
1096
+ * AST node representing one content-type entry of a request body or response.
1097
+ *
1098
+ * One entry per content type declared in the spec (e.g. `application/json`,
1099
+ * `multipart/form-data`), each carrying its own body schema.
1100
+ *
1101
+ * @example
1102
+ * ```ts
1103
+ * const content: ContentNode = {
1104
+ * kind: 'Content',
1105
+ * contentType: 'application/json',
1106
+ * schema: createSchema({ type: 'string' }),
1107
+ * }
1108
+ * ```
1109
+ */
1110
+ type ContentNode = BaseNode & {
1111
+ /**
1112
+ * Node kind.
1113
+ */
1114
+ kind: 'Content';
1115
+ /**
1116
+ * The content type for this entry (e.g. `'application/json'`).
1117
+ */
1118
+ contentType: string;
1119
+ /**
1120
+ * Body schema for this content type.
1121
+ */
1122
+ schema?: SchemaNode;
1123
+ /**
1124
+ * Property keys to exclude from the generated type via `Omit<Type, Keys>`.
1125
+ * Set when a referenced schema has `readOnly`/`writeOnly` fields that should be omitted.
1126
+ */
1127
+ keysToOmit?: Array<string> | null;
1128
+ };
1129
+ //#endregion
1130
+ //#region src/nodes/file.d.ts
1131
+ /**
1132
+ * Supported file extensions.
1133
+ */
1134
+ type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
1135
+ type ImportName = string | Array<string | {
1136
+ propertyName: string;
1137
+ name?: string;
1138
+ }>;
1139
+ /**
1140
+ * Represents a language-agnostic import/dependency declaration.
1141
+ *
1142
+ * @example Named import (TypeScript: `import { useState } from 'react'`)
1143
+ * ```ts
1144
+ * createImport({ name: ['useState'], path: 'react' })
1145
+ * ```
1146
+ *
1147
+ * @example Default import (TypeScript: `import React from 'react'`)
1148
+ * ```ts
1149
+ * createImport({ name: 'React', path: 'react' })
1150
+ * ```
1151
+ *
1152
+ * @example Type-only import (TypeScript: `import type { FC } from 'react'`)
1153
+ * ```ts
1154
+ * createImport({ name: ['FC'], path: 'react', isTypeOnly: true })
1155
+ * ```
1156
+ *
1157
+ * @example Namespace import (TypeScript: `import * as React from 'react'`)
1158
+ * ```ts
1159
+ * createImport({ name: 'React', path: 'react', isNameSpace: true })
1160
+ * ```
1161
+ */
1162
+ type ImportNode = BaseNode & {
1163
+ kind: 'Import';
1164
+ /**
1165
+ * Import name(s) to be used.
1166
+ * @example ['useState']
1167
+ * @example 'React'
1168
+ */
1169
+ name: ImportName;
1170
+ /**
1171
+ * Path for the import.
1172
+ * @example '@kubb/core'
1173
+ */
1174
+ path: string;
1175
+ /**
1176
+ * Add type-only import prefix.
1177
+ * - `true` generates `import type { Type } from './path'`
1178
+ * - `false` generates `import { Type } from './path'`
1179
+ * @default false
1180
+ */
1181
+ isTypeOnly?: boolean | null;
1182
+ /**
1183
+ * Import entire module as namespace.
1184
+ * - `true` generates `import * as Name from './path'`
1185
+ * - `false` generates standard import
1186
+ * @default false
1187
+ */
1188
+ isNameSpace?: boolean | null;
1189
+ /**
1190
+ * When set, the import path is resolved relative to this root.
1191
+ */
1192
+ root?: string | null;
1193
+ };
1194
+ /**
1195
+ * Represents a language-agnostic export/public API declaration.
1196
+ *
1197
+ * @example Named export (TypeScript: `export { Pets } from './Pets'`)
1198
+ * ```ts
1199
+ * createExport({ name: ['Pets'], path: './Pets' })
1200
+ * ```
1201
+ *
1202
+ * @example Type-only export (TypeScript: `export type { Pet } from './Pet'`)
1203
+ * ```ts
1204
+ * createExport({ name: ['Pet'], path: './Pet', isTypeOnly: true })
1205
+ * ```
1206
+ *
1207
+ * @example Wildcard export (TypeScript: `export * from './utils'`)
1208
+ * ```ts
1209
+ * createExport({ path: './utils' })
1210
+ * ```
1211
+ *
1212
+ * @example Namespace alias (TypeScript: `export * as utils from './utils'`)
1213
+ * ```ts
1214
+ * createExport({ name: 'utils', path: './utils', asAlias: true })
1215
+ * ```
1216
+ */
1217
+ type ExportNode = BaseNode & {
1218
+ kind: 'Export';
1219
+ /**
1220
+ * Export name(s) to be used. When omitted, generates a wildcard export.
1221
+ * @example ['useState']
1222
+ * @example 'React'
1223
+ */
1224
+ name?: string | Array<string> | null;
1225
+ /**
1226
+ * Path for the export.
1227
+ * @example '@kubb/core'
1228
+ */
1229
+ path: string;
1230
+ /**
1231
+ * Add type-only export prefix.
1232
+ * - `true` generates `export type { Type } from './path'`
1233
+ * - `false` generates `export { Type } from './path'`
1234
+ * @default false
1235
+ */
1236
+ isTypeOnly?: boolean | null;
1237
+ /**
1238
+ * Export as an aliased namespace.
1239
+ * - `true` generates `export * as aliasName from './path'`
1240
+ * - `false` generates a standard export
1241
+ * @default false
1242
+ */
1243
+ asAlias?: boolean | null;
1244
+ };
1245
+ /**
1246
+ * Represents a fragment of source code within a file.
1247
+ *
1248
+ * @example Named exportable source
1249
+ * ```ts
1250
+ * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true, isIndexable: true })
1251
+ * ```
1252
+ *
1253
+ * @example Inline unnamed code block
1254
+ * ```ts
1255
+ * createSource({ nodes: [createText('const x = 1')] })
1256
+ * ```
1257
+ */
1258
+ type SourceNode = BaseNode & {
1259
+ kind: 'Source';
1260
+ /**
1261
+ * Optional name identifying this source (used for deduplication and barrel generation).
1262
+ */
1263
+ name?: string | null;
1264
+ /**
1265
+ * Mark this source as a type-only export.
1266
+ * @default false
1267
+ */
1268
+ isTypeOnly?: boolean | null;
1269
+ /**
1270
+ * Include `export` keyword in the generated source.
1271
+ * @default false
1272
+ */
1273
+ isExportable?: boolean | null;
1274
+ /**
1275
+ * Include this source in barrel/index file generation.
1276
+ * @default false
1277
+ */
1278
+ isIndexable?: boolean | null;
1279
+ /**
1280
+ * Structured child nodes representing the content of this source fragment, in DOM order.
1281
+ * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
1282
+ */
1283
+ nodes?: Array<CodeNode>;
1284
+ };
1285
+ /**
1286
+ * Represents a fully resolved file in the AST.
1287
+ *
1288
+ * Created via `createFile()`, which computes the `id`, `name`, and `extname` from the input
1289
+ * and deduplicates `imports`, `exports`, and `sources`.
1290
+ *
1291
+ * @example
1292
+ * ```ts
1293
+ * const file = createFile({
1294
+ * baseName: 'petStore.ts',
1295
+ * path: 'src/models/petStore.ts',
1296
+ * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })],
1297
+ * imports: [createImport({ name: ['z'], path: 'zod' })],
1298
+ * exports: [createExport({ name: ['Pet'], path: './petStore' })],
1299
+ * })
1300
+ * // file.id = SHA256 hash of the path
1301
+ * // file.name = 'petStore'
1302
+ * // file.extname = '.ts'
1303
+ * ```
1304
+ */
1305
+ type FileNode<TMeta extends object = object> = BaseNode & {
1306
+ kind: 'File';
1307
+ /**
1308
+ * Unique identifier derived from a SHA256 hash of the file path. Computed
1309
+ * by `createFile`; callers do not need to provide it.
1310
+ */
1311
+ id: string;
1312
+ /**
1313
+ * File name without extension, derived from `baseName`.
1314
+ * @link https://nodejs.org/api/path.html#pathformatpathobject
1315
+ */
1316
+ name: string;
1317
+ /**
1318
+ * File base name, including extension.
1319
+ * Based on UNIX basename: `${name}${extname}`
1320
+ * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
1321
+ */
1322
+ baseName: `${string}.${string}`;
1323
+ /**
1324
+ * Full qualified path to the file.
1325
+ */
1326
+ path: string;
1327
+ /**
1328
+ * File extension extracted from `baseName`.
1329
+ */
1330
+ extname: Extname;
1331
+ /**
1332
+ * Deduplicated list of source code fragments.
1333
+ */
1334
+ sources: Array<SourceNode>;
1335
+ /**
1336
+ * Deduplicated list of import declarations.
1337
+ */
1338
+ imports: Array<ImportNode>;
1339
+ /**
1340
+ * Deduplicated list of export declarations.
1341
+ */
1342
+ exports: Array<ExportNode>;
1343
+ /**
1344
+ * Optional metadata attached to this file (used by plugins for barrel generation etc.).
1345
+ */
1346
+ meta?: TMeta;
1347
+ /**
1348
+ * Optional banner prepended to the generated file content.
1349
+ * Accepts `null` so `resolver.resolveBanner()` results can be passed directly.
1350
+ */
1351
+ banner?: string | null;
1352
+ /**
1353
+ * Optional footer appended to the generated file content.
1354
+ * Accepts `null` so `resolver.resolveFooter()` results can be passed directly.
1355
+ */
1356
+ footer?: string | null;
1357
+ };
1358
+ //#endregion
1359
+ //#region src/nodes/function.d.ts
1360
+ /**
1361
+ * AST node representing a language-agnostic type expression used as a function parameter
1362
+ * type annotation. Each language printer renders the variant into its own syntax.
1363
+ *
1364
+ * - `struct` — an inline anonymous type grouping named fields.
1365
+ * TypeScript renders as `{ petId: string; name?: string }`.
1366
+ * - `member` — a single named field accessed from a named group type.
1367
+ * TypeScript renders as `PathParams['petId']`.
1368
+ *
1369
+ * @example Reference variant
1370
+ * ```ts
1371
+ * createParamsType({ variant: 'reference', name: 'QueryParams' })
1372
+ * // QueryParams
1373
+ * ```
1374
+ *
1375
+ * @example Struct variant
1376
+ * ```ts
1377
+ * createParamsType({ variant: 'struct', properties: [{ name: 'petId', optional: false, type: createParamsType({ variant: 'reference', name: 'string' }) }] })
1378
+ * // { petId: string }
1379
+ * ```
1380
+ *
1381
+ * @example Member variant
1382
+ * ```ts
1383
+ * createParamsType({ variant: 'member', base: 'PathParams', key: 'petId' })
1384
+ * // PathParams['petId']
1385
+ * ```
1386
+ */
1387
+ type ParamsTypeNode = BaseNode & {
1388
+ /**
1389
+ * Node kind.
1390
+ */
1391
+ kind: 'ParamsType';
1392
+ } & ({
1393
+ /**
1394
+ * Reference variant — a plain type name or identifier.
1395
+ * TypeScript renders as-is, e.g. `string`, `QueryParams`, `Partial<Config>`.
1396
+ */
1397
+ variant: 'reference';
1398
+ /**
1399
+ * The full type name string, e.g. `'string'`, `'QueryParams'`, `'Partial<Config>'`.
1400
+ */
1401
+ name: string;
1402
+ } | {
1403
+ /**
1404
+ * Struct variant — an inline anonymous type grouping named fields.
1405
+ * TypeScript renders as `{ key: Type; other?: OtherType }`.
1406
+ */
1407
+ variant: 'struct';
1408
+ /**
1409
+ * Properties of the struct type.
1410
+ */
1411
+ properties: Array<{
1412
+ name: string;
1413
+ optional: boolean;
1414
+ type: ParamsTypeNode;
1415
+ }>;
1416
+ } | {
1417
+ /**
1418
+ * Member variant — a single named field accessed from a group type.
1419
+ * TypeScript renders as `Base['key']`.
1420
+ */
1421
+ variant: 'member';
1422
+ /**
1423
+ * Base type name, e.g. `'DeletePetPathParams'`.
1424
+ */
1425
+ base: string;
1426
+ /**
1427
+ * The field name to access, e.g. `'petId'`.
1428
+ */
1429
+ key: string;
1430
+ });
1431
+ /**
1432
+ * AST node for one function parameter.
1433
+ *
1434
+ * @example Required parameter
1435
+ * `name: Type`
1436
+ *
1437
+ * @example Optional parameter
1438
+ * `name?: Type`
1439
+ *
1440
+ * @example Parameter with default value
1441
+ * `name: Type = defaultValue`
1442
+ *
1443
+ * @example Rest parameter
1444
+ * `...name: Type[]`
1445
+ */
1446
+ type FunctionParameterNode = BaseNode & {
1447
+ /**
1448
+ * Node kind.
1449
+ */
1450
+ kind: 'FunctionParameter';
1451
+ /**
1452
+ * Parameter name in the generated signature.
1453
+ */
1454
+ name: string;
1455
+ /**
1456
+ * Type annotation as a structured {@link ParamsTypeNode}.
1457
+ * Omit for untyped output.
1458
+ *
1459
+ * @example Reference type node
1460
+ * `{ kind: 'ParamsType', variant: 'reference', name: 'string' }` → `petId: string`
1461
+ *
1462
+ * @example Struct type node
1463
+ * `{ kind: 'ParamsType', variant: 'struct', properties: [...] }` → `{ key: Type; other?: OtherType }`
1464
+ *
1465
+ * @example Member type node
1466
+ * `{ kind: 'ParamsType', variant: 'member', base: 'PathParams', key: 'petId' }` → `PathParams['petId']`
1467
+ */
1468
+ type?: ParamsTypeNode;
1469
+ /**
1470
+ * When `true` the parameter is emitted as a rest parameter.
1471
+ *
1472
+ * @example Rest parameter
1473
+ * `...name: Type[]`
1474
+ */
1475
+ rest?: boolean;
1476
+ }
1477
+ /**
1478
+ * Optional parameter — rendered with `?` and may be omitted by the caller.
1479
+ * Cannot be combined with `default` because a defaulted parameter is already optional.
1480
+ */
1481
+ & ({
1482
+ optional: true;
1483
+ default?: never;
1484
+ }
1485
+ /**
1486
+ * Required parameter, or a parameter with a default value.
1487
+ *
1488
+ * @example Required
1489
+ * `name: Type`
1490
+ *
1491
+ * @example With default
1492
+ * `name: Type = default`
1493
+ */
1494
+ | {
1495
+ optional?: false;
1496
+ default?: string;
1497
+ });
1498
+ /**
1499
+ * AST node for a group of related function parameters treated as a single unit.
1500
+ *
1501
+ * Each language printer decides how to render this group:
1502
+ * - TypeScript/JS: destructured object `{ key1, key2 }: { key1: Type1; key2: Type2 } = {}`
1503
+ * - Python: keyword-only args or a typed dict parameter
1504
+ * - C# / Kotlin: named record / data-class parameter
1505
+ *
1506
+ * When `inline` is `true`, the group is spread as individual top-level parameters
1507
+ * rather than wrapped in a single grouped construct.
1508
+ *
1509
+ * @example Grouped destructuring
1510
+ * `{ id, name }: { id: string; name: string } = {}`
1511
+ *
1512
+ * @example Inline (spread as individual parameters)
1513
+ * `id: string, name: string`
1514
+ */
1515
+ type ParameterGroupNode = BaseNode & {
1516
+ /**
1517
+ * Node kind.
1518
+ */
1519
+ kind: 'ParameterGroup';
1520
+ /**
1521
+ * The individual parameters that form the group.
1522
+ * Rendered as a destructured object or spread inline when `inline` is `true`.
1523
+ */
1524
+ properties: Array<FunctionParameterNode>;
1525
+ /**
1526
+ * Optional explicit type annotation for the whole group.
1527
+ * When absent, printers auto-compute it from `properties`.
1528
+ */
1529
+ type?: ParamsTypeNode;
1530
+ /**
1531
+ * When `true`, `properties` are emitted as individual top-level parameters instead of
1532
+ * being wrapped in a single grouped construct.
1533
+ *
1534
+ * @default false
1535
+ */
1536
+ inline?: boolean;
1537
+ /**
1538
+ * Whether the group as a whole is optional.
1539
+ * If omitted, printers infer this from child properties.
1540
+ */
1541
+ optional?: boolean;
1542
+ /**
1543
+ * Default value for the group, written verbatim after `=`.
1544
+ * Commonly `'{}'` to allow omitting the argument entirely.
1545
+ */
1546
+ default?: string;
1547
+ };
1548
+ /**
1549
+ * AST node for a complete function parameter list.
1550
+ *
1551
+ * Printers are responsible for sorting (`required` → `optional` → `defaulted`).
1552
+ * Nodes are plain immutable data.
1553
+ *
1554
+ * Renders differently depending on the output mode:
1555
+ * - `declaration` → `(id: string, config: Config = {})` — function declaration parameters
1556
+ * - `call` → `(id, { method, url })` — function call arguments
1557
+ * - `keys` → `{ id, config }` — key names only (for destructuring)
1558
+ * - `values` → `{ id: id, config: config }` — key → value pairs
1559
+ */
1560
+ type FunctionParametersNode = BaseNode & {
1561
+ /**
1562
+ * Node kind.
1563
+ */
1564
+ kind: 'FunctionParameters';
1565
+ /**
1566
+ * Ordered parameter nodes.
1567
+ */
1568
+ params: ReadonlyArray<FunctionParameterNode | ParameterGroupNode>;
1569
+ };
1570
+ /**
1571
+ * Union of all function-parameter AST node variants used by the function-parameter printer.
1572
+ */
1573
+ type FunctionParamNode = FunctionParameterNode | ParameterGroupNode | FunctionParametersNode | ParamsTypeNode;
1574
+ /**
1575
+ * Handler map keys — one per `FunctionParamNode` kind.
1576
+ */
1577
+ type FunctionNodeType = 'functionParameter' | 'parameterGroup' | 'functionParameters' | 'paramsType';
1578
+ //#endregion
1579
+ //#region src/nodes/parameter.d.ts
1580
+ type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
1581
+ /**
1582
+ * AST node representing one operation parameter.
1583
+ *
1584
+ * @example
1585
+ * ```ts
1586
+ * const param: ParameterNode = {
1587
+ * kind: 'Parameter',
1588
+ * name: 'petId',
1589
+ * in: 'path',
1590
+ * schema: createSchema({ type: 'string' }),
1591
+ * required: true,
1592
+ * }
1593
+ * ```
1594
+ */
1595
+ type ParameterNode = BaseNode & {
1596
+ /**
1597
+ * Node kind.
1598
+ */
1599
+ kind: 'Parameter';
1600
+ /**
1601
+ * Parameter name.
1602
+ */
1603
+ name: string;
1604
+ /**
1605
+ * Parameter location (`path`, `query`, `header`, or `cookie`).
1606
+ */
1607
+ in: ParameterLocation;
1608
+ /**
1609
+ * Parameter schema.
1610
+ */
1611
+ schema: SchemaNode;
1612
+ /**
1613
+ * Whether the parameter is required.
1614
+ */
1615
+ required: boolean;
1616
+ };
1617
+ //#endregion
1618
+ //#region src/nodes/http.d.ts
1619
+ /**
1620
+ * All supported HTTP status code literals as strings, as used in API specs
1621
+ * (for example, `"200"` and `"404"`).
1622
+ */
1623
+ 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';
1624
+ /**
1625
+ * Response status code literal used by operations.
1626
+ *
1627
+ * Includes specific HTTP status code strings and `"default"` for catch-all responses.
1628
+ *
1629
+ * @example
1630
+ * ```ts
1631
+ * const status: StatusCode = '200'
1632
+ * const fallback: StatusCode = 'default'
1633
+ * ```
1634
+ */
1635
+ type StatusCode = HttpStatusCode | 'default';
1636
+ /**
1637
+ * Supported media type strings used in request and response bodies.
1638
+ *
1639
+ * @example
1640
+ * ```ts
1641
+ * const mediaType: MediaType = 'application/json'
1642
+ * ```
1643
+ */
1644
+ type MediaType = 'application/json' | 'application/xml' | 'application/x-www-form-urlencoded' | 'application/octet-stream' | 'application/pdf' | 'application/zip' | 'application/graphql' | 'multipart/form-data' | 'text/plain' | 'text/html' | 'text/csv' | 'text/xml' | 'image/png' | 'image/jpeg' | 'image/gif' | 'image/webp' | 'image/svg+xml' | 'audio/mpeg' | 'video/mp4';
1645
+ //#endregion
1646
+ //#region src/nodes/response.d.ts
1647
+ /**
1648
+ * AST node representing one operation response variant.
1649
+ *
1650
+ * Mirrors {@link OperationNode.requestBody}: the response body schemas live exclusively inside
1651
+ * the `content` array (one entry per content type), so the same schema is never duplicated at the
1652
+ * node root and inside `content`.
1653
+ *
1654
+ * @example
1655
+ * ```ts
1656
+ * const response: ResponseNode = {
1657
+ * kind: 'Response',
1658
+ * statusCode: '200',
1659
+ * content: [{ contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
1660
+ * }
1661
+ * ```
1662
+ */
1663
+ type ResponseNode = BaseNode & {
1664
+ /**
1665
+ * Node kind.
1666
+ */
1667
+ kind: 'Response';
1668
+ /**
1669
+ * HTTP status code or `'default'` for a fallback response.
1670
+ */
1671
+ statusCode: StatusCode;
1672
+ /**
1673
+ * Optional response description.
1674
+ */
1675
+ description?: string;
1676
+ /**
1677
+ * All available content type entries for this response.
1678
+ *
1679
+ * When the adapter `contentType` option is set, this array contains exactly one entry for that
1680
+ * content type. Otherwise it contains one entry per content type declared in the spec, so that
1681
+ * plugins can generate a union of response types (e.g. `application/json` and `application/xml`).
1682
+ * Body-less responses keep a single entry whose `schema` is the empty/`void` placeholder.
1683
+ *
1684
+ * @example
1685
+ * ```ts
1686
+ * // spec response declares both application/json and application/xml
1687
+ * response.content[0].contentType // 'application/json'
1688
+ * response.content[1].contentType // 'application/xml'
1689
+ * ```
1690
+ */
1691
+ content?: Array<ContentNode>;
1692
+ };
1693
+ //#endregion
1694
+ //#region src/nodes/operation.d.ts
1695
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE';
1696
+ /**
1697
+ * Transport an operation belongs to.
1698
+ */
1699
+ type OperationProtocol = 'http';
1700
+ /**
1701
+ * AST node representing an operation request body.
1702
+ *
1703
+ * Body schemas live exclusively inside the `content` array (one entry per content type),
1704
+ * mirroring {@link ResponseNode}.
1705
+ *
1706
+ * @example
1707
+ * ```ts
1708
+ * const requestBody: RequestBodyNode = {
1709
+ * kind: 'RequestBody',
1710
+ * required: true,
1711
+ * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
1712
+ * }
1713
+ * ```
1714
+ */
1715
+ type RequestBodyNode = BaseNode & {
1716
+ /**
1717
+ * Node kind.
1718
+ */
1719
+ kind: 'RequestBody';
1720
+ /**
1721
+ * Human-readable request body description.
1722
+ */
1723
+ description?: string;
1724
+ /**
1725
+ * Whether the request body is required (`requestBody.required: true` in the spec).
1726
+ * When `false` or absent, the generated `data` parameter should be optional.
1727
+ */
1728
+ required?: boolean;
1729
+ /**
1730
+ * All available content type entries for this request body.
1731
+ *
1732
+ * When the adapter `contentType` option is set, this array contains exactly one entry for
1733
+ * that content type. Otherwise it contains one entry per content type declared in the spec,
1734
+ * so that plugins can generate code for every variant (e.g. separate hooks for
1735
+ * `application/json` and `multipart/form-data`).
1736
+ */
1737
+ content?: Array<ContentNode>;
1738
+ };
1739
+ /**
1740
+ * Fields shared by every operation, regardless of transport.
1741
+ */
1742
+ type OperationNodeBase = BaseNode & {
1743
+ /**
1744
+ * Node kind.
1745
+ */
1746
+ kind: 'Operation';
1747
+ /**
1748
+ * Operation identifier, usually from OpenAPI `operationId`.
1749
+ */
1750
+ operationId: string;
1751
+ /**
1752
+ * Group labels for the operation.
1753
+ * Usually copied from OpenAPI `tags`.
1754
+ */
1755
+ tags: Array<string>;
1756
+ /**
1757
+ * Short one-line operation summary.
1758
+ */
1759
+ summary?: string;
1760
+ /**
1761
+ * Full operation description.
1762
+ */
1763
+ description?: string;
1764
+ /**
1765
+ * Marks the operation as deprecated.
1766
+ */
1767
+ deprecated?: boolean;
1768
+ /**
1769
+ * Parameters that could be used, we have QueryParams, PathParams, HeaderParams and CookieParams
1770
+ */
1771
+ parameters: Array<ParameterNode>;
1772
+ /**
1773
+ * Request body for the operation.
1774
+ */
1775
+ requestBody?: RequestBodyNode;
1776
+ /**
1777
+ * Operation responses.
1778
+ */
1779
+ responses: Array<ResponseNode>;
1780
+ };
1781
+ /**
1782
+ * Operation served over HTTP/REST (OpenAPI). `method` and `path` are guaranteed.
1783
+ *
1784
+ * @example
1785
+ * ```ts
1786
+ * const operation: HttpOperationNode = {
1787
+ * kind: 'Operation',
1788
+ * operationId: 'listPets',
1789
+ * protocol: 'http',
1790
+ * method: 'GET',
1791
+ * path: '/pets',
1792
+ * tags: [],
1793
+ * parameters: [],
1794
+ * responses: [],
1795
+ * }
1796
+ * ```
1797
+ */
1798
+ type HttpOperationNode = OperationNodeBase & {
1799
+ /**
1800
+ * Transport the operation belongs to.
1801
+ */
1802
+ protocol?: 'http';
1803
+ /**
1804
+ * HTTP method like `'GET'`.
1805
+ */
1806
+ method: HttpMethod;
1807
+ /**
1808
+ * OpenAPI-style path string, for example `/pets/{petId}`, with `{param}` notation preserved.
1809
+ */
1810
+ path: string;
1811
+ };
1812
+ /**
1813
+ * Operation for a non-HTTP transport. HTTP-only fields are forbidden.
1814
+ */
1815
+ type GenericOperationNode = OperationNodeBase & {
1816
+ /**
1817
+ * Transport the operation belongs to.
1818
+ */
1819
+ protocol?: Exclude<OperationProtocol, 'http'>;
1820
+ method?: never;
1821
+ path?: never;
1822
+ };
1823
+ /**
1824
+ * AST node representing one API operation.
1825
+ *
1826
+ * Discriminated on `protocol`: an {@link HttpOperationNode} (`protocol: 'http'`) guarantees
1827
+ * `method` and `path`, while a {@link GenericOperationNode} omits them. Narrow with
1828
+ * `isHttpOperationNode(node)` or `node.protocol === 'http'` before reading `method`/`path`.
1829
+ */
1830
+ type OperationNode = HttpOperationNode | GenericOperationNode;
1831
+ //#endregion
1832
+ //#region src/nodes/output.d.ts
1833
+ /**
1834
+ * Output AST node that groups all generated file output for one API document.
1835
+ *
1836
+ * Produced by generators and consumed by the build pipeline to write files.
1837
+ *
1838
+ * @example
1839
+ * ```ts
1840
+ * const output: OutputNode = {
1841
+ * kind: 'Output',
1842
+ * files: [],
1843
+ * }
1844
+ * ```
1845
+ */
1846
+ type OutputNode = BaseNode & {
1847
+ /**
1848
+ * Node kind.
1849
+ */
1850
+ kind: 'Output';
1851
+ /**
1852
+ * Generated file nodes.
1853
+ */
1854
+ files: Array<FileNode>;
1855
+ };
1856
+ //#endregion
1857
+ //#region src/nodes/root.d.ts
1858
+ /**
1859
+ * Metadata for an API document, populated by the adapter and available to every generator.
1860
+ *
1861
+ * All fields are plain JSON-serializable values — no `Set`, no `Map`, no class instances.
1862
+ * Computed fields (`circularNames`, `enumNames`) are pre-calculated once during the adapter
1863
+ * pre-scan so generators never need to iterate the full schema list themselves.
1864
+ *
1865
+ * @example
1866
+ * ```ts
1867
+ * const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://petstore.swagger.io/v2', circularNames: [], enumNames: [] }
1868
+ * ```
1869
+ */
1870
+ type InputMeta = {
1871
+ /**
1872
+ * API title from `info.title` in the source document.
1873
+ */
1874
+ title?: string;
1875
+ /**
1876
+ * API description from `info.description` in the source document.
1877
+ */
1878
+ description?: string;
1879
+ /**
1880
+ * API version string from `info.version` in the source document.
1881
+ */
1882
+ version?: string;
1883
+ /**
1884
+ * Resolved base URL from the first matching server entry in the source document.
1885
+ */
1886
+ baseURL?: string | null;
1887
+ /**
1888
+ * Names of schemas that participate in a circular reference chain.
1889
+ * Computed once during the adapter pre-scan — use this instead of calling
1890
+ * `findCircularSchemas` per generator call.
1891
+ *
1892
+ * Convert to a `Set` once at the start of a generator, not per-schema,
1893
+ * to keep lookup O(1) without repeated allocations.
1894
+ *
1895
+ * @example Wrap a circular schema in z.lazy()
1896
+ * ```ts
1897
+ * const circular = new Set(meta.circularNames)
1898
+ * if (circular.has(schema.name)) { ... }
1899
+ * ```
1900
+ */
1901
+ circularNames: ReadonlyArray<string>;
1902
+ /**
1903
+ * Names of schemas whose type is `enum`.
1904
+ * Computed once during the adapter pre-scan — use this instead of filtering
1905
+ * schemas per generator call.
1906
+ *
1907
+ * Convert to a `Set` once at the start of a generator when you need repeated
1908
+ * membership checks, rather than calling `.includes()` per schema.
1909
+ *
1910
+ * @example Check if a referenced schema is an enum
1911
+ * `const enums = new Set(meta.enumNames)`
1912
+ * `const isEnum = enums.has(schemaName)`
1913
+ */
1914
+ enumNames: ReadonlyArray<string>;
1915
+ };
1916
+ /**
1917
+ * Input AST node that contains all schemas and operations for one API document.
1918
+ * Produced by the adapter and consumed by all Kubb plugins.
1919
+ *
1920
+ * @example
1921
+ * ```ts
1922
+ * const input: InputNode = {
1923
+ * kind: 'Input',
1924
+ * schemas: [],
1925
+ * operations: [],
1926
+ * }
1927
+ * ```
1928
+ */
1929
+ type InputNode = BaseNode & {
1930
+ /**
1931
+ * Node kind.
1932
+ */
1933
+ kind: 'Input';
1934
+ /**
1935
+ * All schema nodes in the document.
1936
+ */
1937
+ schemas: Array<SchemaNode>;
1938
+ /**
1939
+ * All operation nodes in the document.
1940
+ */
1941
+ operations: Array<OperationNode>;
1942
+ /**
1943
+ * Document metadata populated by the adapter.
1944
+ */
1945
+ meta: InputMeta;
1946
+ };
1947
+ /**
1948
+ * Streaming variant of `InputNode` for memory-efficient processing of large API specs.
1949
+ *
1950
+ * `schemas` and `operations` are `AsyncIterable` rather than arrays — each `for await`
1951
+ * loop creates a fresh parse pass from the cached in-memory document, so multiple
1952
+ * consumers (plugins) can iterate independently without keeping all nodes in memory.
1953
+ *
1954
+ * @example
1955
+ * ```ts
1956
+ * for await (const schema of inputStreamNode.schemas) {
1957
+ * // only this one SchemaNode is live here; previous ones are GC-eligible
1958
+ * }
1959
+ * ```
1960
+ */
1961
+ type InputStreamNode = {
1962
+ kind: 'Input';
1963
+ /**
1964
+ * Lazily parsed schema nodes. Each `for await` creates a fresh parse pass, so
1965
+ * multiple plugins can iterate independently without sharing state.
1966
+ */
1967
+ schemas: AsyncIterable<SchemaNode>;
1968
+ /**
1969
+ * Lazily parsed operation nodes. Each `for await` creates a fresh parse pass, so
1970
+ * multiple plugins can iterate independently without sharing state.
1971
+ */
1972
+ operations: AsyncIterable<OperationNode>;
1973
+ /**
1974
+ * Document metadata available immediately, before the first yielded node.
1975
+ */
1976
+ meta?: InputMeta;
1977
+ };
1978
+ //#endregion
1979
+ //#region src/nodes/index.d.ts
1980
+ /**
1981
+ * Union of all AST node types.
1982
+ *
1983
+ * This lets TypeScript narrow types in `switch (node.kind)` blocks.
1984
+ *
1985
+ * @example
1986
+ * ```ts
1987
+ * function getKind(node: Node): string {
1988
+ * switch (node.kind) {
1989
+ * case 'Input':
1990
+ * return 'input'
1991
+ * case 'Output':
1992
+ * return 'output'
1993
+ * default:
1994
+ * return 'other'
1995
+ * }
1996
+ * }
1997
+ * ```
1998
+ */
1999
+ type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FunctionParamNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | ParamsTypeNode | FunctionNode | ArrowFunctionNode;
2000
+ //#endregion
2001
+ //#region src/dedupe.d.ts
2002
+ /**
2003
+ * A canonical destination for a deduplicated shape: the shared schema name and
2004
+ * the synthetic `$ref` path that points at it.
2005
+ */
2006
+ type DedupeCanonical = {
2007
+ /**
2008
+ * Canonical schema name every duplicate occurrence refers to.
2009
+ */
2010
+ name: string;
2011
+ /**
2012
+ * `$ref` path stored on the generated `ref` nodes (for example `#/components/schemas/Status`).
2013
+ */
2014
+ ref: string;
2015
+ };
2016
+ /**
2017
+ * The result of {@link buildDedupePlan}: a lookup from structural signature to its
2018
+ * canonical target, plus the freshly hoisted definitions that must be added to
2019
+ * the schema list.
2020
+ */
2021
+ type DedupePlan = {
2022
+ /**
2023
+ * Maps a structural signature to the canonical schema that represents it.
2024
+ */
2025
+ canonicalBySignature: Map<string, DedupeCanonical>;
2026
+ /**
2027
+ * New top-level schema definitions created for inline shapes that had no existing
2028
+ * named component. Nested duplicates inside each definition are already collapsed.
2029
+ */
2030
+ hoisted: Array<SchemaNode>;
2031
+ };
2032
+ /**
2033
+ * Options that inject the naming and candidate policy into {@link buildDedupePlan}.
2034
+ * The mechanics (grouping, counting, rewriting) live here; the policy lives in the caller.
2035
+ */
2036
+ type BuildDedupePlanOptions = {
2037
+ /**
2038
+ * Returns `true` when a node should be deduplicated. This is the only gate, so it must
2039
+ * reject both ineligible kinds (return `false` for anything other than, say, enums and
2040
+ * objects) and unsafe shapes (e.g. nodes that reference a circular schema).
2041
+ */
2042
+ isCandidate: (node: SchemaNode) => boolean;
2043
+ /**
2044
+ * Produces the canonical name for an inline shape with no existing named component.
2045
+ * Return `null` to leave the shape inline (for example when no contextual name exists).
2046
+ */
2047
+ nameFor: (node: SchemaNode, signature: string) => string | null;
2048
+ /**
2049
+ * Builds the `$ref` path for a canonical name.
2050
+ */
2051
+ refFor: (name: string) => string;
2052
+ /**
2053
+ * Minimum number of occurrences before a shape is deduplicated.
2054
+ *
2055
+ * @default 2
2056
+ */
2057
+ minOccurrences?: number;
2058
+ };
2059
+ /**
2060
+ * Rewrites a node, replacing every candidate sub-schema whose signature has a canonical
2061
+ * target with a `ref` to that target. Replacing a node with a `ref` prunes its subtree,
2062
+ * so nested duplicates inside a replaced shape are not visited again.
2063
+ *
2064
+ * Pass `skipRootMatch` when rewriting a canonical definition so its own root is not
2065
+ * turned into a reference to itself; nested duplicates are still collapsed.
2066
+ *
2067
+ * @example
2068
+ * ```ts
2069
+ * const next = applyDedupe(operationNode, plan.canonicalBySignature)
2070
+ * ```
2071
+ */
2072
+ declare function applyDedupe(node: SchemaNode, canonicalBySignature: ReadonlyMap<string, DedupeCanonical>, skipRootMatch?: boolean): SchemaNode;
2073
+ declare function applyDedupe(node: OperationNode, canonicalBySignature: ReadonlyMap<string, DedupeCanonical>, skipRootMatch?: boolean): OperationNode;
2074
+ /**
2075
+ * Scans a forest of schema and operation nodes and produces a {@link DedupePlan}.
2076
+ *
2077
+ * A shape that occurs at least `minOccurrences` times is deduplicated: if any occurrence
2078
+ * is a named top-level schema, that name becomes the canonical (so other top-level duplicates
2079
+ * and inline copies turn into references to it); otherwise a new definition is hoisted using
2080
+ * `nameFor`. The plan is then applied per node with {@link applyDedupe}.
2081
+ *
2082
+ * @example
2083
+ * ```ts
2084
+ * const plan = buildDedupePlan([...schemaNodes, ...operationNodes], {
2085
+ * isCandidate: (node) => node.type === 'enum' || node.type === 'object',
2086
+ * nameFor: (node) => node.name ?? null,
2087
+ * refFor: (name) => `#/components/schemas/${name}`,
2088
+ * })
2089
+ * ```
2090
+ */
2091
+ declare function buildDedupePlan(roots: ReadonlyArray<Node>, options: BuildDedupePlanOptions): DedupePlan;
2092
+ //#endregion
2093
+ //#region src/dialect.d.ts
2094
+ /**
2095
+ * The spec-specific decisions a schema parser makes while converting a source
2096
+ * document's schemas into Kubb AST nodes.
2097
+ *
2098
+ * Everything else in an adapter's schema pipeline is generic JSON Schema shared
2099
+ * across specs; the dialect is the one seam where a spec differs — the
2100
+ * "dialect layer" analogue of a database driver targeting Postgres vs MySQL.
2101
+ * Pair it with {@link dispatch}: the rule table decides *which* converter runs,
2102
+ * the dialect answers the spec-specific questions inside them.
2103
+ *
2104
+ * The guard methods (`isReference`, `isDiscriminator`) are type predicates so
2105
+ * converters narrow the schema after a check; the type parameters carry those
2106
+ * narrowed types through.
2107
+ *
2108
+ * Scope: this is the seam for the **JSON Schema family** — OpenAPI, AsyncAPI, and
2109
+ * plain JSON Schema all share `$ref`, `allOf`/`oneOf`, `enum`, and `format`, and
2110
+ * differ only in these few decisions. A spec built on a different type system
2111
+ * (e.g. GraphQL, with non-null wrappers, interfaces, and named-type references
2112
+ * instead of `$ref`) does not implement a `SchemaDialect`; it reuses the universal
2113
+ * layer directly — the `Adapter` port, the AST factories, and {@link dispatch}
2114
+ * with its own rule table — to emit the same nodes.
2115
+ *
2116
+ * @typeParam TSchema - The adapter's schema object type (e.g. an OpenAPI `SchemaObject`).
2117
+ * @typeParam TRef - The narrowed `$ref` pointer type `isReference` proves.
2118
+ * @typeParam TDiscriminated - The narrowed discriminated-schema type `isDiscriminator` proves.
2119
+ * @typeParam TDocument - The source document `resolveRef` resolves against.
2120
+ */
2121
+ type SchemaDialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema, TDocument = unknown> = {
2122
+ /** Identifies the dialect in logs and while debugging dispatch. */name: string; /** Whether a schema should be treated as nullable. */
2123
+ isNullable: (schema?: TSchema) => boolean; /** Whether a value is a `$ref` pointer object. */
2124
+ isReference: (value?: unknown) => value is TRef; /** Whether a schema carries a structured discriminator (polymorphism). */
2125
+ isDiscriminator: (value?: unknown) => value is TDiscriminated; /** Whether a schema represents binary data (converted to a `blob` node). */
2126
+ isBinary: (schema: TSchema) => boolean; /** Resolves a local `$ref` pointer against the document, or nullish when it cannot. */
2127
+ resolveRef: <TResolved>(document: TDocument, ref: string) => TResolved | null | undefined;
2128
+ };
2129
+ /**
2130
+ * Identity helper that types a {@link SchemaDialect} for an adapter. Like
2131
+ * `defineParser`, it adds no runtime behavior — it pins the dialect's type for
2132
+ * inference and gives adapter authors a discoverable anchor.
2133
+ *
2134
+ * @example
2135
+ * ```ts
2136
+ * export const oasDialect = defineSchemaDialect({
2137
+ * name: 'oas',
2138
+ * isNullable,
2139
+ * isReference,
2140
+ * isDiscriminator,
2141
+ * isBinary: (schema) => schema.type === 'string' && schema.contentMediaType === 'application/octet-stream',
2142
+ * resolveRef,
2143
+ * })
2144
+ * ```
2145
+ */
2146
+ declare function defineSchemaDialect<TSchema, TRef, TDiscriminated, TDocument>(dialect: SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>): SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>;
2147
+ //#endregion
2148
+ //#region src/dispatch.d.ts
2149
+ /**
2150
+ * One entry in an ordered dispatch table: a predicate paired with a converter.
2151
+ *
2152
+ * @typeParam TContext - Per-input context handed to every rule. A spec adapter typically
2153
+ * pre-computes this once per node (the source spec node plus derived fields like a
2154
+ * normalized type or resolved options) so individual rules stay cheap predicates.
2155
+ * @typeParam TNode - The node a rule produces, e.g. a Kubb AST `SchemaNode`.
2156
+ */
2157
+ type DispatchRule<TContext, TNode> = {
2158
+ /** Identifies the rule when reading the table or debugging which branch ran. */name: string; /** Returns `true` when this rule is responsible for the given context. */
2159
+ match: (context: TContext) => boolean;
2160
+ /**
2161
+ * Produces a node for the context, or `null` to fall through to the next rule.
2162
+ *
2163
+ * Returning `null` lets a broad `match` defer: e.g. "has a `format`" matches many schemas,
2164
+ * but only some formats are convertible — the rest fall through to plain `type` handling.
2165
+ */
2166
+ convert: (context: TContext) => TNode | null;
2167
+ };
2168
+ /**
2169
+ * Walks an ordered list of {@link DispatchRule}s and returns the first node produced.
2170
+ *
2171
+ * This is the shared backbone for spec adapters (OpenAPI today, AsyncAPI and others later).
2172
+ * The contract an adapter follows is intentionally minimal:
2173
+ *
2174
+ * context → [rule.match → rule.convert] → node
2175
+ *
2176
+ * An adapter derives a context from a source spec node, then declares an ordered table of
2177
+ * rules mapping spec shapes onto Kubb AST nodes. To add support for a new spec, write a new
2178
+ * context type and a new rules table — the traversal here is reused unchanged.
2179
+ *
2180
+ * Order is significant: earlier rules win, so list higher-precedence or more specific shapes
2181
+ * first (e.g. composition keywords before plain `type`). A rule whose `match` returns `true`
2182
+ * may still `convert` to `null` to defer to later rules. When no rule produces a node this
2183
+ * returns `null`, leaving the caller to apply its own fallback.
2184
+ *
2185
+ * @example
2186
+ * ```ts
2187
+ * const node = dispatch(schemaRules, schemaContext) ?? createSchema({ type: fallbackType })
2188
+ * ```
2189
+ */
2190
+ declare function dispatch<TContext, TNode>(rules: ReadonlyArray<DispatchRule<TContext, TNode>>, context: TContext): TNode | null;
2191
+ //#endregion
2192
+ //#region src/infer.d.ts
2193
+ /**
2194
+ * Shared parser options used by OAS-to-AST inference and parser flows.
2195
+ */
2196
+ type ParserOptions = {
2197
+ /**
2198
+ * How `format: 'date-time'` schemas are represented downstream.
2199
+ * - `false` falls through to a plain `string` (no validation).
2200
+ * - `'string'` emits a datetime string node.
2201
+ * - `'stringOffset'` emits a datetime node with timezone offset.
2202
+ * - `'stringLocal'` emits a local datetime node.
2203
+ * - `'date'` emits a `date` node (JavaScript `Date` object).
2204
+ */
2205
+ dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
2206
+ /**
2207
+ * How `type: 'integer'` (and `format: 'int64'`) maps to TypeScript.
2208
+ * - `'number'` fits most JSON APIs; loses precision above `Number.MAX_SAFE_INTEGER`.
2209
+ * - `'bigint'` is exact for 64-bit IDs, but does not round-trip through JSON.
2210
+ *
2211
+ * @default 'number'
2212
+ */
2213
+ integerType?: 'number' | 'bigint';
2214
+ /**
2215
+ * AST type used when a schema's type cannot be inferred from the spec
2216
+ * (`additionalProperties: true`, missing `type`, ...).
2217
+ */
2218
+ unknownType: 'any' | 'unknown' | 'void';
2219
+ /**
2220
+ * AST type used for completely empty schemas (`{}`).
2221
+ */
2222
+ emptySchemaType: 'any' | 'unknown' | 'void';
2223
+ /**
2224
+ * Suffix appended to derived enum names when Kubb has to invent one
2225
+ * (typically for inline enums on object properties).
2226
+ */
2227
+ enumSuffix: 'enum' | (string & {});
2228
+ };
2229
+ /**
2230
+ * Maps each `dateType` option value to the AST node produced by `format: 'date-time'`.
2231
+ */
2232
+ type DateTimeNodeByDateType = {
2233
+ date: DateSchemaNode;
2234
+ string: DatetimeSchemaNode;
2235
+ stringOffset: DatetimeSchemaNode;
2236
+ stringLocal: DatetimeSchemaNode;
2237
+ false: StringSchemaNode;
2238
+ };
2239
+ /**
2240
+ * Resolves the AST node produced by `format: 'date-time'` based on the `dateType` option.
2241
+ */
2242
+ type ResolveDateTimeNode<TDateType extends ParserOptions['dateType']> = DateTimeNodeByDateType[TDateType extends keyof DateTimeNodeByDateType ? TDateType : 'string'];
2243
+ /**
2244
+ * Ordered list of `[schema-shape, SchemaNode]` pairs.
2245
+ * `InferSchemaNode` walks this tuple in order and returns the first matching node type.
2246
+ */
2247
+ type SchemaNodeMap<TDateType extends ParserOptions['dateType'] = 'string'> = [[{
2248
+ $ref: string;
2249
+ }, RefSchemaNode], [{
2250
+ allOf: ReadonlyArray<unknown>;
2251
+ properties: object;
2252
+ }, IntersectionSchemaNode], [{
2253
+ allOf: readonly [unknown, unknown, ...Array<unknown>];
2254
+ }, IntersectionSchemaNode], [{
2255
+ allOf: ReadonlyArray<unknown>;
2256
+ }, SchemaNode], [{
2257
+ oneOf: ReadonlyArray<unknown>;
2258
+ }, UnionSchemaNode], [{
2259
+ anyOf: ReadonlyArray<unknown>;
2260
+ }, UnionSchemaNode], [{
2261
+ const: null;
2262
+ }, ScalarSchemaNode], [{
2263
+ const: string | number | boolean;
2264
+ }, EnumSchemaNode], [{
2265
+ type: ReadonlyArray<string>;
2266
+ }, UnionSchemaNode], [{
2267
+ type: 'array';
2268
+ enum: ReadonlyArray<unknown>;
2269
+ }, ArraySchemaNode], [{
2270
+ enum: ReadonlyArray<unknown>;
2271
+ }, EnumSchemaNode], [{
2272
+ type: 'enum';
2273
+ }, EnumSchemaNode], [{
2274
+ type: 'union';
2275
+ }, UnionSchemaNode], [{
2276
+ type: 'intersection';
2277
+ }, IntersectionSchemaNode], [{
2278
+ type: 'tuple';
2279
+ }, ArraySchemaNode], [{
2280
+ type: 'ref';
2281
+ }, RefSchemaNode], [{
2282
+ type: 'datetime';
2283
+ }, DatetimeSchemaNode], [{
2284
+ type: 'date';
2285
+ }, DateSchemaNode], [{
2286
+ type: 'time';
2287
+ }, TimeSchemaNode], [{
2288
+ type: 'url';
2289
+ }, UrlSchemaNode], [{
2290
+ type: 'object';
2291
+ }, ObjectSchemaNode], [{
2292
+ additionalProperties: boolean | {};
2293
+ }, ObjectSchemaNode], [{
2294
+ type: 'array';
2295
+ }, ArraySchemaNode], [{
2296
+ items: object;
2297
+ }, ArraySchemaNode], [{
2298
+ prefixItems: ReadonlyArray<unknown>;
2299
+ }, ArraySchemaNode], [{
2300
+ type: string;
2301
+ format: 'date-time';
2302
+ }, ResolveDateTimeNode<TDateType>], [{
2303
+ type: string;
2304
+ format: 'date';
2305
+ }, DateSchemaNode], [{
2306
+ type: string;
2307
+ format: 'time';
2308
+ }, TimeSchemaNode], [{
2309
+ format: 'date-time';
2310
+ }, ResolveDateTimeNode<TDateType>], [{
2311
+ format: 'date';
2312
+ }, DateSchemaNode], [{
2313
+ format: 'time';
2314
+ }, TimeSchemaNode], [{
2315
+ type: 'string';
2316
+ }, StringSchemaNode], [{
2317
+ type: 'number';
2318
+ }, NumberSchemaNode], [{
2319
+ type: 'integer';
2320
+ }, NumberSchemaNode], [{
2321
+ type: 'bigint';
2322
+ }, NumberSchemaNode], [{
2323
+ type: string;
2324
+ }, ScalarSchemaNode], [{
2325
+ minLength: number;
2326
+ }, StringSchemaNode], [{
2327
+ maxLength: number;
2328
+ }, StringSchemaNode], [{
2329
+ pattern: string;
2330
+ }, StringSchemaNode], [{
2331
+ minimum: number;
2332
+ }, NumberSchemaNode], [{
2333
+ maximum: number;
2334
+ }, NumberSchemaNode]];
2335
+ /**
2336
+ * Infers the matching AST `SchemaNode` type from an input schema shape.
2337
+ */
2338
+ 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;
2339
+ //#endregion
2340
+ //#region src/factory.d.ts
2341
+ /**
2342
+ * Updates a schema's `optional` and `nullish` flags from a parent's `required`
2343
+ * value and the schema's own `nullable`. Mirrors how OpenAPI parameters and
2344
+ * object properties combine "required" and "nullable" into a single AST.
2345
+ *
2346
+ * - Non-required + non-nullable → `optional: true`.
2347
+ * - Non-required + nullable → `nullish: true`.
2348
+ * - Required → both flags cleared.
2349
+ */
2350
+ declare function syncOptionality(schema: SchemaNode, required: boolean): SchemaNode;
2351
+ /**
2352
+ * Distributive `Omit` that preserves each member of a union.
2353
+ *
2354
+ * @example
2355
+ * ```ts
2356
+ * type A = { kind: 'a'; keep: string; drop: number }
2357
+ * type B = { kind: 'b'; keep: boolean; drop: number }
2358
+ * type Result = DistributiveOmit<A | B, 'drop'>
2359
+ * // -> { kind: 'a'; keep: string } | { kind: 'b'; keep: boolean }
2360
+ * ```
2361
+ */
2362
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
2363
+ /**
2364
+ * Identity-preserving node update: returns `node` unchanged when every field in
2365
+ * `changes` already equals (by reference) the current value, otherwise a new node
2366
+ * with the changes applied.
2367
+ *
2368
+ * Mirrors the TypeScript compiler's `factory.updateX` contract — pair it with the
2369
+ * structural sharing in {@link transform} so a no-op rewrite doesn't allocate and
2370
+ * downstream passes can detect "nothing changed" by identity. Comparison is
2371
+ * shallow: a structurally-equal but newly-allocated array/object counts as a change.
2372
+ *
2373
+ * @example
2374
+ * ```ts
2375
+ * update(node, { name: node.name }) // -> same `node` reference
2376
+ * update(node, { name: 'renamed' }) // -> new node, `name` replaced
2377
+ * ```
2378
+ */
2379
+ declare function update<T extends Node>(node: T, changes: Partial<T>): T;
2380
+ type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & {
2381
+ properties?: Array<PropertyNode>;
2382
+ primitive?: 'object';
2383
+ };
2384
+ type CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>;
2385
+ type CreateSchemaOutput<T extends CreateSchemaInput> = InferSchemaNode<T> & {
2386
+ kind: 'Schema';
2387
+ };
2388
+ /**
2389
+ * Creates an `InputNode` with stable defaults for `schemas` and `operations`.
2390
+ *
2391
+ * @example
2392
+ * ```ts
2393
+ * const input = createInput()
2394
+ * // { kind: 'Input', schemas: [], operations: [] }
2395
+ * ```
2396
+ *
2397
+ * @example
2398
+ * ```ts
2399
+ * const input = createInput({ schemas: [petSchema] })
2400
+ * // keeps default operations: []
2401
+ * ```
2402
+ */
2403
+ declare function createInput(overrides?: Partial<Omit<InputNode, 'kind'>>): InputNode;
2404
+ /**
2405
+ * Creates an `InputStreamNode` from pre-built `AsyncIterable` sources.
2406
+ *
2407
+ * @example
2408
+ * ```ts
2409
+ * const node = createStreamInput(schemasIterable, operationsIterable, { title: 'My API' })
2410
+ * ```
2411
+ */
2412
+ declare function createStreamInput(schemas: AsyncIterable<SchemaNode>, operations: AsyncIterable<OperationNode>, meta?: InputMeta): InputStreamNode;
2413
+ /**
2414
+ * Creates an `OutputNode` with a stable default for `files`.
2415
+ *
2416
+ * @example
2417
+ * ```ts
2418
+ * const output = createOutput()
2419
+ * // { kind: 'Output', files: [] }
2420
+ * ```
2421
+ *
2422
+ * @example
2423
+ * ```ts
2424
+ * const output = createOutput({ files: [petFile] })
2425
+ * ```
2426
+ */
2427
+ declare function createOutput(overrides?: Partial<Omit<OutputNode, 'kind'>>): OutputNode;
2428
+ /**
2429
+ * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.
2430
+ *
2431
+ * @example
2432
+ * ```ts
2433
+ * const operation = createOperation({
2434
+ * operationId: 'getPetById',
2435
+ * method: 'GET',
2436
+ * path: '/pet/{petId}',
2437
+ * })
2438
+ * // tags, parameters, and responses are []
2439
+ * ```
2440
+ *
2441
+ * @example
2442
+ * ```ts
2443
+ * const operation = createOperation({
2444
+ * operationId: 'findPets',
2445
+ * method: 'GET',
2446
+ * path: '/pet/findByStatus',
2447
+ * tags: ['pet'],
2448
+ * })
2449
+ * ```
2450
+ */
2451
+ /**
2452
+ * Loosely-typed content entry accepted by the builders, normalized into a {@link ContentNode}.
2453
+ */
2454
+ type UserContent = Omit<ContentNode, 'kind'>;
2455
+ /**
2456
+ * Creates a `ContentNode` for a single request-body or response content type.
2457
+ */
2458
+ /**
2459
+ * Loosely-typed request body accepted by `createOperation`, normalized into a {@link RequestBodyNode}.
2460
+ */
2461
+ type UserRequestBody = Omit<RequestBodyNode, 'kind' | 'content'> & {
2462
+ content?: Array<UserContent>;
2463
+ };
2464
+ /**
2465
+ * Creates a `RequestBodyNode`, normalizing each content entry into a `ContentNode`.
2466
+ */
2467
+ declare function createOperation(props: Pick<HttpOperationNode, 'operationId' | 'method' | 'path'> & Partial<Omit<HttpOperationNode, 'kind' | 'operationId' | 'method' | 'path' | 'requestBody'>> & {
2468
+ requestBody?: UserRequestBody;
2469
+ }): HttpOperationNode;
2470
+ declare function createOperation(props: Pick<GenericOperationNode, 'operationId'> & Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {
2471
+ requestBody?: UserRequestBody;
2472
+ }): GenericOperationNode;
2473
+ /**
2474
+ * Creates a `SchemaNode`, narrowed to the variant of `props.type`.
2475
+ * For object schemas, `properties` defaults to an empty array.
2476
+ * `primitive` is automatically inferred from `type` when not explicitly provided.
2477
+ *
2478
+ * @example
2479
+ * ```ts
2480
+ * const scalar = createSchema({ type: 'string' })
2481
+ * // { kind: 'Schema', type: 'string', primitive: 'string' }
2482
+ * ```
2483
+ *
2484
+ * @example
2485
+ * ```ts
2486
+ * const uuid = createSchema({ type: 'uuid' })
2487
+ * // { kind: 'Schema', type: 'uuid', primitive: 'string' }
2488
+ * ```
2489
+ *
2490
+ * @example
2491
+ * ```ts
2492
+ * const object = createSchema({ type: 'object' })
2493
+ * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }
2494
+ * ```
2495
+ *
2496
+ * @example
2497
+ * ```ts
2498
+ * const enumSchema = createSchema({
2499
+ * type: 'enum',
2500
+ * primitive: 'string',
2501
+ * enumValues: ['available', 'pending'],
2502
+ * })
2503
+ * ```
2504
+ */
2505
+ declare function createSchema<T extends CreateSchemaInput>(props: T): CreateSchemaOutput<T>;
2506
+ declare function createSchema(props: CreateSchemaInput): SchemaNode;
2507
+ type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>;
2508
+ /**
2509
+ * Creates a `PropertyNode`.
2510
+ *
2511
+ * `required` defaults to `false`.
2512
+ * `schema.optional` and `schema.nullish` are derived from `required` and `schema.nullable`.
2513
+ *
2514
+ * @example
2515
+ * ```ts
2516
+ * const property = createProperty({
2517
+ * name: 'status',
2518
+ * schema: createSchema({ type: 'string' }),
2519
+ * })
2520
+ * // required=false, schema.optional=true
2521
+ * ```
2522
+ *
2523
+ * @example
2524
+ * ```ts
2525
+ * const property = createProperty({
2526
+ * name: 'status',
2527
+ * required: true,
2528
+ * schema: createSchema({ type: 'string', nullable: true }),
2529
+ * })
2530
+ * // required=true, no optional/nullish
2531
+ * ```
2532
+ */
2533
+ declare function createProperty(props: UserPropertyNode): PropertyNode;
2534
+ /**
2535
+ * Creates a `ParameterNode`.
2536
+ *
2537
+ * `required` defaults to `false`.
2538
+ * Nested schema flags are set from `required` and `schema.nullable`.
2539
+ *
2540
+ * @example
2541
+ * ```ts
2542
+ * const param = createParameter({
2543
+ * name: 'petId',
2544
+ * in: 'path',
2545
+ * required: true,
2546
+ * schema: createSchema({ type: 'string' }),
2547
+ * })
2548
+ * ```
2549
+ *
2550
+ * @example
2551
+ * ```ts
2552
+ * const param = createParameter({
2553
+ * name: 'status',
2554
+ * in: 'query',
2555
+ * schema: createSchema({ type: 'string', nullable: true }),
2556
+ * })
2557
+ * // required=false, schema.nullish=true
2558
+ * ```
2559
+ */
2560
+ declare function createParameter(props: Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>): ParameterNode;
2561
+ /**
2562
+ * Creates a `ResponseNode`.
2563
+ *
2564
+ * Response body schemas live inside `content`. For convenience a single legacy `schema`
2565
+ * (with optional `mediaType`/`keysToOmit`) is normalized into one `content` entry, so the same
2566
+ * schema is never stored both at the node root and inside `content`.
2567
+ *
2568
+ * @example
2569
+ * ```ts
2570
+ * const response = createResponse({
2571
+ * statusCode: '200',
2572
+ * content: [{ contentType: 'application/json', schema: createSchema({ type: 'object', properties: [] }) }],
2573
+ * })
2574
+ * ```
2575
+ */
2576
+ declare function createResponse(props: Pick<ResponseNode, 'statusCode'> & Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'content'>> & {
2577
+ content?: Array<UserContent>;
2578
+ schema?: SchemaNode;
2579
+ mediaType?: string | null;
2580
+ keysToOmit?: Array<string> | null;
2581
+ }): ResponseNode;
2582
+ /**
2583
+ * Creates a `FunctionParameterNode`.
2584
+ *
2585
+ * `optional` defaults to `false`.
2586
+ *
2587
+ * @example Required typed param
2588
+ * ```ts
2589
+ * createFunctionParameter({ name: 'petId', type: createParamsType({ variant: 'reference', name: 'string' }) })
2590
+ * // → petId: string
2591
+ * ```
2592
+ *
2593
+ * @example Optional param
2594
+ * ```ts
2595
+ * createFunctionParameter({ name: 'params', type: createParamsType({ variant: 'reference', name: 'QueryParams' }), optional: true })
2596
+ * // → params?: QueryParams
2597
+ * ```
2598
+ *
2599
+ * @example Param with default (implicitly optional; cannot combine with `optional: true`)
2600
+ * ```ts
2601
+ * createFunctionParameter({ name: 'config', type: createParamsType({ variant: 'reference', name: 'RequestConfig' }), default: '{}' })
2602
+ * // → config: RequestConfig = {}
2603
+ * ```
2604
+ */
2605
+ declare function createFunctionParameter(props: {
2606
+ name: string;
2607
+ type?: ParamsTypeNode;
2608
+ rest?: boolean;
2609
+ } & ({
2610
+ optional: true;
2611
+ default?: never;
2612
+ } | {
2613
+ optional?: false;
2614
+ default?: string;
2615
+ })): FunctionParameterNode;
2616
+ /**
2617
+ * Creates a {@link TypeNode} representing a language-agnostic structured type expression.
2618
+ *
2619
+ * Use `variant: 'struct'` for inline anonymous types and `variant: 'member'` for a single
2620
+ * named field accessed from a group type. Each language's printer renders the variant
2621
+ * into its own syntax (TypeScript, Python, C#, Kotlin, …).
2622
+ *
2623
+ * @example Reference type (TypeScript: `QueryParams`)
2624
+ * ```ts
2625
+ * createParamsType({ variant: 'reference', name: 'QueryParams' })
2626
+ * ```
2627
+ *
2628
+ * @example Struct type (TypeScript: `{ petId: string }`)
2629
+ * ```ts
2630
+ * createParamsType({ variant: 'struct', properties: [{ name: 'petId', optional: false, type: createParamsType({ variant: 'reference', name: 'string' }) }] })
2631
+ * ```
2632
+ *
2633
+ * @example Member type (TypeScript: `DeletePetPathParams['petId']`)
2634
+ * ```ts
2635
+ * createParamsType({ variant: 'member', base: 'DeletePetPathParams', key: 'petId' })
2636
+ * ```
2637
+ */
2638
+ declare function createParamsType(props: {
2639
+ variant: 'reference';
2640
+ name: string;
2641
+ } | {
2642
+ variant: 'struct';
2643
+ properties: Array<{
2644
+ name: string;
2645
+ optional: boolean;
2646
+ type: ParamsTypeNode;
2647
+ }>;
2648
+ } | {
2649
+ variant: 'member';
2650
+ base: string;
2651
+ key: string;
2652
+ }): ParamsTypeNode;
2653
+ /**
2654
+ * Creates a `ParameterGroupNode` representing a group of related parameters treated as a unit.
2655
+ *
2656
+ * @example Grouped param (TypeScript declaration)
2657
+ * ```ts
2658
+ * createParameterGroup({
2659
+ * properties: [
2660
+ * createFunctionParameter({ name: 'id', type: createParamsType({ variant: 'reference', name: 'string' }), optional: false }),
2661
+ * createFunctionParameter({ name: 'name', type: createParamsType({ variant: 'reference', name: 'string' }), optional: true }),
2662
+ * ],
2663
+ * default: '{}',
2664
+ * })
2665
+ * // declaration → { id, name? }: { id: string; name?: string } = {}
2666
+ * // call → { id, name }
2667
+ * ```
2668
+ *
2669
+ * @example Inline (spread) — children emitted as individual top-level parameters
2670
+ * ```ts
2671
+ * createParameterGroup({
2672
+ * properties: [createFunctionParameter({ name: 'petId', type: createParamsType({ variant: 'reference', name: 'string' }), optional: false })],
2673
+ * inline: true,
2674
+ * })
2675
+ * // declaration → petId: string
2676
+ * // call → petId
2677
+ * ```
2678
+ */
2679
+ declare function createParameterGroup(props: Pick<ParameterGroupNode, 'properties'> & Partial<Omit<ParameterGroupNode, 'kind' | 'properties'>>): ParameterGroupNode;
2680
+ /**
2681
+ * Creates a `FunctionParametersNode` from an ordered list of parameters.
2682
+ *
2683
+ * @example
2684
+ * ```ts
2685
+ * createFunctionParameters({
2686
+ * params: [
2687
+ * createFunctionParameter({ name: 'petId', type: createParamsType({ variant: 'reference', name: 'string' }), optional: false }),
2688
+ * createFunctionParameter({ name: 'config', type: createParamsType({ variant: 'reference', name: 'RequestConfig' }), optional: false, default: '{}' }),
2689
+ * ],
2690
+ * })
2691
+ * ```
2692
+ *
2693
+ * @example
2694
+ * ```ts
2695
+ * const empty = createFunctionParameters()
2696
+ * // { kind: 'FunctionParameters', params: [] }
2697
+ * ```
2698
+ */
2699
+ declare function createFunctionParameters(props?: Partial<Omit<FunctionParametersNode, 'kind'>>): FunctionParametersNode;
2700
+ /**
2701
+ * Creates an `ImportNode` representing a language-agnostic import/dependency declaration.
2702
+ *
2703
+ * @example Named import
2704
+ * ```ts
2705
+ * createImport({ name: ['useState'], path: 'react' })
2706
+ * // import { useState } from 'react'
2707
+ * ```
2708
+ *
2709
+ * @example Type-only import
2710
+ * ```ts
2711
+ * createImport({ name: ['FC'], path: 'react', isTypeOnly: true })
2712
+ * // import type { FC } from 'react'
2713
+ * ```
2714
+ */
2715
+ declare function createImport(props: Omit<ImportNode, 'kind'>): ImportNode;
2716
+ /**
2717
+ * Creates an `ExportNode` representing a language-agnostic export/public API declaration.
2718
+ *
2719
+ * @example Named export
2720
+ * ```ts
2721
+ * createExport({ name: ['Pet'], path: './Pet' })
2722
+ * // export { Pet } from './Pet'
2723
+ * ```
2724
+ *
2725
+ * @example Wildcard export
2726
+ * ```ts
2727
+ * createExport({ path: './utils' })
2728
+ * // export * from './utils'
2729
+ * ```
2730
+ */
2731
+ declare function createExport(props: Omit<ExportNode, 'kind'>): ExportNode;
2732
+ /**
2733
+ * Creates a `SourceNode` representing a fragment of source code within a file.
2734
+ *
2735
+ * @example
2736
+ * ```ts
2737
+ * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })
2738
+ * ```
2739
+ */
2740
+ declare function createSource(props: Omit<SourceNode, 'kind'>): SourceNode;
2741
+ type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind' | 'id' | 'name' | 'extname' | 'imports' | 'exports' | 'sources'> & Pick<Partial<FileNode<TMeta>>, 'imports' | 'exports' | 'sources'>;
2742
+ /**
2743
+ * Creates a fully resolved `FileNode` from a file input descriptor.
2744
+ *
2745
+ * Computes:
2746
+ * - `id` — SHA256 hash of the file path
2747
+ * - `name` — `baseName` without extension
2748
+ * - `extname` — extension extracted from `baseName`
2749
+ *
2750
+ * Deduplicates:
2751
+ * - `sources` via `combineSources`
2752
+ * - `exports` via `combineExports`
2753
+ * - `imports` via `combineImports` (also filters unused imports)
2754
+ *
2755
+ * @throws {Error} when `baseName` has no extension.
2756
+ *
2757
+ * @example
2758
+ * ```ts
2759
+ * const file = createFile({
2760
+ * baseName: 'petStore.ts',
2761
+ * path: 'src/models/petStore.ts',
2762
+ * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')] })],
2763
+ * imports: [createImport({ name: ['z'], path: 'zod' })],
2764
+ * exports: [createExport({ name: ['Pet'], path: './petStore' })],
2765
+ * })
2766
+ * // file.id = SHA256 hash of 'src/models/petStore.ts'
2767
+ * // file.name = 'petStore'
2768
+ * // file.extname = '.ts'
2769
+ * ```
2770
+ */
2771
+ declare function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta>;
2772
+ /**
2773
+ * Creates a `ConstNode` representing a TypeScript `const` declaration.
2774
+ *
2775
+ * Mirrors the `Const` component from `@kubb/renderer-jsx`.
2776
+ * The component's `children` are represented as `nodes`.
2777
+ *
2778
+ * @example Simple constant
2779
+ * ```ts
2780
+ * createConst({ name: 'pet' })
2781
+ * // const pet = ...
2782
+ * ```
2783
+ *
2784
+ * @example Exported constant with type and `as const`
2785
+ * ```ts
2786
+ * createConst({ name: 'pets', export: true, type: 'Pet[]', asConst: true })
2787
+ * // export const pets: Pet[] = ... as const
2788
+ * ```
2789
+ *
2790
+ * @example With JSDoc and child nodes
2791
+ * ```ts
2792
+ * createConst({
2793
+ * name: 'config',
2794
+ * export: true,
2795
+ * JSDoc: { comments: ['@description App configuration'] },
2796
+ * nodes: [],
2797
+ * })
2798
+ * ```
2799
+ */
2800
+ declare function createConst(props: Omit<ConstNode, 'kind'>): ConstNode;
2801
+ /**
2802
+ * Creates a `TypeNode` representing a TypeScript `type` alias declaration.
2803
+ *
2804
+ * Mirrors the `Type` component from `@kubb/renderer-jsx`.
2805
+ * The component's `children` are represented as `nodes`.
2806
+ *
2807
+ * @example Simple type alias
2808
+ * ```ts
2809
+ * createType({ name: 'Pet' })
2810
+ * // type Pet = ...
2811
+ * ```
2812
+ *
2813
+ * @example Exported type with JSDoc
2814
+ * ```ts
2815
+ * createType({
2816
+ * name: 'PetStatus',
2817
+ * export: true,
2818
+ * JSDoc: { comments: ['@description Status of a pet'] },
2819
+ * })
2820
+ * // export type PetStatus = ...
2821
+ * ```
2822
+ */
2823
+ declare function createType(props: Omit<TypeNode, 'kind'>): TypeNode;
2824
+ /**
2825
+ * Creates a `FunctionNode` representing a TypeScript `function` declaration.
2826
+ *
2827
+ * Mirrors the `Function` component from `@kubb/renderer-jsx`.
2828
+ * The component's `children` are represented as `nodes`.
2829
+ *
2830
+ * @example Simple function
2831
+ * ```ts
2832
+ * createFunction({ name: 'getPet' })
2833
+ * // function getPet() { ... }
2834
+ * ```
2835
+ *
2836
+ * @example Exported async function with return type
2837
+ * ```ts
2838
+ * createFunction({ name: 'fetchPet', export: true, async: true, returnType: 'Pet' })
2839
+ * // export async function fetchPet(): Promise<Pet> { ... }
2840
+ * ```
2841
+ *
2842
+ * @example Function with generics and params
2843
+ * ```ts
2844
+ * createFunction({
2845
+ * name: 'identity',
2846
+ * export: true,
2847
+ * generics: ['T'],
2848
+ * params: 'value: T',
2849
+ * returnType: 'T',
2850
+ * })
2851
+ * // export function identity<T>(value: T): T { ... }
2852
+ * ```
2853
+ */
2854
+ declare function createFunction(props: Omit<FunctionNode, 'kind'>): FunctionNode;
2855
+ /**
2856
+ * Creates an `ArrowFunctionNode` representing a TypeScript arrow function.
2857
+ *
2858
+ * Mirrors the `Function.Arrow` component from `@kubb/renderer-jsx`.
2859
+ * The component's `children` are represented as `nodes`.
2860
+ *
2861
+ * @example Simple arrow function
2862
+ * ```ts
2863
+ * createArrowFunction({ name: 'getPet' })
2864
+ * // const getPet = () => { ... }
2865
+ * ```
2866
+ *
2867
+ * @example Single-line exported arrow function
2868
+ * ```ts
2869
+ * createArrowFunction({ name: 'double', export: true, params: 'n: number', singleLine: true })
2870
+ * // export const double = (n: number) => ...
2871
+ * ```
2872
+ *
2873
+ * @example Async arrow function with generics
2874
+ * ```ts
2875
+ * createArrowFunction({
2876
+ * name: 'fetchPet',
2877
+ * export: true,
2878
+ * async: true,
2879
+ * generics: ['T'],
2880
+ * params: 'id: string',
2881
+ * returnType: 'T',
2882
+ * })
2883
+ * // export const fetchPet = async <T>(id: string): Promise<T> => { ... }
2884
+ * ```
2885
+ */
2886
+ declare function createArrowFunction(props: Omit<ArrowFunctionNode, 'kind'>): ArrowFunctionNode;
2887
+ /**
2888
+ * Creates a {@link TextNode} representing a raw string fragment in the source output.
2889
+ *
2890
+ * Use this instead of bare strings when building `nodes` arrays so that every
2891
+ * entry in the array is a typed {@link CodeNode}.
2892
+ *
2893
+ * @example
2894
+ * ```ts
2895
+ * createText('return fetch(id)')
2896
+ * // { kind: 'Text', value: 'return fetch(id)' }
2897
+ * ```
2898
+ */
2899
+ declare function createText(value: string): TextNode;
2900
+ /**
2901
+ * Creates a {@link BreakNode} representing a line break in the source output.
2902
+ *
2903
+ * Corresponds to `<br/>` in JSX components. Prints as an empty string which,
2904
+ * when joined with `\n` by `printNodes`, produces a blank line.
2905
+ *
2906
+ * @example
2907
+ * ```ts
2908
+ * createBreak()
2909
+ * // { kind: 'Break' }
2910
+ * ```
2911
+ */
2912
+ declare function createBreak(): BreakNode;
2913
+ /**
2914
+ * Creates a {@link JsxNode} representing a raw JSX fragment in the source output.
2915
+ *
2916
+ * Use this to embed JSX markup (including fragments `<>…</>`) directly in generated code.
2917
+ *
2918
+ * @example
2919
+ * ```ts
2920
+ * createJsx('<>\n <a href={href}>Open</a>\n</>')
2921
+ * // { kind: 'Jsx', value: '<>\n <a href={href}>Open</a>\n</>' }
2922
+ * ```
2923
+ */
2924
+ declare function createJsx(value: string): JsxNode;
2925
+ //#endregion
2926
+ //#region src/printer.d.ts
2927
+ /**
2928
+ * Runtime context passed as `this` to printer handlers.
2929
+ *
2930
+ * `this.transform` dispatches to node-level handlers from `nodes`.
2931
+ *
2932
+ * @example
2933
+ * ```ts
2934
+ * const context: PrinterHandlerContext<string, {}> = {
2935
+ * options: {},
2936
+ * transform: () => 'value',
2937
+ * }
2938
+ * ```
2939
+ */
2940
+ type PrinterHandlerContext<TOutput, TOptions extends object> = {
2941
+ /**
2942
+ * Recursively transform a nested `SchemaNode` to `TOutput` using the node-level handlers.
2943
+ * Use `this.transform` inside `nodes` handlers and inside the `print` override.
2944
+ */
2945
+ transform: (node: SchemaNode) => TOutput | null;
2946
+ /**
2947
+ * Options for this printer instance.
2948
+ */
2949
+ options: TOptions;
2950
+ };
2951
+ /**
2952
+ * Handler for one schema node type.
2953
+ *
2954
+ * Use a regular function (not an arrow function) if you need `this`.
2955
+ *
2956
+ * @example
2957
+ * ```ts
2958
+ * const handler: PrinterHandler<string, {}, 'string'> = function () {
2959
+ * return 'string'
2960
+ * }
2961
+ * ```
2962
+ */
2963
+ type PrinterHandler<TOutput, TOptions extends object, T extends SchemaType = SchemaType> = (this: PrinterHandlerContext<TOutput, TOptions>, node: SchemaNodeByType[T]) => TOutput | null;
2964
+ /**
2965
+ * Partial map of per-node-type handler overrides for a printer.
2966
+ *
2967
+ * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`).
2968
+ * Supply only the handlers you want to replace; the printer's built-in
2969
+ * defaults fill in the rest.
2970
+ *
2971
+ * @example
2972
+ * ```ts
2973
+ * pluginZod({
2974
+ * printer: {
2975
+ * nodes: {
2976
+ * date(): string {
2977
+ * return 'z.string().date()'
2978
+ * },
2979
+ * } satisfies PrinterPartial<string, PrinterZodOptions>,
2980
+ * },
2981
+ * })
2982
+ * ```
2983
+ */
2984
+ type PrinterPartial<TOutput, TOptions extends object> = Partial<{ [K in SchemaType]: PrinterHandler<TOutput, TOptions, K> }>;
2985
+ /**
2986
+ * Generic shape used by `definePrinter`.
2987
+ *
2988
+ * - `TName` — unique string identifier (e.g. `'zod'`, `'ts'`)
2989
+ * - `TOptions` — options passed to and stored on the printer instance
2990
+ * - `TOutput` — the type emitted by node handlers
2991
+ * - `TPrintOutput` — type returned by public `print` (defaults to `TOutput`)
2992
+ *
2993
+ * @example
2994
+ * ```ts
2995
+ * type MyPrinter = PrinterFactoryOptions<'my', { strict: boolean }, string>
2996
+ * ```
2997
+ */
2998
+ type PrinterFactoryOptions<TName extends string = string, TOptions extends object = object, TOutput = unknown, TPrintOutput = TOutput> = {
2999
+ name: TName;
3000
+ options: TOptions;
3001
+ output: TOutput;
3002
+ printOutput: TPrintOutput;
3003
+ };
3004
+ /**
3005
+ * Printer instance returned by a printer factory.
3006
+ *
3007
+ * @example
3008
+ * ```ts
3009
+ * const printer = definePrinter((options: {}) => ({ name: 'x', options, nodes: {} }))({})
3010
+ * ```
3011
+ */
3012
+ type Printer<T extends PrinterFactoryOptions = PrinterFactoryOptions> = {
3013
+ /**
3014
+ * Unique identifier supplied at creation time.
3015
+ */
3016
+ name: T['name'];
3017
+ /**
3018
+ * Options for this printer instance.
3019
+ */
3020
+ options: T['options'];
3021
+ /**
3022
+ * Node-level dispatcher — converts a `SchemaNode` directly to `TOutput` using the `nodes` handlers.
3023
+ * Always dispatches through the `nodes` map; never calls the `print` override.
3024
+ * Use this when you need the raw output (e.g. `ts.TypeNode`) without declaration wrapping.
3025
+ */
3026
+ transform: (node: SchemaNode) => T['output'] | null;
3027
+ /**
3028
+ * Public printer. If the builder provides a root-level `print`, this calls that
3029
+ * higher-level function (which may produce full declarations).
3030
+ * Otherwise, falls back to the node-level dispatcher.
3031
+ */
3032
+ print: (node: SchemaNode) => T['printOutput'] | null;
3033
+ };
3034
+ /**
3035
+ * Builder function passed to `definePrinter`.
3036
+ *
3037
+ * It receives resolved options and returns:
3038
+ * - `name`
3039
+ * - `options`
3040
+ * - `nodes` handlers
3041
+ * - optional top-level `print` override
3042
+ *
3043
+ * @example
3044
+ * ```ts
3045
+ * const build = (options: {}) => ({ name: 'x' as const, options, nodes: {} })
3046
+ * ```
3047
+ */
3048
+ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) => {
3049
+ name: T['name'];
3050
+ /**
3051
+ * Options to store on the printer.
3052
+ */
3053
+ options: T['options'];
3054
+ nodes: Partial<{ [K in SchemaType]: PrinterHandler<T['output'], T['options'], K> }>;
3055
+ /**
3056
+ * Optional root-level print override. When provided, becomes the public `printer.print`.
3057
+ * Use `this.transform(node)` inside this function to dispatch to the node-level handlers (`nodes`),
3058
+ * not the override itself — so recursion is safe.
3059
+ */
3060
+ print?: (this: PrinterHandlerContext<T['output'], T['options']>, node: SchemaNode) => T['printOutput'] | null;
3061
+ };
3062
+ /**
3063
+ * Defines a schema printer: a function that takes a `SchemaNode` and emits
3064
+ * code in your target language. Each plugin that produces code from schemas
3065
+ * (TypeScript types, Zod schemas, Faker factories) ships a printer built
3066
+ * with this helper.
3067
+ *
3068
+ * The builder receives resolved options and returns:
3069
+ *
3070
+ * - `name` — unique identifier for the printer.
3071
+ * - `options` — stored on the returned printer instance.
3072
+ * - `nodes` — map of `SchemaType` → handler. Handlers return the rendered
3073
+ * output (a string, a TypeScript AST node, ...) for that schema type.
3074
+ * - `print` (optional) — top-level override exposed as `printer.print`.
3075
+ * Use `this.transform(node)` inside it to dispatch to `nodes` recursively.
3076
+ *
3077
+ * Without a `print` override, `printer.print` falls back to `printer.transform`
3078
+ * (the node-level dispatcher).
3079
+ *
3080
+ * @example Tiny Zod printer
3081
+ * ```ts
3082
+ * import { definePrinter, type PrinterFactoryOptions } from '@kubb/ast'
3083
+ *
3084
+ * type PrinterZod = PrinterFactoryOptions<'zod', { strict?: boolean }, string>
3085
+ *
3086
+ * export const zodPrinter = definePrinter<PrinterZod>((options) => ({
3087
+ * name: 'zod',
3088
+ * options: { strict: options.strict ?? true },
3089
+ * nodes: {
3090
+ * string: () => 'z.string()',
3091
+ * object(node) {
3092
+ * const props = node.properties
3093
+ * .map((p) => `${p.name}: ${this.transform(p.schema)}`)
3094
+ * .join(', ')
3095
+ * return `z.object({ ${props} })`
3096
+ * },
3097
+ * },
3098
+ * }))
3099
+ * ```
3100
+ */
3101
+ declare function definePrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
3102
+ /**
3103
+ * Generic printer-factory function used by `definePrinter` and `defineFunctionPrinter`.
3104
+ **
3105
+ * @example
3106
+ * ```ts
3107
+ * export const defineFunctionPrinter = createPrinterFactory<FunctionNode, FunctionNodeType, FunctionNodeByType>(
3108
+ * (node) => kindToHandlerKey[node.kind],
3109
+ * )
3110
+ * ```
3111
+ */
3112
+ declare function createPrinterFactory<TNode, TKey extends string, TNodeByKey extends Partial<Record<TKey, TNode>>>(getKey: (node: TNode) => TKey | null): <T extends PrinterFactoryOptions>(build: (options: T["options"]) => {
3113
+ name: T["name"];
3114
+ options: T["options"];
3115
+ nodes: Partial<{ [K in TKey]: (this: {
3116
+ transform: (node: TNode) => T["output"] | null;
3117
+ options: T["options"];
3118
+ }, node: TNodeByKey[K]) => T["output"] | null }>;
3119
+ print?: (this: {
3120
+ transform: (node: TNode) => T["output"] | null;
3121
+ options: T["options"];
3122
+ }, node: TNode) => T["printOutput"] | null;
3123
+ }) => (options?: T["options"]) => {
3124
+ name: T["name"];
3125
+ options: T["options"];
3126
+ transform: (node: TNode) => T["output"] | null;
3127
+ print: (node: TNode) => T["printOutput"] | null;
3128
+ };
3129
+ //#endregion
3130
+ //#region src/visitor.d.ts
3131
+ /**
3132
+ * Ordered mapping of `[NodeType, ParentType]` pairs.
3133
+ *
3134
+ * `ParentOf` uses this map to find parent types.
3135
+ */
3136
+ type ParentNodeMap = [[InputNode, undefined], [OutputNode, undefined], [OperationNode, InputNode], [RequestBodyNode, OperationNode], [ContentNode, RequestBodyNode | ResponseNode], [SchemaNode, InputNode | ContentNode | SchemaNode | PropertyNode | ParameterNode], [PropertyNode, SchemaNode], [ParameterNode, OperationNode], [ResponseNode, OperationNode]];
3137
+ /**
3138
+ * Resolves the parent node type for a given AST node type.
3139
+ *
3140
+ * This is used by visitor context so `ctx.parent` is correctly typed
3141
+ * for each callback.
3142
+ *
3143
+ * @example
3144
+ * ```ts
3145
+ * type InputParent = ParentOf<InputNode>
3146
+ * // undefined
3147
+ * ```
3148
+ *
3149
+ * @example
3150
+ * ```ts
3151
+ * type PropertyParent = ParentOf<PropertyNode>
3152
+ * // SchemaNode
3153
+ * ```
3154
+ *
3155
+ * @example
3156
+ * ```ts
3157
+ * type SchemaParent = ParentOf<SchemaNode>
3158
+ * // InputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode
3159
+ * ```
3160
+ */
3161
+ type ParentOf<T extends Node, TEntries extends ReadonlyArray<[Node, unknown]> = ParentNodeMap> = TEntries extends [infer TEntry extends [Node, unknown], ...infer TRest extends ReadonlyArray<[Node, unknown]>] ? T extends TEntry[0] ? TEntry[1] : ParentOf<T, TRest> : Node;
3162
+ /**
3163
+ * Traversal context passed as the second argument to every visitor callback.
3164
+ * `parent` is typed from the current node type.
3165
+ *
3166
+ * @example
3167
+ * ```ts
3168
+ * const visitor: Visitor = {
3169
+ * schema(node, { parent }) {
3170
+ * // parent type is narrowed by node kind
3171
+ * },
3172
+ * }
3173
+ * ```
3174
+ */
3175
+ type VisitorContext<T extends Node = Node> = {
3176
+ /**
3177
+ * Parent node of the currently visited node.
3178
+ * For `InputNode`, this is `undefined`.
3179
+ */
3180
+ parent?: ParentOf<T>;
3181
+ };
3182
+ /**
3183
+ * Synchronous visitor consumed by `transform`. Each optional callback runs
3184
+ * for the matching node type. Return a new node to replace it, or `undefined`
3185
+ * to leave it untouched.
3186
+ *
3187
+ * Plugins typically expose `transformer` so users can supply a `Visitor` that
3188
+ * rewrites operation IDs, drops descriptions, or otherwise tweaks the AST
3189
+ * before printing.
3190
+ *
3191
+ * @example Prefix every operationId
3192
+ * ```ts
3193
+ * const visitor: Visitor = {
3194
+ * operation(node) {
3195
+ * return { ...node, operationId: `api_${node.operationId}` }
3196
+ * },
3197
+ * }
3198
+ * ```
3199
+ *
3200
+ * @example Strip schema descriptions
3201
+ * ```ts
3202
+ * const visitor: Visitor = {
3203
+ * schema(node) {
3204
+ * return { ...node, description: undefined }
3205
+ * },
3206
+ * }
3207
+ * ```
3208
+ */
3209
+ type Visitor = {
3210
+ input?(node: InputNode, context: VisitorContext<InputNode>): undefined | null | InputNode;
3211
+ output?(node: OutputNode, context: VisitorContext<OutputNode>): undefined | null | OutputNode;
3212
+ operation?(node: OperationNode, context: VisitorContext<OperationNode>): undefined | null | OperationNode;
3213
+ schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): undefined | null | SchemaNode;
3214
+ property?(node: PropertyNode, context: VisitorContext<PropertyNode>): undefined | null | PropertyNode;
3215
+ parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): undefined | null | ParameterNode;
3216
+ response?(node: ResponseNode, context: VisitorContext<ResponseNode>): undefined | null | ResponseNode;
3217
+ };
3218
+ /**
3219
+ * Utility type for values that can be returned directly or asynchronously.
3220
+ */
3221
+ type MaybePromise<T> = T | Promise<T>;
3222
+ /**
3223
+ * Async visitor for `walk`. Synchronous `Visitor` objects are compatible.
3224
+ *
3225
+ * @example
3226
+ * ```ts
3227
+ * const visitor: AsyncVisitor = {
3228
+ * async operation(node) {
3229
+ * await Promise.resolve(node.operationId)
3230
+ * },
3231
+ * }
3232
+ * ```
3233
+ */
3234
+ type AsyncVisitor = {
3235
+ input?(node: InputNode, context: VisitorContext<InputNode>): MaybePromise<undefined | null | InputNode>;
3236
+ output?(node: OutputNode, context: VisitorContext<OutputNode>): MaybePromise<undefined | null | OutputNode>;
3237
+ operation?(node: OperationNode, context: VisitorContext<OperationNode>): MaybePromise<undefined | null | OperationNode>;
3238
+ schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): MaybePromise<undefined | null | SchemaNode>;
3239
+ property?(node: PropertyNode, context: VisitorContext<PropertyNode>): MaybePromise<undefined | null | PropertyNode>;
3240
+ parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): MaybePromise<undefined | null | ParameterNode>;
3241
+ response?(node: ResponseNode, context: VisitorContext<ResponseNode>): MaybePromise<undefined | null | ResponseNode>;
3242
+ };
3243
+ /**
3244
+ * Visitor used by `collect`.
3245
+ *
3246
+ * @example
3247
+ * ```ts
3248
+ * const visitor: CollectVisitor<string> = {
3249
+ * operation(node) {
3250
+ * return node.operationId
3251
+ * },
3252
+ * }
3253
+ * ```
3254
+ */
3255
+ type CollectVisitor<T> = {
3256
+ input?(node: InputNode, context: VisitorContext<InputNode>): T | null | undefined;
3257
+ output?(node: OutputNode, context: VisitorContext<OutputNode>): T | null | undefined;
3258
+ operation?(node: OperationNode, context: VisitorContext<OperationNode>): T | null | undefined;
3259
+ schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): T | null | undefined;
3260
+ property?(node: PropertyNode, context: VisitorContext<PropertyNode>): T | null | undefined;
3261
+ parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): T | null | undefined;
3262
+ response?(node: ResponseNode, context: VisitorContext<ResponseNode>): T | null | undefined;
3263
+ };
3264
+ /**
3265
+ * Options for `transform`.
3266
+ *
3267
+ * @example
3268
+ * ```ts
3269
+ * const options: TransformOptions = { depth: 'deep', schema: (node) => node }
3270
+ * ```
3271
+ *
3272
+ * @example
3273
+ * ```ts
3274
+ * // Only transform the current node, not nested children
3275
+ * const options: TransformOptions = { depth: 'shallow', schema: (node) => node }
3276
+ * ```
3277
+ */
3278
+ type TransformOptions = Visitor & {
3279
+ /**
3280
+ * Traversal depth (`'deep'` by default).
3281
+ * @default 'deep'
3282
+ */
3283
+ depth?: VisitorDepth;
3284
+ /**
3285
+ * Internal parent override used during recursion.
3286
+ */
3287
+ parent?: Node;
3288
+ };
3289
+ /**
3290
+ * Options for `walk`.
3291
+ *
3292
+ * @example
3293
+ * ```ts
3294
+ * const options: WalkOptions = { depth: 'deep', concurrency: 10, root: () => {} }
3295
+ * ```
3296
+ */
3297
+ type WalkOptions = AsyncVisitor & {
3298
+ /**
3299
+ * Traversal depth (`'deep'` by default).
3300
+ * @default 'deep'
3301
+ */
3302
+ depth?: VisitorDepth;
3303
+ /**
3304
+ * Maximum number of sibling nodes visited concurrently.
3305
+ * @default 30
3306
+ */
3307
+ concurrency?: number;
3308
+ };
3309
+ /**
3310
+ * Options for `collect`.
3311
+ *
3312
+ * @example
3313
+ * ```ts
3314
+ * const options: CollectOptions<string> = { depth: 'shallow', schema: () => undefined }
3315
+ * ```
3316
+ */
3317
+ type CollectOptions<T> = CollectVisitor<T> & {
3318
+ /**
3319
+ * Traversal depth (`'deep'` by default).
3320
+ * @default 'deep'
3321
+ */
3322
+ depth?: VisitorDepth;
3323
+ /**
3324
+ * Internal parent override used during recursion.
3325
+ */
3326
+ parent?: Node;
3327
+ };
3328
+ /**
3329
+ * Async depth-first traversal for side effects. Visitor return values are
3330
+ * ignored. Use `transform` when you want to rewrite nodes.
3331
+ *
3332
+ * Sibling nodes at each depth run concurrently up to `options.concurrency`
3333
+ * (defaults to `WALK_CONCURRENCY`). Higher values overlap I/O-bound visitor
3334
+ * work; lower values reduce memory pressure.
3335
+ *
3336
+ * @example Log every operation
3337
+ * ```ts
3338
+ * await walk(root, {
3339
+ * operation(node) {
3340
+ * console.log(node.operationId)
3341
+ * },
3342
+ * })
3343
+ * ```
3344
+ *
3345
+ * @example Only visit the root node
3346
+ * ```ts
3347
+ * await walk(root, { depth: 'shallow', input: () => {} })
3348
+ * ```
3349
+ */
3350
+ declare function walk(node: Node, options: WalkOptions): Promise<void>;
3351
+ /**
3352
+ * Synchronous depth-first transform. Each visitor callback gets a chance to
3353
+ * return a replacement node; `undefined` keeps the original.
3354
+ *
3355
+ * The transform is immutable. The original tree is not mutated; a new tree
3356
+ * is returned. Use `depth: 'shallow'` to skip recursion into children.
3357
+ *
3358
+ * @example Prefix every operationId
3359
+ * ```ts
3360
+ * const next = transform(root, {
3361
+ * operation(node) {
3362
+ * return { ...node, operationId: `prefixed_${node.operationId}` }
3363
+ * },
3364
+ * })
3365
+ * ```
3366
+ *
3367
+ * @example Replace only the root node
3368
+ * ```ts
3369
+ * const next = transform(root, {
3370
+ * depth: 'shallow',
3371
+ * input: (node) => ({ ...node, meta: { ...node.meta, title: 'Rewritten' } }),
3372
+ * })
3373
+ * ```
3374
+ */
3375
+ declare function transform(node: InputNode, options: TransformOptions): InputNode;
3376
+ declare function transform(node: OutputNode, options: TransformOptions): OutputNode;
3377
+ declare function transform(node: OperationNode, options: TransformOptions): OperationNode;
3378
+ declare function transform(node: SchemaNode, options: TransformOptions): SchemaNode;
3379
+ declare function transform(node: PropertyNode, options: TransformOptions): PropertyNode;
3380
+ declare function transform(node: ParameterNode, options: TransformOptions): ParameterNode;
3381
+ declare function transform(node: ResponseNode, options: TransformOptions): ResponseNode;
3382
+ declare function transform(node: Node, options: TransformOptions): Node;
3383
+ /**
3384
+ * Eager depth-first collection pass. Returns an array of every non-null value
3385
+ * the visitor callbacks return.
3386
+ *
3387
+ * @example Collect every operationId
3388
+ * ```ts
3389
+ * const ids = collect<string>(root, {
3390
+ * operation(node) {
3391
+ * return node.operationId
3392
+ * },
3393
+ * })
3394
+ * ```
3395
+ */
3396
+ declare function collect<T>(node: Node, options: CollectOptions<T>): Array<T>;
3397
+ //#endregion
3398
+ //#region src/utils.d.ts
3399
+ /**
3400
+ * Merges a ref node with its resolved schema, giving usage-site fields precedence.
3401
+ *
3402
+ * Usage-site fields (`description`, `readOnly`, `nullable`, `deprecated`) on the ref node
3403
+ * override the same fields in the resolved `node.schema`. Non-ref nodes are returned unchanged.
3404
+ *
3405
+ * @example
3406
+ * ```ts
3407
+ * // Ref with description override
3408
+ * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })
3409
+ * const merged = syncSchemaRef(ref) // merges with resolved Pet schema
3410
+ * ```
3411
+ */
3412
+ declare function syncSchemaRef(node: SchemaNode): SchemaNode;
3413
+ /**
3414
+ * Type guard that returns `true` when a schema emits as a plain `string` type.
3415
+ *
3416
+ * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`
3417
+ * types, returns `true` only when `representation` is `'string'` rather than `'date'`.
3418
+ */
3419
+ declare function isStringType(node: SchemaNode): boolean;
3420
+ declare function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode>;
3421
+ /**
3422
+ * Creates a single-property object schema used as a discriminator literal.
3423
+ *
3424
+ * @example
3425
+ * ```ts
3426
+ * createDiscriminantNode({ propertyName: 'type', value: 'dog' })
3427
+ * // -> { type: 'object', properties: [{ name: 'type', required: true, schema: enum('dog') }] }
3428
+ * ```
3429
+ */
3430
+ declare function createDiscriminantNode({
3431
+ propertyName,
3432
+ value
3433
+ }: {
3434
+ propertyName: string;
3435
+ value: string;
3436
+ }): SchemaNode;
3437
+ /**
3438
+ * Resolver interface for {@link createOperationParams}.
3439
+ *
3440
+ * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.
3441
+ */
3442
+ type OperationParamsResolver = {
3443
+ /**
3444
+ * Resolves the type name for an individual parameter.
3445
+ *
3446
+ * @example Individual path parameter name
3447
+ * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`
3448
+ */
3449
+ resolveParamName(node: OperationNode, param: ParameterNode): string;
3450
+ /**
3451
+ * Resolves the request body type name.
3452
+ *
3453
+ * @example Request body type name
3454
+ * `resolver.resolveDataName(node) // → 'CreatePetData'`
3455
+ */
3456
+ resolveDataName(node: OperationNode): string;
3457
+ /**
3458
+ * Resolves the grouped path parameters type name.
3459
+ * When the return value equals `resolveParamName`, no indexed access is emitted.
3460
+ *
3461
+ * @example Grouped path params type name
3462
+ * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`
3463
+ */
3464
+ resolvePathParamsName(node: OperationNode, param: ParameterNode): string;
3465
+ /**
3466
+ * Resolves the grouped query parameters type name.
3467
+ * When the return value equals `resolveParamName`, an inline struct type is emitted instead.
3468
+ *
3469
+ * @example Grouped query params type name
3470
+ * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`
3471
+ */
3472
+ resolveQueryParamsName(node: OperationNode, param: ParameterNode): string;
3473
+ /**
3474
+ * Resolves the grouped header parameters type name.
3475
+ * When the return value equals `resolveParamName`, an inline struct type is emitted instead.
3476
+ *
3477
+ * @example Grouped header params type name
3478
+ * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`
3479
+ */
3480
+ resolveHeaderParamsName(node: OperationNode, param: ParameterNode): string;
3481
+ };
3482
+ /**
3483
+ * Options for {@link createOperationParams}.
3484
+ */
3485
+ type CreateOperationParamsOptions = {
3486
+ /**
3487
+ * How all operation parameters are grouped in the function signature.
3488
+ * - `'object'` wraps all params into a single destructured object `{ petId, data, params }`
3489
+ * - `'inline'` emits each param category as a separate top-level parameter
3490
+ */
3491
+ paramsType: 'object' | 'inline';
3492
+ /**
3493
+ * How path parameters are emitted when `paramsType` is `'inline'`.
3494
+ * - `'object'` groups them as `{ petId, storeId }: PathParams`
3495
+ * - `'inline'` spreads them as individual parameters `petId: string, storeId: string`
3496
+ * - `'inlineSpread'` emits a single rest parameter `...pathParams: PathParams`
3497
+ */
3498
+ pathParamsType: 'object' | 'inline' | 'inlineSpread';
3499
+ /**
3500
+ * Converts parameter names to camelCase before output.
3501
+ */
3502
+ paramsCasing?: 'camelcase';
3503
+ /**
3504
+ * Resolver for parameter and request body type names.
3505
+ * Pass `ResolverTs` from `@kubb/plugin-ts` directly.
3506
+ * When omitted, falls back to the schema primitive or `'unknown'`.
3507
+ */
3508
+ resolver?: OperationParamsResolver;
3509
+ /**
3510
+ * Default value for the path parameters binding when `pathParamsType` is `'object'`.
3511
+ * Falls back to `'{}'` when all path params are optional.
3512
+ */
3513
+ pathParamsDefault?: string;
3514
+ /**
3515
+ * Extra parameters appended after the standard operation parameters.
3516
+ *
3517
+ * @example Plugin-specific trailing parameter
3518
+ * ```ts
3519
+ * extraParams: [createFunctionParameter({ name: 'options', type: 'Partial<RequestOptions>', default: '{}' })]
3520
+ * ```
3521
+ */
3522
+ extraParams?: Array<FunctionParameterNode | ParameterGroupNode>;
3523
+ /**
3524
+ * Override the default parameter names used for body, query, header, and rest-path groups.
3525
+ *
3526
+ * Useful when targeting languages or frameworks with different naming conventions.
3527
+ *
3528
+ * @default { data: 'data', params: 'params', headers: 'headers', path: 'pathParams' }
3529
+ */
3530
+ paramNames?: {
3531
+ /**
3532
+ * Name for the request body parameter.
3533
+ * @default 'data'
3534
+ */
3535
+ data?: string;
3536
+ /**
3537
+ * Name for the query parameters group parameter.
3538
+ * @default 'params'
3539
+ */
3540
+ params?: string;
3541
+ /**
3542
+ * Name for the header parameters group parameter.
3543
+ * @default 'headers'
3544
+ */
3545
+ headers?: string;
3546
+ /**
3547
+ * Name for the rest path-parameters parameter when `pathParamsType` is `'inlineSpread'`.
3548
+ * @default 'pathParams'
3549
+ */
3550
+ path?: string;
3551
+ };
3552
+ /**
3553
+ * Applies a uniform transformation to every resolved type name before it is used
3554
+ * in a parameter node. Use this for framework-level type wrappers.
3555
+ *
3556
+ * @example Vue Query — wrap every parameter type with `MaybeRefOrGetter`
3557
+ * `typeWrapper: (t) => \`MaybeRefOrGetter<${t}>\``
3558
+ */
3559
+ typeWrapper?: (type: string) => string;
3560
+ };
3561
+ /**
3562
+ * Converts an `OperationNode` into function parameters for code generation.
3563
+ *
3564
+ * Centralizes parameter grouping logic for all plugins. Provide a `resolver` for type name resolution
3565
+ * and `extraParams` for plugin-specific trailing parameters (e.g., `options` objects).
3566
+ * Supports three grouping modes: `object` (single destructured param), `inline` (separate params),
3567
+ * and `inlineSpread` (rest parameter). Use `CreateOperationParamsOptions` to fine-tune output.
3568
+ */
3569
+ declare function createOperationParams(node: OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode;
3570
+ /**
3571
+ * Extracts all string content from a `CodeNode` tree recursively.
3572
+ *
3573
+ * Collects text node values, identifier references in string fields (`params`, `generics`, `returnType`, `type`),
3574
+ * and nested node content. Used internally to build the full source string for import filtering.
3575
+ */
3576
+ declare function extractStringsFromNodes(nodes: Array<CodeNode> | undefined): string;
3577
+ declare function collectUsedSchemaNames(operations: ReadonlyArray<OperationNode>, schemas: ReadonlyArray<SchemaNode>): Set<string>;
3578
+ /**
3579
+ * Identifies all schemas that participate in circular dependency chains, including direct self-loops.
3580
+ *
3581
+ * Returns a Set of schema names with circular dependencies. Use this to wrap recursive schema positions
3582
+ * in deferred constructs (lazy getter, `z.lazy(() => …)`) to prevent infinite recursion when generated code runs.
3583
+ * Refs are followed by name only, keeping the algorithm linear in the schema graph size.
3584
+ *
3585
+ * @note Call this once on the full schema graph, then use `containsCircularRef()` to check individual schemas.
3586
+ */
3587
+ declare function findCircularSchemas(schemas: ReadonlyArray<SchemaNode>): Set<string>;
3588
+ /**
3589
+ * Type guard returning `true` when a schema or anything nested within it contains a ref to a circular schema.
3590
+ *
3591
+ * Use `excludeName` to ignore refs to specific schemas (useful when self-references are handled separately).
3592
+ * Commonly used with `findCircularSchemas()` to detect where lazy wrappers are needed in code generation.
3593
+ *
3594
+ * @note Returns `true` for the first matching circular ref found; use for fast dependency checks.
3595
+ */
3596
+ declare function containsCircularRef(node: SchemaNode | undefined, {
3597
+ circularSchemas,
3598
+ excludeName
3599
+ }: {
3600
+ circularSchemas: ReadonlySet<string>;
3601
+ excludeName?: string;
3602
+ }): boolean;
3603
+ //#endregion
3604
+ export { update as $, ScalarSchemaType as $t, createBreak as A, FunctionParameterNode as At, createOperation as B, DateSchemaNode as Bt, PrinterFactoryOptions as C, httpMethods as Cn, HttpStatusCode as Ct, DistributiveOmit as D, ParameterNode as Dt, definePrinter as E, ParameterLocation as Et, createFunctionParameter as F, FileNode as Ft, createProperty as G, IntersectionSchemaNode as Gt, createParameter as H, EnumSchemaNode as Ht, createFunctionParameters as I, ImportNode as It, createSource as J, NumberSchemaNode as Jt, createResponse as K, Ipv4SchemaNode as Kt, createImport as L, SourceNode as Lt, createExport as M, ParameterGroupNode as Mt, createFile as N, ParamsTypeNode as Nt, UserFileNode as O, FunctionNodeType as Ot, createFunction as P, ExportNode as Pt, syncOptionality as Q, ScalarSchemaNode as Qt, createInput as R, ArraySchemaNode as Rt, Printer as S, VisitorDepth as Sn, ResponseNode as St, createPrinterFactory as T, StatusCode as Tt, createParameterGroup as U, EnumValueNode as Ut, createOutput as V, DatetimeSchemaNode as Vt, createParamsType as W, FormatStringSchemaNode as Wt, createText as X, PrimitiveSchemaType as Xt, createStreamInput as Y, ObjectSchemaNode as Yt, createType as Z, RefSchemaNode as Zt, VisitorContext as _, TypeDeclarationNode as _n, HttpMethod as _t, createDiscriminantNode as a, TimeSchemaNode as an, defineSchemaDialect as at, transform as b, NodeKind as bn, OperationNodeBase as bt, findCircularSchemas as c, PropertyNode as cn, DedupePlan as ct, AsyncVisitor as d, CodeNode as dn, Node as dt, SchemaNode as en, InferSchemaNode as et, CollectOptions as f, ConstNode as fn, InputMeta as ft, Visitor as g, TextNode as gn, GenericOperationNode as gt, TransformOptions as h, JsxNode as hn, OutputNode as ht, containsCircularRef as i, StringSchemaNode as in, SchemaDialect as it, createConst as j, FunctionParametersNode as jt, createArrowFunction as k, FunctionParamNode as kt, isStringType as l, ArrowFunctionNode as ln, applyDedupe as lt, ParentOf as m, JSDocNode as mn, InputStreamNode as mt, caseParams as n, SchemaType as nn, DispatchRule as nt, createOperationParams as o, UnionSchemaNode as on, BuildDedupePlanOptions as ot, CollectVisitor as p, FunctionNode as pn, InputNode as pt, createSchema as q, Ipv6SchemaNode as qt, collectUsedSchemaNames as r, SpecialSchemaType as rn, dispatch as rt, extractStringsFromNodes as s, UrlSchemaNode as sn, DedupeCanonical as st, OperationParamsResolver as t, SchemaNodeByType as tn, ParserOptions as tt, syncSchemaRef as u, BreakNode as un, buildDedupePlan as ut, WalkOptions as v, TypeNode as vn, HttpOperationNode as vt, PrinterPartial as w, schemaTypes as wn, MediaType as wt, walk as x, ScalarPrimitive as xn, OperationProtocol as xt, collect as y, BaseNode as yn, OperationNode as yt, createJsx as z, ComplexSchemaType as zt };
3605
+ //# sourceMappingURL=types-CE8VJ5_y.d.ts.map