@kubb/ast 5.0.0-beta.4 → 5.0.0-beta.40

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,3596 @@
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 this ref resolves to, so its structure (`primitive`, `properties`)
844
+ * can be read without following the reference. Populated during OAS parsing when the
845
+ * definition resolves, `null` when it can't or the ref is circular, and `undefined` when
846
+ * resolution has not been attempted.
847
+ */
848
+ schema?: SchemaNode | null;
849
+ };
850
+ /**
851
+ * Datetime schema.
852
+ *
853
+ * @example
854
+ * ```ts
855
+ * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }
856
+ * ```
857
+ */
858
+ type DatetimeSchemaNode = SchemaNodeBase & {
859
+ /**
860
+ * Schema type discriminator.
861
+ */
862
+ type: 'datetime';
863
+ /**
864
+ * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).
865
+ */
866
+ offset?: boolean;
867
+ /**
868
+ * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).
869
+ */
870
+ local?: boolean;
871
+ };
872
+ /**
873
+ * Shared base for `date` and `time` schemas.
874
+ */
875
+ type TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {
876
+ /**
877
+ * Schema type discriminator.
878
+ */
879
+ type: T;
880
+ /**
881
+ * Output representation in generated code.
882
+ */
883
+ representation: 'date' | 'string';
884
+ };
885
+ /**
886
+ * Date schema node.
887
+ *
888
+ * @example
889
+ * ```ts
890
+ * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }
891
+ * ```
892
+ */
893
+ type DateSchemaNode = TemporalSchemaNodeBase<'date'>;
894
+ /**
895
+ * Time schema node.
896
+ *
897
+ * @example
898
+ * ```ts
899
+ * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }
900
+ * ```
901
+ */
902
+ type TimeSchemaNode = TemporalSchemaNodeBase<'time'>;
903
+ /**
904
+ * String schema node.
905
+ *
906
+ * @example
907
+ * ```ts
908
+ * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }
909
+ * ```
910
+ */
911
+ type StringSchemaNode = SchemaNodeBase & {
912
+ /**
913
+ * Schema type discriminator.
914
+ */
915
+ type: 'string';
916
+ /**
917
+ * Minimum string length.
918
+ */
919
+ min?: number;
920
+ /**
921
+ * Maximum string length.
922
+ */
923
+ max?: number;
924
+ /**
925
+ * Regex pattern.
926
+ */
927
+ pattern?: string;
928
+ };
929
+ /**
930
+ * Numeric schema (`number`, `integer`, or `bigint`).
931
+ *
932
+ * @example
933
+ * ```ts
934
+ * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }
935
+ * ```
936
+ */
937
+ type NumberSchemaNode = SchemaNodeBase & {
938
+ /**
939
+ * Schema type discriminator.
940
+ */
941
+ type: 'number' | 'integer' | 'bigint';
942
+ /**
943
+ * Minimum value.
944
+ */
945
+ min?: number;
946
+ /**
947
+ * Maximum value.
948
+ */
949
+ max?: number;
950
+ /**
951
+ * Exclusive minimum value.
952
+ */
953
+ exclusiveMinimum?: number;
954
+ /**
955
+ * Exclusive maximum value.
956
+ */
957
+ exclusiveMaximum?: number;
958
+ /**
959
+ * The value must be a multiple of this number.
960
+ */
961
+ multipleOf?: number;
962
+ };
963
+ /**
964
+ * Scalar schema with no extra constraints.
965
+ *
966
+ * @example
967
+ * ```ts
968
+ * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }
969
+ * ```
970
+ */
971
+ type ScalarSchemaNode = SchemaNodeBase & {
972
+ /**
973
+ * Schema type discriminator.
974
+ */
975
+ type: ScalarSchemaType;
976
+ };
977
+ /**
978
+ * URL schema node.
979
+ * Can include an OpenAPI-style path template for template literal types.
980
+ *
981
+ * @example
982
+ * ```ts
983
+ * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }
984
+ * ```
985
+ */
986
+ type UrlSchemaNode = SchemaNodeBase & {
987
+ /**
988
+ * Schema type discriminator.
989
+ */
990
+ type: 'url';
991
+ /**
992
+ * OpenAPI-style path template, for example, `'/pets/{petId}'`.
993
+ */
994
+ path?: string;
995
+ /**
996
+ * Minimum string length.
997
+ */
998
+ min?: number;
999
+ /**
1000
+ * Maximum string length.
1001
+ */
1002
+ max?: number;
1003
+ };
1004
+ /**
1005
+ * Format-string schema for string-based formats that support length constraints.
1006
+ *
1007
+ * @example
1008
+ * ```ts
1009
+ * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }
1010
+ * ```
1011
+ */
1012
+ type FormatStringSchemaNode = SchemaNodeBase & {
1013
+ /**
1014
+ * Schema type discriminator.
1015
+ */
1016
+ type: 'uuid' | 'email';
1017
+ /**
1018
+ * Minimum string length.
1019
+ */
1020
+ min?: number;
1021
+ /**
1022
+ * Maximum string length.
1023
+ */
1024
+ max?: number;
1025
+ };
1026
+ /**
1027
+ * IPv4 address schema node.
1028
+ *
1029
+ * @example
1030
+ * ```ts
1031
+ * const ipv4Schema: Ipv4SchemaNode = { kind: 'Schema', type: 'ipv4' }
1032
+ * ```
1033
+ */
1034
+ type Ipv4SchemaNode = SchemaNodeBase & {
1035
+ /**
1036
+ * Schema type discriminator.
1037
+ */
1038
+ type: 'ipv4';
1039
+ };
1040
+ /**
1041
+ * IPv6 address schema node.
1042
+ *
1043
+ * @example
1044
+ * ```ts
1045
+ * const ipv6Schema: Ipv6SchemaNode = { kind: 'Schema', type: 'ipv6' }
1046
+ * ```
1047
+ */
1048
+ type Ipv6SchemaNode = SchemaNodeBase & {
1049
+ /**
1050
+ * Schema type discriminator.
1051
+ */
1052
+ type: 'ipv6';
1053
+ };
1054
+ /**
1055
+ * Mapping from schema type literals to concrete schema node types.
1056
+ * Used by `narrowSchema`.
1057
+ */
1058
+ type SchemaNodeByType = {
1059
+ object: ObjectSchemaNode;
1060
+ array: ArraySchemaNode;
1061
+ tuple: ArraySchemaNode;
1062
+ union: UnionSchemaNode;
1063
+ intersection: IntersectionSchemaNode;
1064
+ enum: EnumSchemaNode;
1065
+ ref: RefSchemaNode;
1066
+ datetime: DatetimeSchemaNode;
1067
+ date: DateSchemaNode;
1068
+ time: TimeSchemaNode;
1069
+ string: StringSchemaNode;
1070
+ number: NumberSchemaNode;
1071
+ integer: NumberSchemaNode;
1072
+ bigint: NumberSchemaNode;
1073
+ boolean: ScalarSchemaNode;
1074
+ null: ScalarSchemaNode;
1075
+ any: ScalarSchemaNode;
1076
+ unknown: ScalarSchemaNode;
1077
+ void: ScalarSchemaNode;
1078
+ never: ScalarSchemaNode;
1079
+ uuid: FormatStringSchemaNode;
1080
+ email: FormatStringSchemaNode;
1081
+ url: UrlSchemaNode;
1082
+ ipv4: Ipv4SchemaNode;
1083
+ ipv6: Ipv6SchemaNode;
1084
+ blob: ScalarSchemaNode;
1085
+ };
1086
+ /**
1087
+ * Union of all schema node types.
1088
+ */
1089
+ type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | Ipv4SchemaNode | Ipv6SchemaNode | ScalarSchemaNode;
1090
+ //#endregion
1091
+ //#region src/nodes/content.d.ts
1092
+ /**
1093
+ * AST node representing one content-type entry of a request body or response.
1094
+ *
1095
+ * One entry per content type declared in the spec (e.g. `application/json`,
1096
+ * `multipart/form-data`), each carrying its own body schema.
1097
+ *
1098
+ * @example
1099
+ * ```ts
1100
+ * const content: ContentNode = {
1101
+ * kind: 'Content',
1102
+ * contentType: 'application/json',
1103
+ * schema: createSchema({ type: 'string' }),
1104
+ * }
1105
+ * ```
1106
+ */
1107
+ type ContentNode = BaseNode & {
1108
+ /**
1109
+ * Node kind.
1110
+ */
1111
+ kind: 'Content';
1112
+ /**
1113
+ * The content type for this entry (e.g. `'application/json'`).
1114
+ */
1115
+ contentType: string;
1116
+ /**
1117
+ * Body schema for this content type.
1118
+ */
1119
+ schema?: SchemaNode;
1120
+ /**
1121
+ * Property keys to exclude from the generated type via `Omit<Type, Keys>`.
1122
+ * Set when a referenced schema has `readOnly`/`writeOnly` fields that should be omitted.
1123
+ */
1124
+ keysToOmit?: Array<string> | null;
1125
+ };
1126
+ //#endregion
1127
+ //#region src/nodes/file.d.ts
1128
+ /**
1129
+ * Supported file extensions.
1130
+ */
1131
+ type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
1132
+ type ImportName = string | Array<string | {
1133
+ propertyName: string;
1134
+ name?: string;
1135
+ }>;
1136
+ /**
1137
+ * Represents a language-agnostic import/dependency declaration.
1138
+ *
1139
+ * @example Named import (TypeScript: `import { useState } from 'react'`)
1140
+ * ```ts
1141
+ * createImport({ name: ['useState'], path: 'react' })
1142
+ * ```
1143
+ *
1144
+ * @example Default import (TypeScript: `import React from 'react'`)
1145
+ * ```ts
1146
+ * createImport({ name: 'React', path: 'react' })
1147
+ * ```
1148
+ *
1149
+ * @example Type-only import (TypeScript: `import type { FC } from 'react'`)
1150
+ * ```ts
1151
+ * createImport({ name: ['FC'], path: 'react', isTypeOnly: true })
1152
+ * ```
1153
+ *
1154
+ * @example Namespace import (TypeScript: `import * as React from 'react'`)
1155
+ * ```ts
1156
+ * createImport({ name: 'React', path: 'react', isNameSpace: true })
1157
+ * ```
1158
+ */
1159
+ type ImportNode = BaseNode & {
1160
+ kind: 'Import';
1161
+ /**
1162
+ * Import name(s) to be used.
1163
+ * @example ['useState']
1164
+ * @example 'React'
1165
+ */
1166
+ name: ImportName;
1167
+ /**
1168
+ * Path for the import.
1169
+ * @example '@kubb/core'
1170
+ */
1171
+ path: string;
1172
+ /**
1173
+ * Add type-only import prefix.
1174
+ * - `true` generates `import type { Type } from './path'`
1175
+ * - `false` generates `import { Type } from './path'`
1176
+ * @default false
1177
+ */
1178
+ isTypeOnly?: boolean | null;
1179
+ /**
1180
+ * Import entire module as namespace.
1181
+ * - `true` generates `import * as Name from './path'`
1182
+ * - `false` generates standard import
1183
+ * @default false
1184
+ */
1185
+ isNameSpace?: boolean | null;
1186
+ /**
1187
+ * When set, the import path is resolved relative to this root.
1188
+ */
1189
+ root?: string | null;
1190
+ };
1191
+ /**
1192
+ * Represents a language-agnostic export/public API declaration.
1193
+ *
1194
+ * @example Named export (TypeScript: `export { Pets } from './Pets'`)
1195
+ * ```ts
1196
+ * createExport({ name: ['Pets'], path: './Pets' })
1197
+ * ```
1198
+ *
1199
+ * @example Type-only export (TypeScript: `export type { Pet } from './Pet'`)
1200
+ * ```ts
1201
+ * createExport({ name: ['Pet'], path: './Pet', isTypeOnly: true })
1202
+ * ```
1203
+ *
1204
+ * @example Wildcard export (TypeScript: `export * from './utils'`)
1205
+ * ```ts
1206
+ * createExport({ path: './utils' })
1207
+ * ```
1208
+ *
1209
+ * @example Namespace alias (TypeScript: `export * as utils from './utils'`)
1210
+ * ```ts
1211
+ * createExport({ name: 'utils', path: './utils', asAlias: true })
1212
+ * ```
1213
+ */
1214
+ type ExportNode = BaseNode & {
1215
+ kind: 'Export';
1216
+ /**
1217
+ * Export name(s) to be used. When omitted, generates a wildcard export.
1218
+ * @example ['useState']
1219
+ * @example 'React'
1220
+ */
1221
+ name?: string | Array<string> | null;
1222
+ /**
1223
+ * Path for the export.
1224
+ * @example '@kubb/core'
1225
+ */
1226
+ path: string;
1227
+ /**
1228
+ * Add type-only export prefix.
1229
+ * - `true` generates `export type { Type } from './path'`
1230
+ * - `false` generates `export { Type } from './path'`
1231
+ * @default false
1232
+ */
1233
+ isTypeOnly?: boolean | null;
1234
+ /**
1235
+ * Export as an aliased namespace.
1236
+ * - `true` generates `export * as aliasName from './path'`
1237
+ * - `false` generates a standard export
1238
+ * @default false
1239
+ */
1240
+ asAlias?: boolean | null;
1241
+ };
1242
+ /**
1243
+ * Represents a fragment of source code within a file.
1244
+ *
1245
+ * @example Named exportable source
1246
+ * ```ts
1247
+ * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true, isIndexable: true })
1248
+ * ```
1249
+ *
1250
+ * @example Inline unnamed code block
1251
+ * ```ts
1252
+ * createSource({ nodes: [createText('const x = 1')] })
1253
+ * ```
1254
+ */
1255
+ type SourceNode = BaseNode & {
1256
+ kind: 'Source';
1257
+ /**
1258
+ * Optional name identifying this source (used for deduplication and barrel generation).
1259
+ */
1260
+ name?: string | null;
1261
+ /**
1262
+ * Mark this source as a type-only export.
1263
+ * @default false
1264
+ */
1265
+ isTypeOnly?: boolean | null;
1266
+ /**
1267
+ * Include `export` keyword in the generated source.
1268
+ * @default false
1269
+ */
1270
+ isExportable?: boolean | null;
1271
+ /**
1272
+ * Include this source in barrel/index file generation.
1273
+ * @default false
1274
+ */
1275
+ isIndexable?: boolean | null;
1276
+ /**
1277
+ * Structured child nodes representing the content of this source fragment, in DOM order.
1278
+ * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
1279
+ */
1280
+ nodes?: Array<CodeNode>;
1281
+ };
1282
+ /**
1283
+ * Represents a fully resolved file in the AST.
1284
+ *
1285
+ * Created via `createFile()`, which computes the `id`, `name`, and `extname` from the input
1286
+ * and deduplicates `imports`, `exports`, and `sources`.
1287
+ *
1288
+ * @example
1289
+ * ```ts
1290
+ * const file = createFile({
1291
+ * baseName: 'petStore.ts',
1292
+ * path: 'src/models/petStore.ts',
1293
+ * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })],
1294
+ * imports: [createImport({ name: ['z'], path: 'zod' })],
1295
+ * exports: [createExport({ name: ['Pet'], path: './petStore' })],
1296
+ * })
1297
+ * // file.id = SHA256 hash of the path
1298
+ * // file.name = 'petStore'
1299
+ * // file.extname = '.ts'
1300
+ * ```
1301
+ */
1302
+ type FileNode<TMeta extends object = object> = BaseNode & {
1303
+ kind: 'File';
1304
+ /**
1305
+ * Unique identifier derived from a SHA256 hash of the file path. Computed
1306
+ * by `createFile`; callers do not need to provide it.
1307
+ */
1308
+ id: string;
1309
+ /**
1310
+ * File name without extension, derived from `baseName`.
1311
+ * @link https://nodejs.org/api/path.html#pathformatpathobject
1312
+ */
1313
+ name: string;
1314
+ /**
1315
+ * File base name, including extension.
1316
+ * Based on UNIX basename: `${name}${extname}`
1317
+ * @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
1318
+ */
1319
+ baseName: `${string}.${string}`;
1320
+ /**
1321
+ * Full qualified path to the file.
1322
+ */
1323
+ path: string;
1324
+ /**
1325
+ * File extension extracted from `baseName`.
1326
+ */
1327
+ extname: Extname;
1328
+ /**
1329
+ * Deduplicated list of source code fragments.
1330
+ */
1331
+ sources: Array<SourceNode>;
1332
+ /**
1333
+ * Deduplicated list of import declarations.
1334
+ */
1335
+ imports: Array<ImportNode>;
1336
+ /**
1337
+ * Deduplicated list of export declarations.
1338
+ */
1339
+ exports: Array<ExportNode>;
1340
+ /**
1341
+ * Optional metadata attached to this file (used by plugins for barrel generation etc.).
1342
+ */
1343
+ meta?: TMeta;
1344
+ /**
1345
+ * Optional banner prepended to the generated file content.
1346
+ * Accepts `null` so `resolver.resolveBanner()` results can be passed directly.
1347
+ */
1348
+ banner?: string | null;
1349
+ /**
1350
+ * Optional footer appended to the generated file content.
1351
+ * Accepts `null` so `resolver.resolveFooter()` results can be passed directly.
1352
+ */
1353
+ footer?: string | null;
1354
+ };
1355
+ //#endregion
1356
+ //#region src/nodes/function.d.ts
1357
+ /**
1358
+ * AST node representing a language-agnostic type expression used as a function parameter
1359
+ * type annotation. Each language printer renders the variant into its own syntax.
1360
+ *
1361
+ * - `struct` an inline anonymous type grouping named fields.
1362
+ * TypeScript renders as `{ petId: string; name?: string }`.
1363
+ * - `member` a single named field accessed from a named group type.
1364
+ * TypeScript renders as `PathParams['petId']`.
1365
+ *
1366
+ * @example Reference variant
1367
+ * ```ts
1368
+ * createParamsType({ variant: 'reference', name: 'QueryParams' })
1369
+ * // QueryParams
1370
+ * ```
1371
+ *
1372
+ * @example Struct variant
1373
+ * ```ts
1374
+ * createParamsType({ variant: 'struct', properties: [{ name: 'petId', optional: false, type: createParamsType({ variant: 'reference', name: 'string' }) }] })
1375
+ * // { petId: string }
1376
+ * ```
1377
+ *
1378
+ * @example Member variant
1379
+ * ```ts
1380
+ * createParamsType({ variant: 'member', base: 'PathParams', key: 'petId' })
1381
+ * // PathParams['petId']
1382
+ * ```
1383
+ */
1384
+ type ParamsTypeNode = BaseNode & {
1385
+ /**
1386
+ * Node kind.
1387
+ */
1388
+ kind: 'ParamsType';
1389
+ } & ({
1390
+ /**
1391
+ * Reference variant, a plain type name or identifier.
1392
+ * TypeScript renders as-is, e.g. `string`, `QueryParams`, `Partial<Config>`.
1393
+ */
1394
+ variant: 'reference';
1395
+ /**
1396
+ * The full type name string, e.g. `'string'`, `'QueryParams'`, `'Partial<Config>'`.
1397
+ */
1398
+ name: string;
1399
+ } | {
1400
+ /**
1401
+ * Struct variant, an inline anonymous type grouping named fields.
1402
+ * TypeScript renders as `{ key: Type; other?: OtherType }`.
1403
+ */
1404
+ variant: 'struct';
1405
+ /**
1406
+ * Properties of the struct type.
1407
+ */
1408
+ properties: Array<{
1409
+ name: string;
1410
+ optional: boolean;
1411
+ type: ParamsTypeNode;
1412
+ }>;
1413
+ } | {
1414
+ /**
1415
+ * Member variant, a single named field accessed from a group type.
1416
+ * TypeScript renders as `Base['key']`.
1417
+ */
1418
+ variant: 'member';
1419
+ /**
1420
+ * Base type name, e.g. `'DeletePetPathParams'`.
1421
+ */
1422
+ base: string;
1423
+ /**
1424
+ * The field name to access, e.g. `'petId'`.
1425
+ */
1426
+ key: string;
1427
+ });
1428
+ /**
1429
+ * AST node for one function parameter.
1430
+ *
1431
+ * @example Required parameter
1432
+ * `name: Type`
1433
+ *
1434
+ * @example Optional parameter
1435
+ * `name?: Type`
1436
+ *
1437
+ * @example Parameter with default value
1438
+ * `name: Type = defaultValue`
1439
+ *
1440
+ * @example Rest parameter
1441
+ * `...name: Type[]`
1442
+ */
1443
+ type FunctionParameterNode = BaseNode & {
1444
+ /**
1445
+ * Node kind.
1446
+ */
1447
+ kind: 'FunctionParameter';
1448
+ /**
1449
+ * Parameter name in the generated signature.
1450
+ */
1451
+ name: string;
1452
+ /**
1453
+ * Type annotation as a structured {@link ParamsTypeNode}.
1454
+ * Omit for untyped output.
1455
+ *
1456
+ * @example Reference type node
1457
+ * `{ kind: 'ParamsType', variant: 'reference', name: 'string' }` → `petId: string`
1458
+ *
1459
+ * @example Struct type node
1460
+ * `{ kind: 'ParamsType', variant: 'struct', properties: [...] }` → `{ key: Type; other?: OtherType }`
1461
+ *
1462
+ * @example Member type node
1463
+ * `{ kind: 'ParamsType', variant: 'member', base: 'PathParams', key: 'petId' }` → `PathParams['petId']`
1464
+ */
1465
+ type?: ParamsTypeNode;
1466
+ /**
1467
+ * When `true` the parameter is emitted as a rest parameter.
1468
+ *
1469
+ * @example Rest parameter
1470
+ * `...name: Type[]`
1471
+ */
1472
+ rest?: boolean;
1473
+ }
1474
+ /**
1475
+ * Optional parameter, rendered with `?` and may be omitted by the caller.
1476
+ * Cannot be combined with `default` because a defaulted parameter is already optional.
1477
+ */
1478
+ & ({
1479
+ optional: true;
1480
+ default?: never;
1481
+ }
1482
+ /**
1483
+ * Required parameter, or a parameter with a default value.
1484
+ *
1485
+ * @example Required
1486
+ * `name: Type`
1487
+ *
1488
+ * @example With default
1489
+ * `name: Type = default`
1490
+ */
1491
+ | {
1492
+ optional?: false;
1493
+ default?: string;
1494
+ });
1495
+ /**
1496
+ * AST node for a group of related function parameters treated as a single unit.
1497
+ *
1498
+ * Each language printer decides how to render this group:
1499
+ * - TypeScript/JS: destructured object `{ key1, key2 }: { key1: Type1; key2: Type2 } = {}`
1500
+ * - Python: keyword-only args or a typed dict parameter
1501
+ * - C# / Kotlin: named record / data-class parameter
1502
+ *
1503
+ * When `inline` is `true`, the group is spread as individual top-level parameters
1504
+ * rather than wrapped in a single grouped construct.
1505
+ *
1506
+ * @example Grouped destructuring
1507
+ * `{ id, name }: { id: string; name: string } = {}`
1508
+ *
1509
+ * @example Inline (spread as individual parameters)
1510
+ * `id: string, name: string`
1511
+ */
1512
+ type ParameterGroupNode = BaseNode & {
1513
+ /**
1514
+ * Node kind.
1515
+ */
1516
+ kind: 'ParameterGroup';
1517
+ /**
1518
+ * The individual parameters that form the group.
1519
+ * Rendered as a destructured object or spread inline when `inline` is `true`.
1520
+ */
1521
+ properties: Array<FunctionParameterNode>;
1522
+ /**
1523
+ * Optional explicit type annotation for the whole group.
1524
+ * When absent, printers auto-compute it from `properties`.
1525
+ */
1526
+ type?: ParamsTypeNode;
1527
+ /**
1528
+ * When `true`, `properties` are emitted as individual top-level parameters instead of
1529
+ * being wrapped in a single grouped construct.
1530
+ *
1531
+ * @default false
1532
+ */
1533
+ inline?: boolean;
1534
+ /**
1535
+ * Whether the group as a whole is optional.
1536
+ * If omitted, printers infer this from child properties.
1537
+ */
1538
+ optional?: boolean;
1539
+ /**
1540
+ * Default value for the group, written verbatim after `=`.
1541
+ * Commonly `'{}'` to allow omitting the argument entirely.
1542
+ */
1543
+ default?: string;
1544
+ };
1545
+ /**
1546
+ * AST node for a complete function parameter list.
1547
+ *
1548
+ * Printers are responsible for sorting (`required` → `optional` → `defaulted`).
1549
+ * Nodes are plain immutable data.
1550
+ *
1551
+ * Renders differently depending on the output mode:
1552
+ * - `declaration` → `(id: string, config: Config = {})` function declaration parameters
1553
+ * - `call` → `(id, { method, url })` function call arguments
1554
+ * - `keys` → `{ id, config }` key names only (for destructuring)
1555
+ * - `values` → `{ id: id, config: config }` key → value pairs
1556
+ */
1557
+ type FunctionParametersNode = BaseNode & {
1558
+ /**
1559
+ * Node kind.
1560
+ */
1561
+ kind: 'FunctionParameters';
1562
+ /**
1563
+ * Ordered parameter nodes.
1564
+ */
1565
+ params: ReadonlyArray<FunctionParameterNode | ParameterGroupNode>;
1566
+ };
1567
+ /**
1568
+ * Union of all function-parameter AST node variants used by the function-parameter printer.
1569
+ */
1570
+ type FunctionParamNode = FunctionParameterNode | ParameterGroupNode | FunctionParametersNode | ParamsTypeNode;
1571
+ /**
1572
+ * Handler map keys, one per `FunctionParamNode` kind.
1573
+ */
1574
+ type FunctionNodeType = 'functionParameter' | 'parameterGroup' | 'functionParameters' | 'paramsType';
1575
+ //#endregion
1576
+ //#region src/nodes/parameter.d.ts
1577
+ type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
1578
+ /**
1579
+ * AST node representing one operation parameter.
1580
+ *
1581
+ * @example
1582
+ * ```ts
1583
+ * const param: ParameterNode = {
1584
+ * kind: 'Parameter',
1585
+ * name: 'petId',
1586
+ * in: 'path',
1587
+ * schema: createSchema({ type: 'string' }),
1588
+ * required: true,
1589
+ * }
1590
+ * ```
1591
+ */
1592
+ type ParameterNode = BaseNode & {
1593
+ /**
1594
+ * Node kind.
1595
+ */
1596
+ kind: 'Parameter';
1597
+ /**
1598
+ * Parameter name.
1599
+ */
1600
+ name: string;
1601
+ /**
1602
+ * Parameter location (`path`, `query`, `header`, or `cookie`).
1603
+ */
1604
+ in: ParameterLocation;
1605
+ /**
1606
+ * Parameter schema.
1607
+ */
1608
+ schema: SchemaNode;
1609
+ /**
1610
+ * Whether the parameter is required.
1611
+ */
1612
+ required: boolean;
1613
+ };
1614
+ //#endregion
1615
+ //#region src/nodes/http.d.ts
1616
+ /**
1617
+ * All supported HTTP status code literals as strings, as used in API specs
1618
+ * (for example, `"200"` and `"404"`).
1619
+ */
1620
+ 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';
1621
+ /**
1622
+ * Response status code literal used by operations.
1623
+ *
1624
+ * Includes specific HTTP status code strings and `"default"` for catch-all responses.
1625
+ *
1626
+ * @example
1627
+ * ```ts
1628
+ * const status: StatusCode = '200'
1629
+ * const fallback: StatusCode = 'default'
1630
+ * ```
1631
+ */
1632
+ type StatusCode = HttpStatusCode | 'default';
1633
+ /**
1634
+ * Supported media type strings used in request and response bodies.
1635
+ *
1636
+ * @example
1637
+ * ```ts
1638
+ * const mediaType: MediaType = 'application/json'
1639
+ * ```
1640
+ */
1641
+ 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';
1642
+ //#endregion
1643
+ //#region src/nodes/response.d.ts
1644
+ /**
1645
+ * AST node representing one operation response variant.
1646
+ *
1647
+ * Mirrors {@link OperationNode.requestBody}: the response body schemas live exclusively inside
1648
+ * the `content` array (one entry per content type), so the same schema is never duplicated at the
1649
+ * node root and inside `content`.
1650
+ *
1651
+ * @example
1652
+ * ```ts
1653
+ * const response: ResponseNode = {
1654
+ * kind: 'Response',
1655
+ * statusCode: '200',
1656
+ * content: [{ contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
1657
+ * }
1658
+ * ```
1659
+ */
1660
+ type ResponseNode = BaseNode & {
1661
+ /**
1662
+ * Node kind.
1663
+ */
1664
+ kind: 'Response';
1665
+ /**
1666
+ * HTTP status code or `'default'` for a fallback response.
1667
+ */
1668
+ statusCode: StatusCode;
1669
+ /**
1670
+ * Optional response description.
1671
+ */
1672
+ description?: string;
1673
+ /**
1674
+ * All available content type entries for this response.
1675
+ *
1676
+ * When the adapter `contentType` option is set, this array contains exactly one entry for that
1677
+ * content type. Otherwise it contains one entry per content type declared in the spec, so that
1678
+ * plugins can generate a union of response types (e.g. `application/json` and `application/xml`).
1679
+ * Body-less responses keep a single entry whose `schema` is the empty/`void` placeholder.
1680
+ *
1681
+ * @example
1682
+ * ```ts
1683
+ * // spec response declares both application/json and application/xml
1684
+ * response.content[0].contentType // 'application/json'
1685
+ * response.content[1].contentType // 'application/xml'
1686
+ * ```
1687
+ */
1688
+ content?: Array<ContentNode>;
1689
+ };
1690
+ //#endregion
1691
+ //#region src/nodes/operation.d.ts
1692
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE';
1693
+ /**
1694
+ * Transport an operation belongs to.
1695
+ */
1696
+ type OperationProtocol = 'http';
1697
+ /**
1698
+ * AST node representing an operation request body.
1699
+ *
1700
+ * Body schemas live exclusively inside the `content` array (one entry per content type),
1701
+ * mirroring {@link ResponseNode}.
1702
+ *
1703
+ * @example
1704
+ * ```ts
1705
+ * const requestBody: RequestBodyNode = {
1706
+ * kind: 'RequestBody',
1707
+ * required: true,
1708
+ * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],
1709
+ * }
1710
+ * ```
1711
+ */
1712
+ type RequestBodyNode = BaseNode & {
1713
+ /**
1714
+ * Node kind.
1715
+ */
1716
+ kind: 'RequestBody';
1717
+ /**
1718
+ * Human-readable request body description.
1719
+ */
1720
+ description?: string;
1721
+ /**
1722
+ * Whether the request body is required (`requestBody.required: true` in the spec).
1723
+ * When `false` or absent, the generated `data` parameter should be optional.
1724
+ */
1725
+ required?: boolean;
1726
+ /**
1727
+ * All available content type entries for this request body.
1728
+ *
1729
+ * When the adapter `contentType` option is set, this array contains exactly one entry for
1730
+ * that content type. Otherwise it contains one entry per content type declared in the spec,
1731
+ * so that plugins can generate code for every variant (e.g. separate hooks for
1732
+ * `application/json` and `multipart/form-data`).
1733
+ */
1734
+ content?: Array<ContentNode>;
1735
+ };
1736
+ /**
1737
+ * Fields shared by every operation, regardless of transport.
1738
+ */
1739
+ type OperationNodeBase = BaseNode & {
1740
+ /**
1741
+ * Node kind.
1742
+ */
1743
+ kind: 'Operation';
1744
+ /**
1745
+ * Operation identifier, usually from OpenAPI `operationId`.
1746
+ */
1747
+ operationId: string;
1748
+ /**
1749
+ * Group labels for the operation.
1750
+ * Usually copied from OpenAPI `tags`.
1751
+ */
1752
+ tags: Array<string>;
1753
+ /**
1754
+ * Short one-line operation summary.
1755
+ */
1756
+ summary?: string;
1757
+ /**
1758
+ * Full operation description.
1759
+ */
1760
+ description?: string;
1761
+ /**
1762
+ * Marks the operation as deprecated.
1763
+ */
1764
+ deprecated?: boolean;
1765
+ /**
1766
+ * Parameters that could be used, we have QueryParams, PathParams, HeaderParams and CookieParams
1767
+ */
1768
+ parameters: Array<ParameterNode>;
1769
+ /**
1770
+ * Request body for the operation.
1771
+ */
1772
+ requestBody?: RequestBodyNode;
1773
+ /**
1774
+ * Operation responses.
1775
+ */
1776
+ responses: Array<ResponseNode>;
1777
+ };
1778
+ /**
1779
+ * Operation served over HTTP/REST (OpenAPI). `method` and `path` are guaranteed.
1780
+ *
1781
+ * @example
1782
+ * ```ts
1783
+ * const operation: HttpOperationNode = {
1784
+ * kind: 'Operation',
1785
+ * operationId: 'listPets',
1786
+ * protocol: 'http',
1787
+ * method: 'GET',
1788
+ * path: '/pets',
1789
+ * tags: [],
1790
+ * parameters: [],
1791
+ * responses: [],
1792
+ * }
1793
+ * ```
1794
+ */
1795
+ type HttpOperationNode = OperationNodeBase & {
1796
+ /**
1797
+ * Transport the operation belongs to.
1798
+ */
1799
+ protocol?: 'http';
1800
+ /**
1801
+ * HTTP method like `'GET'`.
1802
+ */
1803
+ method: HttpMethod;
1804
+ /**
1805
+ * OpenAPI-style path string, for example `/pets/{petId}`, with `{param}` notation preserved.
1806
+ */
1807
+ path: string;
1808
+ };
1809
+ /**
1810
+ * Operation for a non-HTTP transport. HTTP-only fields are forbidden.
1811
+ */
1812
+ type GenericOperationNode = OperationNodeBase & {
1813
+ /**
1814
+ * Transport the operation belongs to.
1815
+ */
1816
+ protocol?: Exclude<OperationProtocol, 'http'>;
1817
+ method?: never;
1818
+ path?: never;
1819
+ };
1820
+ /**
1821
+ * AST node representing one API operation.
1822
+ *
1823
+ * Discriminated on `protocol`: an {@link HttpOperationNode} (`protocol: 'http'`) guarantees
1824
+ * `method` and `path`, while a {@link GenericOperationNode} omits them. Narrow with
1825
+ * `isHttpOperationNode(node)` or `node.protocol === 'http'` before reading `method`/`path`.
1826
+ */
1827
+ type OperationNode = HttpOperationNode | GenericOperationNode;
1828
+ //#endregion
1829
+ //#region src/nodes/output.d.ts
1830
+ /**
1831
+ * Output AST node that groups all generated file output for one API document.
1832
+ *
1833
+ * Produced by generators and consumed by the build pipeline to write files.
1834
+ *
1835
+ * @example
1836
+ * ```ts
1837
+ * const output: OutputNode = {
1838
+ * kind: 'Output',
1839
+ * files: [],
1840
+ * }
1841
+ * ```
1842
+ */
1843
+ type OutputNode = BaseNode & {
1844
+ /**
1845
+ * Node kind.
1846
+ */
1847
+ kind: 'Output';
1848
+ /**
1849
+ * Generated file nodes.
1850
+ */
1851
+ files: Array<FileNode>;
1852
+ };
1853
+ //#endregion
1854
+ //#region src/nodes/root.d.ts
1855
+ /**
1856
+ * Metadata for an API document, populated by the adapter and available to every generator.
1857
+ *
1858
+ * All fields are plain JSON-serializable values, no `Set`, no `Map`, no class instances.
1859
+ * Computed fields (`circularNames`, `enumNames`) are pre-calculated once during the adapter
1860
+ * pre-scan so generators never need to iterate the full schema list themselves.
1861
+ *
1862
+ * @example
1863
+ * ```ts
1864
+ * const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://petstore.swagger.io/v2', circularNames: [], enumNames: [] }
1865
+ * ```
1866
+ */
1867
+ type InputMeta = {
1868
+ /**
1869
+ * API title from `info.title` in the source document.
1870
+ */
1871
+ title?: string;
1872
+ /**
1873
+ * API description from `info.description` in the source document.
1874
+ */
1875
+ description?: string;
1876
+ /**
1877
+ * API version string from `info.version` in the source document.
1878
+ */
1879
+ version?: string;
1880
+ /**
1881
+ * Resolved base URL from the first matching server entry in the source document.
1882
+ */
1883
+ baseURL?: string | null;
1884
+ /**
1885
+ * Names of schemas that participate in a circular reference chain.
1886
+ * Computed once during the adapter pre-scan, use this instead of calling
1887
+ * `findCircularSchemas` per generator call.
1888
+ *
1889
+ * Convert to a `Set` once at the start of a generator, not per-schema,
1890
+ * to keep lookup O(1) without repeated allocations.
1891
+ *
1892
+ * @example Wrap a circular schema in z.lazy()
1893
+ * ```ts
1894
+ * const circular = new Set(meta.circularNames)
1895
+ * if (circular.has(schema.name)) { ... }
1896
+ * ```
1897
+ */
1898
+ circularNames: ReadonlyArray<string>;
1899
+ /**
1900
+ * Names of schemas whose type is `enum`.
1901
+ * Computed once during the adapter pre-scan, use this instead of filtering
1902
+ * schemas per generator call.
1903
+ *
1904
+ * Convert to a `Set` once at the start of a generator when you need repeated
1905
+ * membership checks, rather than calling `.includes()` per schema.
1906
+ *
1907
+ * @example Check if a referenced schema is an enum
1908
+ * `const enums = new Set(meta.enumNames)`
1909
+ * `const isEnum = enums.has(schemaName)`
1910
+ */
1911
+ enumNames: ReadonlyArray<string>;
1912
+ };
1913
+ /**
1914
+ * Input AST node that contains all schemas and operations for one API document.
1915
+ * Produced by the adapter and consumed by all Kubb plugins.
1916
+ *
1917
+ * @example
1918
+ * ```ts
1919
+ * const input: InputNode = {
1920
+ * kind: 'Input',
1921
+ * schemas: [],
1922
+ * operations: [],
1923
+ * }
1924
+ * ```
1925
+ */
1926
+ type InputNode = BaseNode & {
1927
+ /**
1928
+ * Node kind.
1929
+ */
1930
+ kind: 'Input';
1931
+ /**
1932
+ * All schema nodes in the document.
1933
+ */
1934
+ schemas: Array<SchemaNode>;
1935
+ /**
1936
+ * All operation nodes in the document.
1937
+ */
1938
+ operations: Array<OperationNode>;
1939
+ /**
1940
+ * Document metadata populated by the adapter.
1941
+ */
1942
+ meta: InputMeta;
1943
+ };
1944
+ /**
1945
+ * Streaming variant of `InputNode` for memory-efficient processing of large API specs.
1946
+ *
1947
+ * `schemas` and `operations` are `AsyncIterable` rather than arrays, each `for await`
1948
+ * loop creates a fresh parse pass from the cached in-memory document, so multiple
1949
+ * consumers (plugins) can iterate independently without keeping all nodes in memory.
1950
+ *
1951
+ * @example
1952
+ * ```ts
1953
+ * for await (const schema of inputStreamNode.schemas) {
1954
+ * // only this one SchemaNode is live here. Previous ones are GC-eligible
1955
+ * }
1956
+ * ```
1957
+ */
1958
+ type InputStreamNode = {
1959
+ kind: 'Input';
1960
+ /**
1961
+ * Lazily parsed schema nodes. Each `for await` creates a fresh parse pass, so
1962
+ * multiple plugins can iterate independently without sharing state.
1963
+ */
1964
+ schemas: AsyncIterable<SchemaNode>;
1965
+ /**
1966
+ * Lazily parsed operation nodes. Each `for await` creates a fresh parse pass, so
1967
+ * multiple plugins can iterate independently without sharing state.
1968
+ */
1969
+ operations: AsyncIterable<OperationNode>;
1970
+ /**
1971
+ * Document metadata available immediately, before the first yielded node.
1972
+ */
1973
+ meta?: InputMeta;
1974
+ };
1975
+ //#endregion
1976
+ //#region src/nodes/index.d.ts
1977
+ /**
1978
+ * Union of all AST node types.
1979
+ *
1980
+ * This lets TypeScript narrow types in `switch (node.kind)` blocks.
1981
+ *
1982
+ * @example
1983
+ * ```ts
1984
+ * function getKind(node: Node): string {
1985
+ * switch (node.kind) {
1986
+ * case 'Input':
1987
+ * return 'input'
1988
+ * case 'Output':
1989
+ * return 'output'
1990
+ * default:
1991
+ * return 'other'
1992
+ * }
1993
+ * }
1994
+ * ```
1995
+ */
1996
+ type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FunctionParamNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | ParamsTypeNode | FunctionNode | ArrowFunctionNode;
1997
+ //#endregion
1998
+ //#region src/dedupe.d.ts
1999
+ /**
2000
+ * A canonical destination for a deduplicated shape: the shared schema name and
2001
+ * the synthetic `$ref` path that points at it.
2002
+ */
2003
+ type DedupeCanonical = {
2004
+ /**
2005
+ * Canonical schema name every duplicate occurrence refers to.
2006
+ */
2007
+ name: string;
2008
+ /**
2009
+ * `$ref` path stored on the generated `ref` nodes (for example `#/components/schemas/Status`).
2010
+ */
2011
+ ref: string;
2012
+ };
2013
+ /**
2014
+ * The result of {@link buildDedupePlan}: a lookup from structural signature to its
2015
+ * canonical target, plus the freshly hoisted definitions that must be added to
2016
+ * the schema list.
2017
+ */
2018
+ type DedupePlan = {
2019
+ /**
2020
+ * Maps a structural signature to the canonical schema that represents it.
2021
+ */
2022
+ canonicalBySignature: Map<string, DedupeCanonical>;
2023
+ /**
2024
+ * New top-level schema definitions created for inline shapes that had no existing
2025
+ * named component. Nested duplicates inside each definition are already collapsed.
2026
+ */
2027
+ hoisted: Array<SchemaNode>;
2028
+ };
2029
+ /**
2030
+ * Options that inject the naming and candidate policy into {@link buildDedupePlan}.
2031
+ * The mechanics (grouping, counting, rewriting) live here. The policy lives in the caller.
2032
+ */
2033
+ type BuildDedupePlanOptions = {
2034
+ /**
2035
+ * Returns `true` when a node should be deduplicated. This is the only gate, so it must
2036
+ * reject both ineligible kinds (return `false` for anything other than, say, enums and
2037
+ * objects) and unsafe shapes (e.g. nodes that reference a circular schema).
2038
+ */
2039
+ isCandidate: (node: SchemaNode) => boolean;
2040
+ /**
2041
+ * Produces the canonical name for an inline shape with no existing named component.
2042
+ * Return `null` to leave the shape inline (for example when no contextual name exists).
2043
+ */
2044
+ nameFor: (node: SchemaNode, signature: string) => string | null;
2045
+ /**
2046
+ * Builds the `$ref` path for a canonical name.
2047
+ */
2048
+ refFor: (name: string) => string;
2049
+ /**
2050
+ * Minimum number of occurrences before a shape is deduplicated.
2051
+ *
2052
+ * @default 2
2053
+ */
2054
+ minOccurrences?: number;
2055
+ };
2056
+ /**
2057
+ * Rewrites a node, replacing every candidate sub-schema whose signature has a canonical
2058
+ * target with a `ref` to that target. Replacing a node with a `ref` prunes its subtree,
2059
+ * so nested duplicates inside a replaced shape are not visited again.
2060
+ *
2061
+ * Pass `skipRootMatch` when rewriting a canonical definition so its own root is not
2062
+ * turned into a reference to itself. Nested duplicates are still collapsed.
2063
+ *
2064
+ * @example
2065
+ * ```ts
2066
+ * const next = applyDedupe(operationNode, plan.canonicalBySignature)
2067
+ * ```
2068
+ */
2069
+ declare function applyDedupe(node: SchemaNode, canonicalBySignature: ReadonlyMap<string, DedupeCanonical>, skipRootMatch?: boolean): SchemaNode;
2070
+ declare function applyDedupe(node: OperationNode, canonicalBySignature: ReadonlyMap<string, DedupeCanonical>, skipRootMatch?: boolean): OperationNode;
2071
+ /**
2072
+ * Scans a forest of schema and operation nodes and produces a {@link DedupePlan}.
2073
+ *
2074
+ * A shape that occurs at least `minOccurrences` times is deduplicated: if any occurrence
2075
+ * is a named top-level schema, that name becomes the canonical (so other top-level duplicates
2076
+ * and inline copies turn into references to it). Otherwise a new definition is hoisted using
2077
+ * `nameFor`. The plan is then applied per node with {@link applyDedupe}.
2078
+ *
2079
+ * @example
2080
+ * ```ts
2081
+ * const plan = buildDedupePlan([...schemaNodes, ...operationNodes], {
2082
+ * isCandidate: (node) => node.type === 'enum' || node.type === 'object',
2083
+ * nameFor: (node) => node.name ?? null,
2084
+ * refFor: (name) => `#/components/schemas/${name}`,
2085
+ * })
2086
+ * ```
2087
+ */
2088
+ declare function buildDedupePlan(roots: ReadonlyArray<Node>, options: BuildDedupePlanOptions): DedupePlan;
2089
+ //#endregion
2090
+ //#region src/dialect.d.ts
2091
+ /**
2092
+ * The spec-specific decisions a schema parser makes when converting a source document's schemas
2093
+ * into Kubb AST nodes. Everything else in an adapter's schema pipeline is generic JSON Schema,
2094
+ * shared across specs, so the dialect is the one seam where specs differ, like a database driver
2095
+ * targeting Postgres vs MySQL. Pair it with {@link dispatch}: the rule table picks which converter
2096
+ * runs, the dialect answers the spec-specific questions inside it.
2097
+ *
2098
+ * The guards (`isReference`, `isDiscriminator`) are type predicates, so converters narrow the
2099
+ * schema after a check and the type parameters carry the narrowed types through.
2100
+ *
2101
+ * This is the seam for the JSON Schema family: OpenAPI, AsyncAPI, and plain JSON Schema share
2102
+ * `$ref`, `allOf`/`oneOf`, `enum`, and `format` and differ only in these few decisions. A spec on
2103
+ * a different type system (GraphQL, with non-null wrappers and named-type references instead of
2104
+ * `$ref`) skips `SchemaDialect` and reuses the universal layer directly: the `Adapter` port, the
2105
+ * AST factories, and {@link dispatch} with its own rule table.
2106
+ *
2107
+ * @typeParam TSchema - The adapter's schema object type (e.g. an OpenAPI `SchemaObject`).
2108
+ * @typeParam TRef - The narrowed `$ref` pointer type `isReference` proves.
2109
+ * @typeParam TDiscriminated - The narrowed discriminated-schema type `isDiscriminator` proves.
2110
+ * @typeParam TDocument - The source document `resolveRef` resolves against.
2111
+ */
2112
+ type SchemaDialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema, TDocument = unknown> = {
2113
+ /** Identifies the dialect in logs and while debugging dispatch. */name: string; /** Whether a schema should be treated as nullable. */
2114
+ isNullable: (schema?: TSchema) => boolean; /** Whether a value is a `$ref` pointer object. */
2115
+ isReference: (value?: unknown) => value is TRef; /** Whether a schema carries a structured discriminator (polymorphism). */
2116
+ isDiscriminator: (value?: unknown) => value is TDiscriminated; /** Whether a schema represents binary data (converted to a `blob` node). */
2117
+ isBinary: (schema: TSchema) => boolean; /** Resolves a local `$ref` pointer against the document, or nullish when it cannot. */
2118
+ resolveRef: <TResolved>(document: TDocument, ref: string) => TResolved | null | undefined;
2119
+ };
2120
+ /**
2121
+ * Identity helper that types a {@link SchemaDialect} for an adapter. Like
2122
+ * `defineParser`, it adds no runtime behavior, it pins the dialect's type for
2123
+ * inference and gives adapter authors a discoverable anchor.
2124
+ *
2125
+ * @example
2126
+ * ```ts
2127
+ * export const oasDialect = defineSchemaDialect({
2128
+ * name: 'oas',
2129
+ * isNullable,
2130
+ * isReference,
2131
+ * isDiscriminator,
2132
+ * isBinary: (schema) => schema.type === 'string' && schema.contentMediaType === 'application/octet-stream',
2133
+ * resolveRef,
2134
+ * })
2135
+ * ```
2136
+ */
2137
+ declare function defineSchemaDialect<TSchema, TRef, TDiscriminated, TDocument>(dialect: SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>): SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>;
2138
+ //#endregion
2139
+ //#region src/dispatch.d.ts
2140
+ /**
2141
+ * One entry in an ordered dispatch table: a predicate paired with a converter.
2142
+ *
2143
+ * @typeParam TContext - Per-input context handed to every rule. A spec adapter typically
2144
+ * pre-computes this once per node (the source spec node plus derived fields like a
2145
+ * normalized type or resolved options) so individual rules stay cheap predicates.
2146
+ * @typeParam TNode - The node a rule produces, e.g. a Kubb AST `SchemaNode`.
2147
+ */
2148
+ type DispatchRule<TContext, TNode> = {
2149
+ /** 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. */
2150
+ match: (context: TContext) => boolean;
2151
+ /**
2152
+ * Produces a node for the context, or `null` to fall through to the next rule.
2153
+ *
2154
+ * Returning `null` lets a broad `match` defer: e.g. "has a `format`" matches many schemas,
2155
+ * but only some formats are convertible, the rest fall through to plain `type` handling.
2156
+ */
2157
+ convert: (context: TContext) => TNode | null;
2158
+ };
2159
+ /**
2160
+ * Walks an ordered list of {@link DispatchRule}s and returns the first node produced.
2161
+ *
2162
+ * This is the shared backbone for spec adapters (OpenAPI today, AsyncAPI and others later).
2163
+ * The contract an adapter follows is intentionally minimal:
2164
+ *
2165
+ * context → [rule.match → rule.convert] → node
2166
+ *
2167
+ * An adapter derives a context from a source spec node, then declares an ordered table of
2168
+ * rules mapping spec shapes onto Kubb AST nodes. To add support for a new spec, write a new
2169
+ * context type and a new rules table, the traversal here is reused unchanged.
2170
+ *
2171
+ * Order is significant: earlier rules win, so list higher-precedence or more specific shapes
2172
+ * first (e.g. composition keywords before plain `type`). A rule whose `match` returns `true`
2173
+ * may still `convert` to `null` to defer to later rules. When no rule produces a node this
2174
+ * returns `null`, leaving the caller to apply its own fallback.
2175
+ *
2176
+ * @example
2177
+ * ```ts
2178
+ * const node = dispatch(schemaRules, schemaContext) ?? createSchema({ type: fallbackType })
2179
+ * ```
2180
+ */
2181
+ declare function dispatch<TContext, TNode>(rules: ReadonlyArray<DispatchRule<TContext, TNode>>, context: TContext): TNode | null;
2182
+ //#endregion
2183
+ //#region src/infer.d.ts
2184
+ /**
2185
+ * Shared parser options used by OAS-to-AST inference and parser flows.
2186
+ */
2187
+ type ParserOptions = {
2188
+ /**
2189
+ * How `format: 'date-time'` schemas are represented downstream.
2190
+ * - `false` falls through to a plain `string` (no validation).
2191
+ * - `'string'` emits a datetime string node.
2192
+ * - `'stringOffset'` emits a datetime node with timezone offset.
2193
+ * - `'stringLocal'` emits a local datetime node.
2194
+ * - `'date'` emits a `date` node (JavaScript `Date` object).
2195
+ */
2196
+ dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
2197
+ /**
2198
+ * How `type: 'integer'` (and `format: 'int64'`) maps to TypeScript.
2199
+ * - `'number'` fits most JSON APIs. Loses precision above `Number.MAX_SAFE_INTEGER`.
2200
+ * - `'bigint'` is exact for 64-bit IDs, but does not round-trip through JSON.
2201
+ *
2202
+ * @default 'number'
2203
+ */
2204
+ integerType?: 'number' | 'bigint';
2205
+ /**
2206
+ * AST type used when a schema's type cannot be inferred from the spec
2207
+ * (`additionalProperties: true`, missing `type`, ...).
2208
+ */
2209
+ unknownType: 'any' | 'unknown' | 'void';
2210
+ /**
2211
+ * AST type used for completely empty schemas (`{}`).
2212
+ */
2213
+ emptySchemaType: 'any' | 'unknown' | 'void';
2214
+ /**
2215
+ * Suffix appended to derived enum names when Kubb has to invent one
2216
+ * (typically for inline enums on object properties).
2217
+ */
2218
+ enumSuffix: 'enum' | (string & {});
2219
+ };
2220
+ /**
2221
+ * Maps each `dateType` option value to the AST node produced by `format: 'date-time'`.
2222
+ */
2223
+ type DateTimeNodeByDateType = {
2224
+ date: DateSchemaNode;
2225
+ string: DatetimeSchemaNode;
2226
+ stringOffset: DatetimeSchemaNode;
2227
+ stringLocal: DatetimeSchemaNode;
2228
+ false: StringSchemaNode;
2229
+ };
2230
+ /**
2231
+ * Resolves the AST node produced by `format: 'date-time'` based on the `dateType` option.
2232
+ */
2233
+ type ResolveDateTimeNode<TDateType extends ParserOptions['dateType']> = DateTimeNodeByDateType[TDateType extends keyof DateTimeNodeByDateType ? TDateType : 'string'];
2234
+ /**
2235
+ * Ordered list of `[schema-shape, SchemaNode]` pairs.
2236
+ * `InferSchemaNode` walks this tuple in order and returns the first matching node type.
2237
+ */
2238
+ type SchemaNodeMap<TDateType extends ParserOptions['dateType'] = 'string'> = [[{
2239
+ $ref: string;
2240
+ }, RefSchemaNode], [{
2241
+ allOf: ReadonlyArray<unknown>;
2242
+ properties: object;
2243
+ }, IntersectionSchemaNode], [{
2244
+ allOf: readonly [unknown, unknown, ...Array<unknown>];
2245
+ }, IntersectionSchemaNode], [{
2246
+ allOf: ReadonlyArray<unknown>;
2247
+ }, SchemaNode], [{
2248
+ oneOf: ReadonlyArray<unknown>;
2249
+ }, UnionSchemaNode], [{
2250
+ anyOf: ReadonlyArray<unknown>;
2251
+ }, UnionSchemaNode], [{
2252
+ const: null;
2253
+ }, ScalarSchemaNode], [{
2254
+ const: string | number | boolean;
2255
+ }, EnumSchemaNode], [{
2256
+ type: ReadonlyArray<string>;
2257
+ }, UnionSchemaNode], [{
2258
+ type: 'array';
2259
+ enum: ReadonlyArray<unknown>;
2260
+ }, ArraySchemaNode], [{
2261
+ enum: ReadonlyArray<unknown>;
2262
+ }, EnumSchemaNode], [{
2263
+ type: 'enum';
2264
+ }, EnumSchemaNode], [{
2265
+ type: 'union';
2266
+ }, UnionSchemaNode], [{
2267
+ type: 'intersection';
2268
+ }, IntersectionSchemaNode], [{
2269
+ type: 'tuple';
2270
+ }, ArraySchemaNode], [{
2271
+ type: 'ref';
2272
+ }, RefSchemaNode], [{
2273
+ type: 'datetime';
2274
+ }, DatetimeSchemaNode], [{
2275
+ type: 'date';
2276
+ }, DateSchemaNode], [{
2277
+ type: 'time';
2278
+ }, TimeSchemaNode], [{
2279
+ type: 'url';
2280
+ }, UrlSchemaNode], [{
2281
+ type: 'object';
2282
+ }, ObjectSchemaNode], [{
2283
+ additionalProperties: boolean | {};
2284
+ }, ObjectSchemaNode], [{
2285
+ type: 'array';
2286
+ }, ArraySchemaNode], [{
2287
+ items: object;
2288
+ }, ArraySchemaNode], [{
2289
+ prefixItems: ReadonlyArray<unknown>;
2290
+ }, ArraySchemaNode], [{
2291
+ type: string;
2292
+ format: 'date-time';
2293
+ }, ResolveDateTimeNode<TDateType>], [{
2294
+ type: string;
2295
+ format: 'date';
2296
+ }, DateSchemaNode], [{
2297
+ type: string;
2298
+ format: 'time';
2299
+ }, TimeSchemaNode], [{
2300
+ format: 'date-time';
2301
+ }, ResolveDateTimeNode<TDateType>], [{
2302
+ format: 'date';
2303
+ }, DateSchemaNode], [{
2304
+ format: 'time';
2305
+ }, TimeSchemaNode], [{
2306
+ type: 'string';
2307
+ }, StringSchemaNode], [{
2308
+ type: 'number';
2309
+ }, NumberSchemaNode], [{
2310
+ type: 'integer';
2311
+ }, NumberSchemaNode], [{
2312
+ type: 'bigint';
2313
+ }, NumberSchemaNode], [{
2314
+ type: string;
2315
+ }, ScalarSchemaNode], [{
2316
+ minLength: number;
2317
+ }, StringSchemaNode], [{
2318
+ maxLength: number;
2319
+ }, StringSchemaNode], [{
2320
+ pattern: string;
2321
+ }, StringSchemaNode], [{
2322
+ minimum: number;
2323
+ }, NumberSchemaNode], [{
2324
+ maximum: number;
2325
+ }, NumberSchemaNode]];
2326
+ /**
2327
+ * Infers the matching AST `SchemaNode` type from an input schema shape.
2328
+ */
2329
+ 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;
2330
+ //#endregion
2331
+ //#region src/factory.d.ts
2332
+ /**
2333
+ * Updates a schema's `optional` and `nullish` flags from a parent's `required`
2334
+ * value and the schema's own `nullable`. Mirrors how OpenAPI parameters and
2335
+ * object properties combine "required" and "nullable" into a single AST.
2336
+ *
2337
+ * - Non-required + non-nullable → `optional: true`.
2338
+ * - Non-required + nullable → `nullish: true`.
2339
+ * - Required → both flags cleared.
2340
+ */
2341
+ declare function syncOptionality(schema: SchemaNode, required: boolean): SchemaNode;
2342
+ /**
2343
+ * Distributive `Omit` that preserves each member of a union.
2344
+ *
2345
+ * @example
2346
+ * ```ts
2347
+ * type A = { kind: 'a'; keep: string; drop: number }
2348
+ * type B = { kind: 'b'; keep: boolean; drop: number }
2349
+ * type Result = DistributiveOmit<A | B, 'drop'>
2350
+ * // -> { kind: 'a'; keep: string } | { kind: 'b'; keep: boolean }
2351
+ * ```
2352
+ */
2353
+ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
2354
+ /**
2355
+ * Identity-preserving node update: returns `node` unchanged when every field in
2356
+ * `changes` already equals (by reference) the current value, otherwise a new node
2357
+ * with the changes applied.
2358
+ *
2359
+ * Mirrors the TypeScript compiler's `factory.updateX` contract, pair it with the
2360
+ * structural sharing in {@link transform} so a no-op rewrite doesn't allocate and
2361
+ * downstream passes can detect "nothing changed" by identity. Comparison is
2362
+ * shallow: a structurally-equal but newly-allocated array/object counts as a change.
2363
+ *
2364
+ * @example
2365
+ * ```ts
2366
+ * update(node, { name: node.name }) // -> same `node` reference
2367
+ * update(node, { name: 'renamed' }) // -> new node, `name` replaced
2368
+ * ```
2369
+ */
2370
+ declare function update<T extends Node>(node: T, changes: Partial<T>): T;
2371
+ type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & {
2372
+ properties?: Array<PropertyNode>;
2373
+ primitive?: 'object';
2374
+ };
2375
+ type CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>;
2376
+ type CreateSchemaOutput<T extends CreateSchemaInput> = InferSchemaNode<T> & {
2377
+ kind: 'Schema';
2378
+ };
2379
+ /**
2380
+ * Creates an `InputNode` with stable defaults for `schemas` and `operations`.
2381
+ *
2382
+ * @example
2383
+ * ```ts
2384
+ * const input = createInput()
2385
+ * // { kind: 'Input', schemas: [], operations: [] }
2386
+ * ```
2387
+ *
2388
+ * @example
2389
+ * ```ts
2390
+ * const input = createInput({ schemas: [petSchema] })
2391
+ * // keeps default operations: []
2392
+ * ```
2393
+ */
2394
+ declare function createInput(overrides?: Partial<Omit<InputNode, 'kind'>>): InputNode;
2395
+ /**
2396
+ * Creates an `InputStreamNode` from pre-built `AsyncIterable` sources.
2397
+ *
2398
+ * @example
2399
+ * ```ts
2400
+ * const node = createStreamInput(schemasIterable, operationsIterable, { title: 'My API' })
2401
+ * ```
2402
+ */
2403
+ declare function createStreamInput(schemas: AsyncIterable<SchemaNode>, operations: AsyncIterable<OperationNode>, meta?: InputMeta): InputStreamNode;
2404
+ /**
2405
+ * Creates an `OutputNode` with a stable default for `files`.
2406
+ *
2407
+ * @example
2408
+ * ```ts
2409
+ * const output = createOutput()
2410
+ * // { kind: 'Output', files: [] }
2411
+ * ```
2412
+ *
2413
+ * @example
2414
+ * ```ts
2415
+ * const output = createOutput({ files: [petFile] })
2416
+ * ```
2417
+ */
2418
+ declare function createOutput(overrides?: Partial<Omit<OutputNode, 'kind'>>): OutputNode;
2419
+ /**
2420
+ * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.
2421
+ *
2422
+ * @example
2423
+ * ```ts
2424
+ * const operation = createOperation({
2425
+ * operationId: 'getPetById',
2426
+ * method: 'GET',
2427
+ * path: '/pet/{petId}',
2428
+ * })
2429
+ * // tags, parameters, and responses are []
2430
+ * ```
2431
+ *
2432
+ * @example
2433
+ * ```ts
2434
+ * const operation = createOperation({
2435
+ * operationId: 'findPets',
2436
+ * method: 'GET',
2437
+ * path: '/pet/findByStatus',
2438
+ * tags: ['pet'],
2439
+ * })
2440
+ * ```
2441
+ */
2442
+ /**
2443
+ * Loosely-typed content entry accepted by the builders, normalized into a {@link ContentNode}.
2444
+ */
2445
+ type UserContent = Omit<ContentNode, 'kind'>;
2446
+ /**
2447
+ * Creates a `ContentNode` for a single request-body or response content type.
2448
+ */
2449
+ /**
2450
+ * Loosely-typed request body accepted by `createOperation`, normalized into a {@link RequestBodyNode}.
2451
+ */
2452
+ type UserRequestBody = Omit<RequestBodyNode, 'kind' | 'content'> & {
2453
+ content?: Array<UserContent>;
2454
+ };
2455
+ /**
2456
+ * Creates a `RequestBodyNode`, normalizing each content entry into a `ContentNode`.
2457
+ */
2458
+ declare function createOperation(props: Pick<HttpOperationNode, 'operationId' | 'method' | 'path'> & Partial<Omit<HttpOperationNode, 'kind' | 'operationId' | 'method' | 'path' | 'requestBody'>> & {
2459
+ requestBody?: UserRequestBody;
2460
+ }): HttpOperationNode;
2461
+ declare function createOperation(props: Pick<GenericOperationNode, 'operationId'> & Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {
2462
+ requestBody?: UserRequestBody;
2463
+ }): GenericOperationNode;
2464
+ /**
2465
+ * Creates a `SchemaNode`, narrowed to the variant of `props.type`.
2466
+ * For object schemas, `properties` defaults to an empty array.
2467
+ * `primitive` is automatically inferred from `type` when not explicitly provided.
2468
+ *
2469
+ * @example
2470
+ * ```ts
2471
+ * const scalar = createSchema({ type: 'string' })
2472
+ * // { kind: 'Schema', type: 'string', primitive: 'string' }
2473
+ * ```
2474
+ *
2475
+ * @example
2476
+ * ```ts
2477
+ * const uuid = createSchema({ type: 'uuid' })
2478
+ * // { kind: 'Schema', type: 'uuid', primitive: 'string' }
2479
+ * ```
2480
+ *
2481
+ * @example
2482
+ * ```ts
2483
+ * const object = createSchema({ type: 'object' })
2484
+ * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }
2485
+ * ```
2486
+ *
2487
+ * @example
2488
+ * ```ts
2489
+ * const enumSchema = createSchema({
2490
+ * type: 'enum',
2491
+ * primitive: 'string',
2492
+ * enumValues: ['available', 'pending'],
2493
+ * })
2494
+ * ```
2495
+ */
2496
+ declare function createSchema<T extends CreateSchemaInput>(props: T): CreateSchemaOutput<T>;
2497
+ declare function createSchema(props: CreateSchemaInput): SchemaNode;
2498
+ type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>;
2499
+ /**
2500
+ * Creates a `PropertyNode`.
2501
+ *
2502
+ * `required` defaults to `false`.
2503
+ * `schema.optional` and `schema.nullish` are derived from `required` and `schema.nullable`.
2504
+ *
2505
+ * @example
2506
+ * ```ts
2507
+ * const property = createProperty({
2508
+ * name: 'status',
2509
+ * schema: createSchema({ type: 'string' }),
2510
+ * })
2511
+ * // required=false, schema.optional=true
2512
+ * ```
2513
+ *
2514
+ * @example
2515
+ * ```ts
2516
+ * const property = createProperty({
2517
+ * name: 'status',
2518
+ * required: true,
2519
+ * schema: createSchema({ type: 'string', nullable: true }),
2520
+ * })
2521
+ * // required=true, no optional/nullish
2522
+ * ```
2523
+ */
2524
+ declare function createProperty(props: UserPropertyNode): PropertyNode;
2525
+ /**
2526
+ * Creates a `ParameterNode`.
2527
+ *
2528
+ * `required` defaults to `false`.
2529
+ * Nested schema flags are set from `required` and `schema.nullable`.
2530
+ *
2531
+ * @example
2532
+ * ```ts
2533
+ * const param = createParameter({
2534
+ * name: 'petId',
2535
+ * in: 'path',
2536
+ * required: true,
2537
+ * schema: createSchema({ type: 'string' }),
2538
+ * })
2539
+ * ```
2540
+ *
2541
+ * @example
2542
+ * ```ts
2543
+ * const param = createParameter({
2544
+ * name: 'status',
2545
+ * in: 'query',
2546
+ * schema: createSchema({ type: 'string', nullable: true }),
2547
+ * })
2548
+ * // required=false, schema.nullish=true
2549
+ * ```
2550
+ */
2551
+ declare function createParameter(props: Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>): ParameterNode;
2552
+ /**
2553
+ * Creates a `ResponseNode`.
2554
+ *
2555
+ * Response body schemas live inside `content`. For convenience a single legacy `schema`
2556
+ * (with optional `mediaType`/`keysToOmit`) is normalized into one `content` entry, so the same
2557
+ * schema is never stored both at the node root and inside `content`.
2558
+ *
2559
+ * @example
2560
+ * ```ts
2561
+ * const response = createResponse({
2562
+ * statusCode: '200',
2563
+ * content: [{ contentType: 'application/json', schema: createSchema({ type: 'object', properties: [] }) }],
2564
+ * })
2565
+ * ```
2566
+ */
2567
+ declare function createResponse(props: Pick<ResponseNode, 'statusCode'> & Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'content'>> & {
2568
+ content?: Array<UserContent>;
2569
+ schema?: SchemaNode;
2570
+ mediaType?: string | null;
2571
+ keysToOmit?: Array<string> | null;
2572
+ }): ResponseNode;
2573
+ /**
2574
+ * Creates a `FunctionParameterNode`.
2575
+ *
2576
+ * `optional` defaults to `false`.
2577
+ *
2578
+ * @example Required typed param
2579
+ * ```ts
2580
+ * createFunctionParameter({ name: 'petId', type: createParamsType({ variant: 'reference', name: 'string' }) })
2581
+ * // → petId: string
2582
+ * ```
2583
+ *
2584
+ * @example Optional param
2585
+ * ```ts
2586
+ * createFunctionParameter({ name: 'params', type: createParamsType({ variant: 'reference', name: 'QueryParams' }), optional: true })
2587
+ * // → params?: QueryParams
2588
+ * ```
2589
+ *
2590
+ * @example Param with default (implicitly optional. Cannot combine with `optional: true`)
2591
+ * ```ts
2592
+ * createFunctionParameter({ name: 'config', type: createParamsType({ variant: 'reference', name: 'RequestConfig' }), default: '{}' })
2593
+ * // → config: RequestConfig = {}
2594
+ * ```
2595
+ */
2596
+ declare function createFunctionParameter(props: {
2597
+ name: string;
2598
+ type?: ParamsTypeNode;
2599
+ rest?: boolean;
2600
+ } & ({
2601
+ optional: true;
2602
+ default?: never;
2603
+ } | {
2604
+ optional?: false;
2605
+ default?: string;
2606
+ })): FunctionParameterNode;
2607
+ /**
2608
+ * Creates a {@link TypeNode} representing a language-agnostic structured type expression.
2609
+ *
2610
+ * Use `variant: 'struct'` for inline anonymous types and `variant: 'member'` for a single
2611
+ * named field accessed from a group type. Each language's printer renders the variant
2612
+ * into its own syntax (TypeScript, Python, C#, Kotlin, …).
2613
+ *
2614
+ * @example Reference type (TypeScript: `QueryParams`)
2615
+ * ```ts
2616
+ * createParamsType({ variant: 'reference', name: 'QueryParams' })
2617
+ * ```
2618
+ *
2619
+ * @example Struct type (TypeScript: `{ petId: string }`)
2620
+ * ```ts
2621
+ * createParamsType({ variant: 'struct', properties: [{ name: 'petId', optional: false, type: createParamsType({ variant: 'reference', name: 'string' }) }] })
2622
+ * ```
2623
+ *
2624
+ * @example Member type (TypeScript: `DeletePetPathParams['petId']`)
2625
+ * ```ts
2626
+ * createParamsType({ variant: 'member', base: 'DeletePetPathParams', key: 'petId' })
2627
+ * ```
2628
+ */
2629
+ declare function createParamsType(props: {
2630
+ variant: 'reference';
2631
+ name: string;
2632
+ } | {
2633
+ variant: 'struct';
2634
+ properties: Array<{
2635
+ name: string;
2636
+ optional: boolean;
2637
+ type: ParamsTypeNode;
2638
+ }>;
2639
+ } | {
2640
+ variant: 'member';
2641
+ base: string;
2642
+ key: string;
2643
+ }): ParamsTypeNode;
2644
+ /**
2645
+ * Creates a `ParameterGroupNode` representing a group of related parameters treated as a unit.
2646
+ *
2647
+ * @example Grouped param (TypeScript declaration)
2648
+ * ```ts
2649
+ * createParameterGroup({
2650
+ * properties: [
2651
+ * createFunctionParameter({ name: 'id', type: createParamsType({ variant: 'reference', name: 'string' }), optional: false }),
2652
+ * createFunctionParameter({ name: 'name', type: createParamsType({ variant: 'reference', name: 'string' }), optional: true }),
2653
+ * ],
2654
+ * default: '{}',
2655
+ * })
2656
+ * // declaration → { id, name? }: { id: string; name?: string } = {}
2657
+ * // call → { id, name }
2658
+ * ```
2659
+ *
2660
+ * @example Inline (spread), children emitted as individual top-level parameters
2661
+ * ```ts
2662
+ * createParameterGroup({
2663
+ * properties: [createFunctionParameter({ name: 'petId', type: createParamsType({ variant: 'reference', name: 'string' }), optional: false })],
2664
+ * inline: true,
2665
+ * })
2666
+ * // declaration → petId: string
2667
+ * // call → petId
2668
+ * ```
2669
+ */
2670
+ declare function createParameterGroup(props: Pick<ParameterGroupNode, 'properties'> & Partial<Omit<ParameterGroupNode, 'kind' | 'properties'>>): ParameterGroupNode;
2671
+ /**
2672
+ * Creates a `FunctionParametersNode` from an ordered list of parameters.
2673
+ *
2674
+ * @example
2675
+ * ```ts
2676
+ * createFunctionParameters({
2677
+ * params: [
2678
+ * createFunctionParameter({ name: 'petId', type: createParamsType({ variant: 'reference', name: 'string' }), optional: false }),
2679
+ * createFunctionParameter({ name: 'config', type: createParamsType({ variant: 'reference', name: 'RequestConfig' }), optional: false, default: '{}' }),
2680
+ * ],
2681
+ * })
2682
+ * ```
2683
+ *
2684
+ * @example
2685
+ * ```ts
2686
+ * const empty = createFunctionParameters()
2687
+ * // { kind: 'FunctionParameters', params: [] }
2688
+ * ```
2689
+ */
2690
+ declare function createFunctionParameters(props?: Partial<Omit<FunctionParametersNode, 'kind'>>): FunctionParametersNode;
2691
+ /**
2692
+ * Creates an `ImportNode` representing a language-agnostic import/dependency declaration.
2693
+ *
2694
+ * @example Named import
2695
+ * ```ts
2696
+ * createImport({ name: ['useState'], path: 'react' })
2697
+ * // import { useState } from 'react'
2698
+ * ```
2699
+ *
2700
+ * @example Type-only import
2701
+ * ```ts
2702
+ * createImport({ name: ['FC'], path: 'react', isTypeOnly: true })
2703
+ * // import type { FC } from 'react'
2704
+ * ```
2705
+ */
2706
+ declare function createImport(props: Omit<ImportNode, 'kind'>): ImportNode;
2707
+ /**
2708
+ * Creates an `ExportNode` representing a language-agnostic export/public API declaration.
2709
+ *
2710
+ * @example Named export
2711
+ * ```ts
2712
+ * createExport({ name: ['Pet'], path: './Pet' })
2713
+ * // export { Pet } from './Pet'
2714
+ * ```
2715
+ *
2716
+ * @example Wildcard export
2717
+ * ```ts
2718
+ * createExport({ path: './utils' })
2719
+ * // export * from './utils'
2720
+ * ```
2721
+ */
2722
+ declare function createExport(props: Omit<ExportNode, 'kind'>): ExportNode;
2723
+ /**
2724
+ * Creates a `SourceNode` representing a fragment of source code within a file.
2725
+ *
2726
+ * @example
2727
+ * ```ts
2728
+ * createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')], isExportable: true })
2729
+ * ```
2730
+ */
2731
+ declare function createSource(props: Omit<SourceNode, 'kind'>): SourceNode;
2732
+ type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind' | 'id' | 'name' | 'extname' | 'imports' | 'exports' | 'sources'> & Pick<Partial<FileNode<TMeta>>, 'imports' | 'exports' | 'sources'>;
2733
+ /**
2734
+ * Creates a fully resolved `FileNode` from a file input descriptor.
2735
+ *
2736
+ * Computes:
2737
+ * - `id` SHA256 hash of the file path
2738
+ * - `name` `baseName` without extension
2739
+ * - `extname` extension extracted from `baseName`
2740
+ *
2741
+ * Deduplicates:
2742
+ * - `sources` via `combineSources`
2743
+ * - `exports` via `combineExports`
2744
+ * - `imports` via `combineImports` (also filters unused imports)
2745
+ *
2746
+ * @throws {Error} when `baseName` has no extension.
2747
+ *
2748
+ * @example
2749
+ * ```ts
2750
+ * const file = createFile({
2751
+ * baseName: 'petStore.ts',
2752
+ * path: 'src/models/petStore.ts',
2753
+ * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')] })],
2754
+ * imports: [createImport({ name: ['z'], path: 'zod' })],
2755
+ * exports: [createExport({ name: ['Pet'], path: './petStore' })],
2756
+ * })
2757
+ * // file.id = SHA256 hash of 'src/models/petStore.ts'
2758
+ * // file.name = 'petStore'
2759
+ * // file.extname = '.ts'
2760
+ * ```
2761
+ */
2762
+ declare function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta>;
2763
+ /**
2764
+ * Creates a `ConstNode` representing a TypeScript `const` declaration.
2765
+ *
2766
+ * Mirrors the `Const` component from `@kubb/renderer-jsx`.
2767
+ * The component's `children` are represented as `nodes`.
2768
+ *
2769
+ * @example Simple constant
2770
+ * ```ts
2771
+ * createConst({ name: 'pet' })
2772
+ * // const pet = ...
2773
+ * ```
2774
+ *
2775
+ * @example Exported constant with type and `as const`
2776
+ * ```ts
2777
+ * createConst({ name: 'pets', export: true, type: 'Pet[]', asConst: true })
2778
+ * // export const pets: Pet[] = ... as const
2779
+ * ```
2780
+ *
2781
+ * @example With JSDoc and child nodes
2782
+ * ```ts
2783
+ * createConst({
2784
+ * name: 'config',
2785
+ * export: true,
2786
+ * JSDoc: { comments: ['@description App configuration'] },
2787
+ * nodes: [],
2788
+ * })
2789
+ * ```
2790
+ */
2791
+ declare function createConst(props: Omit<ConstNode, 'kind'>): ConstNode;
2792
+ /**
2793
+ * Creates a `TypeNode` representing a TypeScript `type` alias declaration.
2794
+ *
2795
+ * Mirrors the `Type` component from `@kubb/renderer-jsx`.
2796
+ * The component's `children` are represented as `nodes`.
2797
+ *
2798
+ * @example Simple type alias
2799
+ * ```ts
2800
+ * createType({ name: 'Pet' })
2801
+ * // type Pet = ...
2802
+ * ```
2803
+ *
2804
+ * @example Exported type with JSDoc
2805
+ * ```ts
2806
+ * createType({
2807
+ * name: 'PetStatus',
2808
+ * export: true,
2809
+ * JSDoc: { comments: ['@description Status of a pet'] },
2810
+ * })
2811
+ * // export type PetStatus = ...
2812
+ * ```
2813
+ */
2814
+ declare function createType(props: Omit<TypeNode, 'kind'>): TypeNode;
2815
+ /**
2816
+ * Creates a `FunctionNode` representing a TypeScript `function` declaration.
2817
+ *
2818
+ * Mirrors the `Function` component from `@kubb/renderer-jsx`.
2819
+ * The component's `children` are represented as `nodes`.
2820
+ *
2821
+ * @example Simple function
2822
+ * ```ts
2823
+ * createFunction({ name: 'getPet' })
2824
+ * // function getPet() { ... }
2825
+ * ```
2826
+ *
2827
+ * @example Exported async function with return type
2828
+ * ```ts
2829
+ * createFunction({ name: 'fetchPet', export: true, async: true, returnType: 'Pet' })
2830
+ * // export async function fetchPet(): Promise<Pet> { ... }
2831
+ * ```
2832
+ *
2833
+ * @example Function with generics and params
2834
+ * ```ts
2835
+ * createFunction({
2836
+ * name: 'identity',
2837
+ * export: true,
2838
+ * generics: ['T'],
2839
+ * params: 'value: T',
2840
+ * returnType: 'T',
2841
+ * })
2842
+ * // export function identity<T>(value: T): T { ... }
2843
+ * ```
2844
+ */
2845
+ declare function createFunction(props: Omit<FunctionNode, 'kind'>): FunctionNode;
2846
+ /**
2847
+ * Creates an `ArrowFunctionNode` representing a TypeScript arrow function.
2848
+ *
2849
+ * Mirrors the `Function.Arrow` component from `@kubb/renderer-jsx`.
2850
+ * The component's `children` are represented as `nodes`.
2851
+ *
2852
+ * @example Simple arrow function
2853
+ * ```ts
2854
+ * createArrowFunction({ name: 'getPet' })
2855
+ * // const getPet = () => { ... }
2856
+ * ```
2857
+ *
2858
+ * @example Single-line exported arrow function
2859
+ * ```ts
2860
+ * createArrowFunction({ name: 'double', export: true, params: 'n: number', singleLine: true })
2861
+ * // export const double = (n: number) => ...
2862
+ * ```
2863
+ *
2864
+ * @example Async arrow function with generics
2865
+ * ```ts
2866
+ * createArrowFunction({
2867
+ * name: 'fetchPet',
2868
+ * export: true,
2869
+ * async: true,
2870
+ * generics: ['T'],
2871
+ * params: 'id: string',
2872
+ * returnType: 'T',
2873
+ * })
2874
+ * // export const fetchPet = async <T>(id: string): Promise<T> => { ... }
2875
+ * ```
2876
+ */
2877
+ declare function createArrowFunction(props: Omit<ArrowFunctionNode, 'kind'>): ArrowFunctionNode;
2878
+ /**
2879
+ * Creates a {@link TextNode} representing a raw string fragment in the source output.
2880
+ *
2881
+ * Use this instead of bare strings when building `nodes` arrays so that every
2882
+ * entry in the array is a typed {@link CodeNode}.
2883
+ *
2884
+ * @example
2885
+ * ```ts
2886
+ * createText('return fetch(id)')
2887
+ * // { kind: 'Text', value: 'return fetch(id)' }
2888
+ * ```
2889
+ */
2890
+ declare function createText(value: string): TextNode;
2891
+ /**
2892
+ * Creates a {@link BreakNode} representing a line break in the source output.
2893
+ *
2894
+ * Corresponds to `<br/>` in JSX components. Prints as an empty string which,
2895
+ * when joined with `\n` by `printNodes`, produces a blank line.
2896
+ *
2897
+ * @example
2898
+ * ```ts
2899
+ * createBreak()
2900
+ * // { kind: 'Break' }
2901
+ * ```
2902
+ */
2903
+ declare function createBreak(): BreakNode;
2904
+ /**
2905
+ * Creates a {@link JsxNode} representing a raw JSX fragment in the source output.
2906
+ *
2907
+ * Use this to embed JSX markup (including fragments `<>…</>`) directly in generated code.
2908
+ *
2909
+ * @example
2910
+ * ```ts
2911
+ * createJsx('<>\n <a href={href}>Open</a>\n</>')
2912
+ * // { kind: 'Jsx', value: '<>\n <a href={href}>Open</a>\n</>' }
2913
+ * ```
2914
+ */
2915
+ declare function createJsx(value: string): JsxNode;
2916
+ //#endregion
2917
+ //#region src/printer.d.ts
2918
+ /**
2919
+ * Runtime context passed as `this` to printer handlers.
2920
+ *
2921
+ * `this.transform` dispatches to node-level handlers from `nodes`.
2922
+ *
2923
+ * @example
2924
+ * ```ts
2925
+ * const context: PrinterHandlerContext<string, {}> = {
2926
+ * options: {},
2927
+ * transform: () => 'value',
2928
+ * }
2929
+ * ```
2930
+ */
2931
+ type PrinterHandlerContext<TOutput, TOptions extends object> = {
2932
+ /**
2933
+ * Recursively transform a nested `SchemaNode` to `TOutput` using the node-level handlers.
2934
+ * Use `this.transform` inside `nodes` handlers and inside the `print` override.
2935
+ */
2936
+ transform: (node: SchemaNode) => TOutput | null;
2937
+ /**
2938
+ * Options for this printer instance.
2939
+ */
2940
+ options: TOptions;
2941
+ };
2942
+ /**
2943
+ * Handler for one schema node type.
2944
+ *
2945
+ * Use a regular function (not an arrow function) if you need `this`.
2946
+ *
2947
+ * @example
2948
+ * ```ts
2949
+ * const handler: PrinterHandler<string, {}, 'string'> = function () {
2950
+ * return 'string'
2951
+ * }
2952
+ * ```
2953
+ */
2954
+ type PrinterHandler<TOutput, TOptions extends object, T extends SchemaType = SchemaType> = (this: PrinterHandlerContext<TOutput, TOptions>, node: SchemaNodeByType[T]) => TOutput | null;
2955
+ /**
2956
+ * Partial map of per-node-type handler overrides for a printer.
2957
+ *
2958
+ * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`).
2959
+ * Supply only the handlers you want to replace. The printer's built-in
2960
+ * defaults fill in the rest.
2961
+ *
2962
+ * @example
2963
+ * ```ts
2964
+ * pluginZod({
2965
+ * printer: {
2966
+ * nodes: {
2967
+ * date(): string {
2968
+ * return 'z.string().date()'
2969
+ * },
2970
+ * } satisfies PrinterPartial<string, PrinterZodOptions>,
2971
+ * },
2972
+ * })
2973
+ * ```
2974
+ */
2975
+ type PrinterPartial<TOutput, TOptions extends object> = Partial<{ [K in SchemaType]: PrinterHandler<TOutput, TOptions, K> }>;
2976
+ /**
2977
+ * Generic shape used by `definePrinter`.
2978
+ *
2979
+ * - `TName` unique string identifier (e.g. `'zod'`, `'ts'`)
2980
+ * - `TOptions` options passed to and stored on the printer instance
2981
+ * - `TOutput` the type emitted by node handlers
2982
+ * - `TPrintOutput` type returned by public `print` (defaults to `TOutput`)
2983
+ *
2984
+ * @example
2985
+ * ```ts
2986
+ * type MyPrinter = PrinterFactoryOptions<'my', { strict: boolean }, string>
2987
+ * ```
2988
+ */
2989
+ type PrinterFactoryOptions<TName extends string = string, TOptions extends object = object, TOutput = unknown, TPrintOutput = TOutput> = {
2990
+ name: TName;
2991
+ options: TOptions;
2992
+ output: TOutput;
2993
+ printOutput: TPrintOutput;
2994
+ };
2995
+ /**
2996
+ * Printer instance returned by a printer factory.
2997
+ *
2998
+ * @example
2999
+ * ```ts
3000
+ * const printer = definePrinter((options: {}) => ({ name: 'x', options, nodes: {} }))({})
3001
+ * ```
3002
+ */
3003
+ type Printer<T extends PrinterFactoryOptions = PrinterFactoryOptions> = {
3004
+ /**
3005
+ * Unique identifier supplied at creation time.
3006
+ */
3007
+ name: T['name'];
3008
+ /**
3009
+ * Options for this printer instance.
3010
+ */
3011
+ options: T['options'];
3012
+ /**
3013
+ * Node-level dispatcher, converts a `SchemaNode` directly to `TOutput` using the `nodes` handlers.
3014
+ * Always dispatches through the `nodes` map. Never calls the `print` override.
3015
+ * Use this when you need the raw output (e.g. `ts.TypeNode`) without declaration wrapping.
3016
+ */
3017
+ transform: (node: SchemaNode) => T['output'] | null;
3018
+ /**
3019
+ * Public printer. If the builder provides a root-level `print`, this calls that
3020
+ * higher-level function (which may produce full declarations).
3021
+ * Otherwise, falls back to the node-level dispatcher.
3022
+ */
3023
+ print: (node: SchemaNode) => T['printOutput'] | null;
3024
+ };
3025
+ /**
3026
+ * Builder function passed to `definePrinter`.
3027
+ *
3028
+ * It receives resolved options and returns:
3029
+ * - `name`
3030
+ * - `options`
3031
+ * - `nodes` handlers
3032
+ * - optional top-level `print` override
3033
+ *
3034
+ * @example
3035
+ * ```ts
3036
+ * const build = (options: {}) => ({ name: 'x' as const, options, nodes: {} })
3037
+ * ```
3038
+ */
3039
+ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) => {
3040
+ name: T['name'];
3041
+ /**
3042
+ * Options to store on the printer.
3043
+ */
3044
+ options: T['options'];
3045
+ nodes: Partial<{ [K in SchemaType]: PrinterHandler<T['output'], T['options'], K> }>;
3046
+ /**
3047
+ * Optional root-level print override. When provided, becomes the public `printer.print`.
3048
+ * Use `this.transform(node)` inside this function to dispatch to the node-level handlers (`nodes`),
3049
+ * not the override itself, so recursion is safe.
3050
+ */
3051
+ print?: (this: PrinterHandlerContext<T['output'], T['options']>, node: SchemaNode) => T['printOutput'] | null;
3052
+ };
3053
+ /**
3054
+ * Defines a schema printer: a function that takes a `SchemaNode` and emits
3055
+ * code in your target language. Each plugin that produces code from schemas
3056
+ * (TypeScript types, Zod schemas, Faker factories) ships a printer built
3057
+ * with this helper.
3058
+ *
3059
+ * The builder receives resolved options and returns:
3060
+ *
3061
+ * - `name` unique identifier for the printer.
3062
+ * - `options` stored on the returned printer instance.
3063
+ * - `nodes` map of `SchemaType` → handler. Handlers return the rendered
3064
+ * output (a string, a TypeScript AST node, ...) for that schema type.
3065
+ * - `print` (optional), top-level override exposed as `printer.print`.
3066
+ * Use `this.transform(node)` inside it to dispatch to `nodes` recursively.
3067
+ *
3068
+ * Without a `print` override, `printer.print` falls back to `printer.transform`
3069
+ * (the node-level dispatcher).
3070
+ *
3071
+ * @example Tiny Zod printer
3072
+ * ```ts
3073
+ * import { definePrinter, type PrinterFactoryOptions } from '@kubb/ast'
3074
+ *
3075
+ * type PrinterZod = PrinterFactoryOptions<'zod', { strict?: boolean }, string>
3076
+ *
3077
+ * export const zodPrinter = definePrinter<PrinterZod>((options) => ({
3078
+ * name: 'zod',
3079
+ * options: { strict: options.strict ?? true },
3080
+ * nodes: {
3081
+ * string: () => 'z.string()',
3082
+ * object(node) {
3083
+ * const props = node.properties
3084
+ * .map((p) => `${p.name}: ${this.transform(p.schema)}`)
3085
+ * .join(', ')
3086
+ * return `z.object({ ${props} })`
3087
+ * },
3088
+ * },
3089
+ * }))
3090
+ * ```
3091
+ */
3092
+ declare function definePrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
3093
+ /**
3094
+ * Generic printer-factory function used by `definePrinter` and `defineFunctionPrinter`.
3095
+ **
3096
+ * @example
3097
+ * ```ts
3098
+ * export const defineFunctionPrinter = createPrinterFactory<FunctionNode, FunctionNodeType, FunctionNodeByType>(
3099
+ * (node) => kindToHandlerKey[node.kind],
3100
+ * )
3101
+ * ```
3102
+ */
3103
+ 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"]) => {
3104
+ name: T["name"];
3105
+ options: T["options"];
3106
+ nodes: Partial<{ [K in TKey]: (this: {
3107
+ transform: (node: TNode) => T["output"] | null;
3108
+ options: T["options"];
3109
+ }, node: TNodeByKey[K]) => T["output"] | null }>;
3110
+ print?: (this: {
3111
+ transform: (node: TNode) => T["output"] | null;
3112
+ options: T["options"];
3113
+ }, node: TNode) => T["printOutput"] | null;
3114
+ }) => (options?: T["options"]) => {
3115
+ name: T["name"];
3116
+ options: T["options"];
3117
+ transform: (node: TNode) => T["output"] | null;
3118
+ print: (node: TNode) => T["printOutput"] | null;
3119
+ };
3120
+ //#endregion
3121
+ //#region src/visitor.d.ts
3122
+ /**
3123
+ * Ordered mapping of `[NodeType, ParentType]` pairs.
3124
+ *
3125
+ * `ParentOf` uses this map to find parent types.
3126
+ */
3127
+ 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]];
3128
+ /**
3129
+ * Resolves the parent node type for a given AST node type.
3130
+ *
3131
+ * This is used by visitor context so `ctx.parent` is correctly typed
3132
+ * for each callback.
3133
+ *
3134
+ * @example
3135
+ * ```ts
3136
+ * type InputParent = ParentOf<InputNode>
3137
+ * // undefined
3138
+ * ```
3139
+ *
3140
+ * @example
3141
+ * ```ts
3142
+ * type PropertyParent = ParentOf<PropertyNode>
3143
+ * // SchemaNode
3144
+ * ```
3145
+ *
3146
+ * @example
3147
+ * ```ts
3148
+ * type SchemaParent = ParentOf<SchemaNode>
3149
+ * // InputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode
3150
+ * ```
3151
+ */
3152
+ 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;
3153
+ /**
3154
+ * Traversal context passed as the second argument to every visitor callback.
3155
+ * `parent` is typed from the current node type.
3156
+ *
3157
+ * @example
3158
+ * ```ts
3159
+ * const visitor: Visitor = {
3160
+ * schema(node, { parent }) {
3161
+ * // parent type is narrowed by node kind
3162
+ * },
3163
+ * }
3164
+ * ```
3165
+ */
3166
+ type VisitorContext<T extends Node = Node> = {
3167
+ /**
3168
+ * Parent node of the currently visited node.
3169
+ * For `InputNode`, this is `undefined`.
3170
+ */
3171
+ parent?: ParentOf<T>;
3172
+ };
3173
+ /**
3174
+ * Synchronous visitor consumed by `transform`. Each optional callback runs
3175
+ * for the matching node type. Return a new node to replace it, or `undefined`
3176
+ * to leave it untouched.
3177
+ *
3178
+ * Plugins typically expose `transformer` so users can supply a `Visitor` that
3179
+ * rewrites operation IDs, drops descriptions, or otherwise tweaks the AST
3180
+ * before printing.
3181
+ *
3182
+ * @example Prefix every operationId
3183
+ * ```ts
3184
+ * const visitor: Visitor = {
3185
+ * operation(node) {
3186
+ * return { ...node, operationId: `api_${node.operationId}` }
3187
+ * },
3188
+ * }
3189
+ * ```
3190
+ *
3191
+ * @example Strip schema descriptions
3192
+ * ```ts
3193
+ * const visitor: Visitor = {
3194
+ * schema(node) {
3195
+ * return { ...node, description: undefined }
3196
+ * },
3197
+ * }
3198
+ * ```
3199
+ */
3200
+ type Visitor = {
3201
+ input?(node: InputNode, context: VisitorContext<InputNode>): undefined | null | InputNode;
3202
+ output?(node: OutputNode, context: VisitorContext<OutputNode>): undefined | null | OutputNode;
3203
+ operation?(node: OperationNode, context: VisitorContext<OperationNode>): undefined | null | OperationNode;
3204
+ schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): undefined | null | SchemaNode;
3205
+ property?(node: PropertyNode, context: VisitorContext<PropertyNode>): undefined | null | PropertyNode;
3206
+ parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): undefined | null | ParameterNode;
3207
+ response?(node: ResponseNode, context: VisitorContext<ResponseNode>): undefined | null | ResponseNode;
3208
+ };
3209
+ /**
3210
+ * Utility type for values that can be returned directly or asynchronously.
3211
+ */
3212
+ type MaybePromise<T> = T | Promise<T>;
3213
+ /**
3214
+ * Async visitor for `walk`. Synchronous `Visitor` objects are compatible.
3215
+ *
3216
+ * @example
3217
+ * ```ts
3218
+ * const visitor: AsyncVisitor = {
3219
+ * async operation(node) {
3220
+ * await Promise.resolve(node.operationId)
3221
+ * },
3222
+ * }
3223
+ * ```
3224
+ */
3225
+ type AsyncVisitor = {
3226
+ input?(node: InputNode, context: VisitorContext<InputNode>): MaybePromise<undefined | null | InputNode>;
3227
+ output?(node: OutputNode, context: VisitorContext<OutputNode>): MaybePromise<undefined | null | OutputNode>;
3228
+ operation?(node: OperationNode, context: VisitorContext<OperationNode>): MaybePromise<undefined | null | OperationNode>;
3229
+ schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): MaybePromise<undefined | null | SchemaNode>;
3230
+ property?(node: PropertyNode, context: VisitorContext<PropertyNode>): MaybePromise<undefined | null | PropertyNode>;
3231
+ parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): MaybePromise<undefined | null | ParameterNode>;
3232
+ response?(node: ResponseNode, context: VisitorContext<ResponseNode>): MaybePromise<undefined | null | ResponseNode>;
3233
+ };
3234
+ /**
3235
+ * Visitor used by `collect`.
3236
+ *
3237
+ * @example
3238
+ * ```ts
3239
+ * const visitor: CollectVisitor<string> = {
3240
+ * operation(node) {
3241
+ * return node.operationId
3242
+ * },
3243
+ * }
3244
+ * ```
3245
+ */
3246
+ type CollectVisitor<T> = {
3247
+ input?(node: InputNode, context: VisitorContext<InputNode>): T | null | undefined;
3248
+ output?(node: OutputNode, context: VisitorContext<OutputNode>): T | null | undefined;
3249
+ operation?(node: OperationNode, context: VisitorContext<OperationNode>): T | null | undefined;
3250
+ schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): T | null | undefined;
3251
+ property?(node: PropertyNode, context: VisitorContext<PropertyNode>): T | null | undefined;
3252
+ parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): T | null | undefined;
3253
+ response?(node: ResponseNode, context: VisitorContext<ResponseNode>): T | null | undefined;
3254
+ };
3255
+ /**
3256
+ * Options for `transform`.
3257
+ *
3258
+ * @example
3259
+ * ```ts
3260
+ * const options: TransformOptions = { depth: 'deep', schema: (node) => node }
3261
+ * ```
3262
+ *
3263
+ * @example
3264
+ * ```ts
3265
+ * // Only transform the current node, not nested children
3266
+ * const options: TransformOptions = { depth: 'shallow', schema: (node) => node }
3267
+ * ```
3268
+ */
3269
+ type TransformOptions = Visitor & {
3270
+ /**
3271
+ * Traversal depth (`'deep'` by default).
3272
+ * @default 'deep'
3273
+ */
3274
+ depth?: VisitorDepth;
3275
+ /**
3276
+ * Internal parent override used during recursion.
3277
+ */
3278
+ parent?: Node;
3279
+ };
3280
+ /**
3281
+ * Options for `walk`.
3282
+ *
3283
+ * @example
3284
+ * ```ts
3285
+ * const options: WalkOptions = { depth: 'deep', concurrency: 10, root: () => {} }
3286
+ * ```
3287
+ */
3288
+ type WalkOptions = AsyncVisitor & {
3289
+ /**
3290
+ * Traversal depth (`'deep'` by default).
3291
+ * @default 'deep'
3292
+ */
3293
+ depth?: VisitorDepth;
3294
+ /**
3295
+ * Maximum number of sibling nodes visited concurrently.
3296
+ * @default 30
3297
+ */
3298
+ concurrency?: number;
3299
+ };
3300
+ /**
3301
+ * Options for `collect`.
3302
+ *
3303
+ * @example
3304
+ * ```ts
3305
+ * const options: CollectOptions<string> = { depth: 'shallow', schema: () => undefined }
3306
+ * ```
3307
+ */
3308
+ type CollectOptions<T> = CollectVisitor<T> & {
3309
+ /**
3310
+ * Traversal depth (`'deep'` by default).
3311
+ * @default 'deep'
3312
+ */
3313
+ depth?: VisitorDepth;
3314
+ /**
3315
+ * Internal parent override used during recursion.
3316
+ */
3317
+ parent?: Node;
3318
+ };
3319
+ /**
3320
+ * Async depth-first traversal for side effects. Visitor return values are
3321
+ * ignored. Use `transform` when you want to rewrite nodes.
3322
+ *
3323
+ * Sibling nodes at each depth run concurrently up to `options.concurrency`
3324
+ * (defaults to `WALK_CONCURRENCY`). Higher values overlap I/O-bound visitor
3325
+ * work. Lower values reduce memory pressure.
3326
+ *
3327
+ * @example Log every operation
3328
+ * ```ts
3329
+ * await walk(root, {
3330
+ * operation(node) {
3331
+ * console.log(node.operationId)
3332
+ * },
3333
+ * })
3334
+ * ```
3335
+ *
3336
+ * @example Only visit the root node
3337
+ * ```ts
3338
+ * await walk(root, { depth: 'shallow', input: () => {} })
3339
+ * ```
3340
+ */
3341
+ declare function walk(node: Node, options: WalkOptions): Promise<void>;
3342
+ /**
3343
+ * Synchronous depth-first transform. Each visitor callback gets a chance to
3344
+ * return a replacement node; `undefined` keeps the original.
3345
+ *
3346
+ * The transform is immutable. The original tree is not mutated. A new tree
3347
+ * is returned. Use `depth: 'shallow'` to skip recursion into children.
3348
+ *
3349
+ * @example Prefix every operationId
3350
+ * ```ts
3351
+ * const next = transform(root, {
3352
+ * operation(node) {
3353
+ * return { ...node, operationId: `prefixed_${node.operationId}` }
3354
+ * },
3355
+ * })
3356
+ * ```
3357
+ *
3358
+ * @example Replace only the root node
3359
+ * ```ts
3360
+ * const next = transform(root, {
3361
+ * depth: 'shallow',
3362
+ * input: (node) => ({ ...node, meta: { ...node.meta, title: 'Rewritten' } }),
3363
+ * })
3364
+ * ```
3365
+ */
3366
+ declare function transform(node: InputNode, options: TransformOptions): InputNode;
3367
+ declare function transform(node: OutputNode, options: TransformOptions): OutputNode;
3368
+ declare function transform(node: OperationNode, options: TransformOptions): OperationNode;
3369
+ declare function transform(node: SchemaNode, options: TransformOptions): SchemaNode;
3370
+ declare function transform(node: PropertyNode, options: TransformOptions): PropertyNode;
3371
+ declare function transform(node: ParameterNode, options: TransformOptions): ParameterNode;
3372
+ declare function transform(node: ResponseNode, options: TransformOptions): ResponseNode;
3373
+ declare function transform(node: Node, options: TransformOptions): Node;
3374
+ /**
3375
+ * Eager depth-first collection pass. Returns an array of every non-null value
3376
+ * the visitor callbacks return.
3377
+ *
3378
+ * @example Collect every operationId
3379
+ * ```ts
3380
+ * const ids = collect<string>(root, {
3381
+ * operation(node) {
3382
+ * return node.operationId
3383
+ * },
3384
+ * })
3385
+ * ```
3386
+ */
3387
+ declare function collect<T>(node: Node, options: CollectOptions<T>): Array<T>;
3388
+ //#endregion
3389
+ //#region src/utils.d.ts
3390
+ /**
3391
+ * Merges a ref node with its resolved schema, giving usage-site fields precedence.
3392
+ *
3393
+ * Usage-site fields (`description`, `readOnly`, `nullable`, `deprecated`) on the ref node
3394
+ * override the same fields in the resolved `node.schema`. Non-ref nodes are returned unchanged.
3395
+ *
3396
+ * @example
3397
+ * ```ts
3398
+ * // Ref with description override
3399
+ * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })
3400
+ * const merged = syncSchemaRef(ref) // merges with resolved Pet schema
3401
+ * ```
3402
+ */
3403
+ declare function syncSchemaRef(node: SchemaNode): SchemaNode;
3404
+ /**
3405
+ * Type guard that returns `true` when a schema emits as a plain `string` type.
3406
+ *
3407
+ * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`
3408
+ * types, returns `true` only when `representation` is `'string'` rather than `'date'`.
3409
+ */
3410
+ declare function isStringType(node: SchemaNode): boolean;
3411
+ declare function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode>;
3412
+ /**
3413
+ * Creates a single-property object schema used as a discriminator literal.
3414
+ *
3415
+ * @example
3416
+ * ```ts
3417
+ * createDiscriminantNode({ propertyName: 'type', value: 'dog' })
3418
+ * // -> { type: 'object', properties: [{ name: 'type', required: true, schema: enum('dog') }] }
3419
+ * ```
3420
+ */
3421
+ declare function createDiscriminantNode({
3422
+ propertyName,
3423
+ value
3424
+ }: {
3425
+ propertyName: string;
3426
+ value: string;
3427
+ }): SchemaNode;
3428
+ /**
3429
+ * Resolver interface for {@link createOperationParams}.
3430
+ *
3431
+ * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.
3432
+ */
3433
+ type OperationParamsResolver = {
3434
+ /**
3435
+ * Resolves the type name for an individual parameter.
3436
+ *
3437
+ * @example Individual path parameter name
3438
+ * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`
3439
+ */
3440
+ resolveParamName(node: OperationNode, param: ParameterNode): string;
3441
+ /**
3442
+ * Resolves the request body type name.
3443
+ *
3444
+ * @example Request body type name
3445
+ * `resolver.resolveDataName(node) // → 'CreatePetData'`
3446
+ */
3447
+ resolveDataName(node: OperationNode): string;
3448
+ /**
3449
+ * Resolves the grouped path parameters type name.
3450
+ * When the return value equals `resolveParamName`, no indexed access is emitted.
3451
+ *
3452
+ * @example Grouped path params type name
3453
+ * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`
3454
+ */
3455
+ resolvePathParamsName(node: OperationNode, param: ParameterNode): string;
3456
+ /**
3457
+ * Resolves the grouped query parameters type name.
3458
+ * When the return value equals `resolveParamName`, an inline struct type is emitted instead.
3459
+ *
3460
+ * @example Grouped query params type name
3461
+ * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`
3462
+ */
3463
+ resolveQueryParamsName(node: OperationNode, param: ParameterNode): string;
3464
+ /**
3465
+ * Resolves the grouped header parameters type name.
3466
+ * When the return value equals `resolveParamName`, an inline struct type is emitted instead.
3467
+ *
3468
+ * @example Grouped header params type name
3469
+ * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`
3470
+ */
3471
+ resolveHeaderParamsName(node: OperationNode, param: ParameterNode): string;
3472
+ };
3473
+ /**
3474
+ * Options for {@link createOperationParams}.
3475
+ */
3476
+ type CreateOperationParamsOptions = {
3477
+ /**
3478
+ * How all operation parameters are grouped in the function signature.
3479
+ * - `'object'` wraps all params into a single destructured object `{ petId, data, params }`
3480
+ * - `'inline'` emits each param category as a separate top-level parameter
3481
+ */
3482
+ paramsType: 'object' | 'inline';
3483
+ /**
3484
+ * How path parameters are emitted when `paramsType` is `'inline'`.
3485
+ * - `'object'` groups them as `{ petId, storeId }: PathParams`
3486
+ * - `'inline'` spreads them as individual parameters `petId: string, storeId: string`
3487
+ * - `'inlineSpread'` emits a single rest parameter `...pathParams: PathParams`
3488
+ */
3489
+ pathParamsType: 'object' | 'inline' | 'inlineSpread';
3490
+ /**
3491
+ * Converts parameter names to camelCase before output.
3492
+ */
3493
+ paramsCasing?: 'camelcase';
3494
+ /**
3495
+ * Resolver for parameter and request body type names.
3496
+ * Pass `ResolverTs` from `@kubb/plugin-ts` directly.
3497
+ * When omitted, falls back to the schema primitive or `'unknown'`.
3498
+ */
3499
+ resolver?: OperationParamsResolver;
3500
+ /**
3501
+ * Default value for the path parameters binding when `pathParamsType` is `'object'`.
3502
+ * Falls back to `'{}'` when all path params are optional.
3503
+ */
3504
+ pathParamsDefault?: string;
3505
+ /**
3506
+ * Extra parameters appended after the standard operation parameters.
3507
+ *
3508
+ * @example Plugin-specific trailing parameter
3509
+ * ```ts
3510
+ * extraParams: [createFunctionParameter({ name: 'options', type: 'Partial<RequestOptions>', default: '{}' })]
3511
+ * ```
3512
+ */
3513
+ extraParams?: Array<FunctionParameterNode | ParameterGroupNode>;
3514
+ /**
3515
+ * Override the default parameter names used for body, query, header, and rest-path groups.
3516
+ *
3517
+ * Useful when targeting languages or frameworks with different naming conventions.
3518
+ *
3519
+ * @default { data: 'data', params: 'params', headers: 'headers', path: 'pathParams' }
3520
+ */
3521
+ paramNames?: {
3522
+ /**
3523
+ * Name for the request body parameter.
3524
+ * @default 'data'
3525
+ */
3526
+ data?: string;
3527
+ /**
3528
+ * Name for the query parameters group parameter.
3529
+ * @default 'params'
3530
+ */
3531
+ params?: string;
3532
+ /**
3533
+ * Name for the header parameters group parameter.
3534
+ * @default 'headers'
3535
+ */
3536
+ headers?: string;
3537
+ /**
3538
+ * Name for the rest path-parameters parameter when `pathParamsType` is `'inlineSpread'`.
3539
+ * @default 'pathParams'
3540
+ */
3541
+ path?: string;
3542
+ };
3543
+ /**
3544
+ * Applies a uniform transformation to every resolved type name before it is used
3545
+ * in a parameter node. Use this for framework-level type wrappers.
3546
+ *
3547
+ * @example Vue Query, wrap every parameter type with `MaybeRefOrGetter`
3548
+ * `typeWrapper: (t) => \`MaybeRefOrGetter<${t}>\``
3549
+ */
3550
+ typeWrapper?: (type: string) => string;
3551
+ };
3552
+ /**
3553
+ * Converts an `OperationNode` into function parameters for code generation.
3554
+ *
3555
+ * Centralizes parameter grouping logic for all plugins. Provide a `resolver` for type name resolution
3556
+ * and `extraParams` for plugin-specific trailing parameters (e.g., `options` objects).
3557
+ * Supports three grouping modes: `object` (single destructured param), `inline` (separate params),
3558
+ * and `inlineSpread` (rest parameter). Use `CreateOperationParamsOptions` to fine-tune output.
3559
+ */
3560
+ declare function createOperationParams(node: OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode;
3561
+ /**
3562
+ * Extracts all string content from a `CodeNode` tree recursively.
3563
+ *
3564
+ * Collects text node values, identifier references in string fields (`params`, `generics`, `returnType`, `type`),
3565
+ * and nested node content. Used internally to build the full source string for import filtering.
3566
+ */
3567
+ declare function extractStringsFromNodes(nodes: Array<CodeNode> | undefined): string;
3568
+ declare function collectUsedSchemaNames(operations: ReadonlyArray<OperationNode>, schemas: ReadonlyArray<SchemaNode>): Set<string>;
3569
+ /**
3570
+ * Identifies all schemas that participate in circular dependency chains, including direct self-loops.
3571
+ *
3572
+ * Returns a Set of schema names with circular dependencies. Use this to wrap recursive schema positions
3573
+ * in deferred constructs (lazy getter, `z.lazy(() => …)`) to prevent infinite recursion when generated code runs.
3574
+ * Refs are followed by name only, keeping the algorithm linear in the schema graph size.
3575
+ *
3576
+ * @note Call this once on the full schema graph, then use `containsCircularRef()` to check individual schemas.
3577
+ */
3578
+ declare function findCircularSchemas(schemas: ReadonlyArray<SchemaNode>): Set<string>;
3579
+ /**
3580
+ * Type guard returning `true` when a schema or anything nested within it contains a ref to a circular schema.
3581
+ *
3582
+ * Use `excludeName` to ignore refs to specific schemas (useful when self-references are handled separately).
3583
+ * Commonly used with `findCircularSchemas()` to detect where lazy wrappers are needed in code generation.
3584
+ *
3585
+ * @note Returns `true` for the first matching circular ref found. Use for fast dependency checks.
3586
+ */
3587
+ declare function containsCircularRef(node: SchemaNode | undefined, {
3588
+ circularSchemas,
3589
+ excludeName
3590
+ }: {
3591
+ circularSchemas: ReadonlySet<string>;
3592
+ excludeName?: string;
3593
+ }): boolean;
3594
+ //#endregion
3595
+ 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 };
3596
+ //# sourceMappingURL=types-CEIHPTfs.d.ts.map