@kubb/ast 5.0.0-beta.57 → 5.0.0-beta.59

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/README.md +21 -7
  2. package/dist/casing-BE2R1RXg.cjs +88 -0
  3. package/dist/casing-BE2R1RXg.cjs.map +1 -0
  4. package/dist/chunk-CNktS9qV.js +17 -0
  5. package/dist/extractStringsFromNodes-WMYJ8nQL.d.ts +82 -0
  6. package/dist/factory-BmcGBdeg.cjs +1251 -0
  7. package/dist/factory-BmcGBdeg.cjs.map +1 -0
  8. package/dist/factory-Du7nEP4B.js +282 -0
  9. package/dist/factory-Du7nEP4B.js.map +1 -0
  10. package/dist/factory.cjs +28 -0
  11. package/dist/factory.d.ts +62 -0
  12. package/dist/factory.js +3 -0
  13. package/dist/{types-C5aVnRE1.d.ts → index-BzjwdK2M.d.ts} +94 -1146
  14. package/dist/index.cjs +220 -1481
  15. package/dist/index.cjs.map +1 -1
  16. package/dist/index.d.ts +96 -58
  17. package/dist/index.js +182 -1920
  18. package/dist/index.js.map +1 -1
  19. package/dist/operationParams-BZ07xDm0.d.ts +204 -0
  20. package/dist/response-DKxTr522.js +683 -0
  21. package/dist/response-DKxTr522.js.map +1 -0
  22. package/dist/types-olVl9v5p.d.ts +764 -0
  23. package/dist/types.d.ts +5 -2
  24. package/dist/utils-BCtRXfhI.cjs +275 -0
  25. package/dist/utils-BCtRXfhI.cjs.map +1 -0
  26. package/dist/utils-SdZU0F3H.js +1336 -0
  27. package/dist/utils-SdZU0F3H.js.map +1 -0
  28. package/dist/utils.cjs +129 -13
  29. package/dist/utils.d.ts +127 -76
  30. package/dist/utils.js +3 -2
  31. package/package.json +5 -1
  32. package/src/constants.ts +8 -14
  33. package/src/dedupe.ts +8 -0
  34. package/src/factory.ts +18 -1
  35. package/src/guards.ts +1 -1
  36. package/src/index.ts +7 -50
  37. package/src/node.ts +1 -1
  38. package/src/nodes/base.ts +0 -10
  39. package/src/nodes/code.ts +29 -47
  40. package/src/nodes/content.ts +2 -2
  41. package/src/nodes/file.ts +28 -23
  42. package/src/nodes/function.ts +2 -17
  43. package/src/nodes/index.ts +1 -1
  44. package/src/nodes/input.ts +20 -19
  45. package/src/nodes/operation.ts +1 -1
  46. package/src/nodes/parameter.ts +0 -3
  47. package/src/nodes/property.ts +0 -3
  48. package/src/nodes/requestBody.ts +3 -6
  49. package/src/nodes/schema.ts +3 -2
  50. package/src/printer.ts +4 -4
  51. package/src/registry.ts +31 -26
  52. package/src/signature.ts +3 -3
  53. package/src/transformers.ts +28 -1
  54. package/src/types.ts +2 -53
  55. package/src/utils/codegen.ts +104 -0
  56. package/src/utils/extractStringsFromNodes.ts +34 -0
  57. package/src/utils/fileMerge.ts +184 -0
  58. package/src/utils/index.ts +8 -296
  59. package/src/utils/operationParams.ts +353 -0
  60. package/src/utils/refs.ts +112 -0
  61. package/src/utils/schemaGraph.ts +169 -0
  62. package/src/utils/strings.ts +139 -0
  63. package/src/visitor.ts +43 -19
  64. package/dist/chunk-C0LytTxp.js +0 -8
  65. package/dist/utils-0p8ZO287.js +0 -570
  66. package/dist/utils-0p8ZO287.js.map +0 -1
  67. package/dist/utils-cdQ6Pzyi.cjs +0 -726
  68. package/dist/utils-cdQ6Pzyi.cjs.map +0 -1
  69. package/src/utils/ast.ts +0 -879
@@ -1,142 +1,5 @@
1
- import { t as __name } from "./chunk-C0LytTxp.js";
1
+ import { n as __name } from "./chunk-CNktS9qV.js";
2
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
- /**
125
- * HTTP method identifiers used by operation nodes.
126
- *
127
- * Includes all standard HTTP methods (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS, TRACE).
128
- */
129
- declare const httpMethods: {
130
- readonly get: "GET";
131
- readonly post: "POST";
132
- readonly put: "PUT";
133
- readonly patch: "PATCH";
134
- readonly delete: "DELETE";
135
- readonly head: "HEAD";
136
- readonly options: "OPTIONS";
137
- readonly trace: "TRACE";
138
- };
139
- //#endregion
140
3
  //#region src/nodes/base.d.ts
141
4
  /**
142
5
  * `kind` values used by AST nodes.
@@ -265,7 +128,11 @@ declare function defineNode<TNode extends BaseNode, TInput = Omit<TNode, 'kind'>
265
128
  type JSDocNode = {
266
129
  /**
267
130
  * JSDoc comment lines. `undefined` entries are filtered out during rendering.
268
- * @example ['@description A pet resource', '@deprecated']
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * ['@description A pet resource', '@deprecated']
135
+ * ```
269
136
  */
270
137
  comments?: Array<string | undefined>;
271
138
  };
@@ -282,9 +149,6 @@ type JSDocNode = {
282
149
  * ```
283
150
  */
284
151
  type ConstNode = BaseNode & {
285
- /**
286
- * Node kind.
287
- */
288
152
  kind: 'Const';
289
153
  /**
290
154
  * Name of the constant declaration.
@@ -292,12 +156,13 @@ type ConstNode = BaseNode & {
292
156
  name: string;
293
157
  /**
294
158
  * Whether the declaration should be exported.
295
- * @default false
296
159
  */
297
160
  export?: boolean | null;
298
161
  /**
299
- * Optional explicit type annotation.
300
- * @example 'Pet'
162
+ * Explicit type annotation.
163
+ *
164
+ * @example Type reference
165
+ * `'Pet'`
301
166
  */
302
167
  type?: string | null;
303
168
  /**
@@ -306,12 +171,11 @@ type ConstNode = BaseNode & {
306
171
  JSDoc?: JSDocNode | null;
307
172
  /**
308
173
  * Whether to append `as const` to the declaration.
309
- * @default false
310
174
  */
311
175
  asConst?: boolean | null;
312
176
  /**
313
177
  * Child nodes representing the value of the constant (children of the `Const` component).
314
- * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
178
+ * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
315
179
  */
316
180
  nodes?: Array<CodeNode>;
317
181
  };
@@ -328,9 +192,6 @@ type ConstNode = BaseNode & {
328
192
  * ```
329
193
  */
330
194
  type TypeNode = BaseNode & {
331
- /**
332
- * Node kind.
333
- */
334
195
  kind: 'Type';
335
196
  /**
336
197
  * Name of the type alias.
@@ -338,7 +199,6 @@ type TypeNode = BaseNode & {
338
199
  name: string;
339
200
  /**
340
201
  * Whether the declaration should be exported.
341
- * @default false
342
202
  */
343
203
  export?: boolean | null;
344
204
  /**
@@ -347,7 +207,7 @@ type TypeNode = BaseNode & {
347
207
  JSDoc?: JSDocNode | null;
348
208
  /**
349
209
  * Child nodes representing the type body (children of the `Type` component).
350
- * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
210
+ * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
351
211
  */
352
212
  nodes?: Array<CodeNode>;
353
213
  };
@@ -364,9 +224,6 @@ type TypeNode = BaseNode & {
364
224
  * ```
365
225
  */
366
226
  type FunctionNode = BaseNode & {
367
- /**
368
- * Node kind.
369
- */
370
227
  kind: 'Function';
371
228
  /**
372
229
  * Name of the function.
@@ -374,7 +231,6 @@ type FunctionNode = BaseNode & {
374
231
  name: string;
375
232
  /**
376
233
  * Whether the function is a default export.
377
- * @default false
378
234
  */
379
235
  default?: boolean | null;
380
236
  /**
@@ -383,22 +239,24 @@ type FunctionNode = BaseNode & {
383
239
  params?: string | null;
384
240
  /**
385
241
  * Whether the function should be exported.
386
- * @default false
387
242
  */
388
243
  export?: boolean | null;
389
244
  /**
390
245
  * Whether the function is async. When `true`, the return type is wrapped in `Promise<>`.
391
- * @default false
392
246
  */
393
247
  async?: boolean | null;
394
248
  /**
395
249
  * TypeScript generic type parameters.
396
- * @example ['T', 'U extends string']
250
+ *
251
+ * @example Constrained generics
252
+ * `['T', 'U extends string']`
397
253
  */
398
254
  generics?: string | Array<string> | null;
399
255
  /**
400
256
  * Return type annotation.
401
- * @example 'Pet'
257
+ *
258
+ * @example Type reference
259
+ * `'Pet'`
402
260
  */
403
261
  returnType?: string | null;
404
262
  /**
@@ -407,7 +265,7 @@ type FunctionNode = BaseNode & {
407
265
  JSDoc?: JSDocNode | null;
408
266
  /**
409
267
  * Child nodes representing the function body (children of the `Function` component).
410
- * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
268
+ * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
411
269
  */
412
270
  nodes?: Array<CodeNode>;
413
271
  };
@@ -424,9 +282,6 @@ type FunctionNode = BaseNode & {
424
282
  * ```
425
283
  */
426
284
  type ArrowFunctionNode = BaseNode & {
427
- /**
428
- * Node kind.
429
- */
430
285
  kind: 'ArrowFunction';
431
286
  /**
432
287
  * Name of the arrow function (used as the `const` variable name).
@@ -434,7 +289,6 @@ type ArrowFunctionNode = BaseNode & {
434
289
  name: string;
435
290
  /**
436
291
  * Whether the function is a default export.
437
- * @default false
438
292
  */
439
293
  default?: boolean | null;
440
294
  /**
@@ -443,22 +297,24 @@ type ArrowFunctionNode = BaseNode & {
443
297
  params?: string | null;
444
298
  /**
445
299
  * Whether the arrow function should be exported.
446
- * @default false
447
300
  */
448
301
  export?: boolean | null;
449
302
  /**
450
303
  * Whether the arrow function is async. When `true`, the return type is wrapped in `Promise<>`.
451
- * @default false
452
304
  */
453
305
  async?: boolean | null;
454
306
  /**
455
307
  * TypeScript generic type parameters.
456
- * @example ['T', 'U extends string']
308
+ *
309
+ * @example Constrained generics
310
+ * `['T', 'U extends string']`
457
311
  */
458
312
  generics?: string | Array<string> | null;
459
313
  /**
460
314
  * Return type annotation.
461
- * @example 'Pet'
315
+ *
316
+ * @example Type reference
317
+ * `'Pet'`
462
318
  */
463
319
  returnType?: string | null;
464
320
  /**
@@ -467,12 +323,11 @@ type ArrowFunctionNode = BaseNode & {
467
323
  JSDoc?: JSDocNode | null;
468
324
  /**
469
325
  * Render the arrow function body as a single-line expression.
470
- * @default false
471
326
  */
472
327
  singleLine?: boolean | null;
473
328
  /**
474
329
  * Child nodes representing the function body (children of the `Function.Arrow` component).
475
- * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
330
+ * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.
476
331
  */
477
332
  nodes?: Array<CodeNode>;
478
333
  };
@@ -489,9 +344,6 @@ type ArrowFunctionNode = BaseNode & {
489
344
  * ```
490
345
  */
491
346
  type TextNode = BaseNode & {
492
- /**
493
- * Node kind.
494
- */
495
347
  kind: 'Text';
496
348
  /**
497
349
  * The raw string content.
@@ -501,9 +353,8 @@ type TextNode = BaseNode & {
501
353
  /**
502
354
  * AST node representing a line break in the source output.
503
355
  *
504
- * Corresponds to `<br/>` in JSX components. When printed, produces an empty
505
- * string that, joined with `\n` by `printNodes` creates a blank line
506
- * between surrounding code nodes.
356
+ * Corresponds to `<br/>` in JSX components. When printed it produces an empty string,
357
+ * so joining nodes with `\n` in `printNodes` leaves a blank line between the surrounding code.
507
358
  *
508
359
  * @example
509
360
  * ```ts
@@ -513,16 +364,13 @@ type TextNode = BaseNode & {
513
364
  * ```
514
365
  */
515
366
  type BreakNode = BaseNode & {
516
- /**
517
- * Node kind.
518
- */
519
367
  kind: 'Break';
520
368
  };
521
369
  /**
522
370
  * AST node representing a raw JSX fragment in the source output.
523
371
  *
524
- * Mirrors the `Jsx` component from `@kubb/renderer-jsx`. Use this to embed raw
525
- * JSX/TSX markup (including fragments `<>…</>`) directly in generated code.
372
+ * Mirrors the `Jsx` component from `@kubb/renderer-jsx`. Embeds raw JSX/TSX markup
373
+ * (including fragments `<>…</>`) directly in generated code.
526
374
  *
527
375
  * @example
528
376
  * ```ts
@@ -531,9 +379,6 @@ type BreakNode = BaseNode & {
531
379
  * ```
532
380
  */
533
381
  type JsxNode = BaseNode & {
534
- /**
535
- * Node kind.
536
- */
537
382
  kind: 'Jsx';
538
383
  /**
539
384
  * The raw JSX string content.
@@ -809,9 +654,6 @@ type InferSchemaNode<TSchema extends object, TDateType extends ParserOptions['da
809
654
  * ```
810
655
  */
811
656
  type PropertyNode = BaseNode & {
812
- /**
813
- * Node kind.
814
- */
815
657
  kind: 'Property';
816
658
  /**
817
659
  * Property key.
@@ -1100,8 +942,9 @@ type UnionSchemaNode = CompositeSchemaNodeBase & {
1100
942
  */
1101
943
  discriminatorPropertyName?: string;
1102
944
  /**
1103
- * Logical strategy applied to union members: 'one' means exactly one member must be valid (from `oneOf`),
1104
- * 'any' means any number of members can be valid (from `anyOf`).
945
+ * How many union members must be valid.
946
+ * - `'one'`: exactly one member, from `oneOf`
947
+ * - `'any'`: any number of members, from `anyOf`
1105
948
  */
1106
949
  strategy?: 'one' | 'any';
1107
950
  };
@@ -1481,8 +1324,8 @@ declare function createSchema(props: CreateSchemaInput): SchemaNode;
1481
1324
  /**
1482
1325
  * AST node representing one content-type entry of a request body or response.
1483
1326
  *
1484
- * One entry per content type declared in the spec (e.g. `application/json`,
1485
- * `multipart/form-data`), each carrying its own body schema.
1327
+ * There is one entry per content type declared in the spec (e.g. `application/json`,
1328
+ * `multipart/form-data`), and each entry holds its own body schema.
1486
1329
  *
1487
1330
  * @example
1488
1331
  * ```ts
@@ -1520,6 +1363,10 @@ type UserContent = Omit<ContentNode, 'kind'>;
1520
1363
  * Definition for the {@link ContentNode}.
1521
1364
  */
1522
1365
  declare const contentDef: NodeDef<ContentNode, UserContent>;
1366
+ /**
1367
+ * Creates a `ContentNode` for a single request-body or response content type.
1368
+ */
1369
+ declare const createContent: (input: UserContent) => ContentNode;
1523
1370
  //#endregion
1524
1371
  //#region src/nodes/file.d.ts
1525
1372
  /**
@@ -1557,27 +1404,31 @@ type ImportNode = BaseNode & {
1557
1404
  kind: 'Import';
1558
1405
  /**
1559
1406
  * Import name(s) to be used.
1560
- * @example ['useState']
1561
- * @example 'React'
1407
+ *
1408
+ * @example Named imports
1409
+ * `['useState']`
1410
+ *
1411
+ * @example Default import
1412
+ * `'React'`
1562
1413
  */
1563
1414
  name: ImportName;
1564
1415
  /**
1565
1416
  * Path for the import.
1566
- * @example '@kubb/core'
1417
+ *
1418
+ * @example
1419
+ * `'@kubb/core'`
1567
1420
  */
1568
1421
  path: string;
1569
1422
  /**
1570
- * Add type-only import prefix.
1423
+ * Add a type-only import prefix.
1571
1424
  * - `true` generates `import type { Type } from './path'`
1572
1425
  * - `false` generates `import { Type } from './path'`
1573
- * @default false
1574
1426
  */
1575
1427
  isTypeOnly?: boolean | null;
1576
1428
  /**
1577
- * Import entire module as namespace.
1429
+ * Import the entire module as a namespace.
1578
1430
  * - `true` generates `import * as Name from './path'`
1579
- * - `false` generates standard import
1580
- * @default false
1431
+ * - `false` generates a standard import
1581
1432
  */
1582
1433
  isNameSpace?: boolean | null;
1583
1434
  /**
@@ -1612,27 +1463,31 @@ type ExportNode = BaseNode & {
1612
1463
  kind: 'Export';
1613
1464
  /**
1614
1465
  * Export name(s) to be used. When omitted, generates a wildcard export.
1615
- * @example ['useState']
1616
- * @example 'React'
1466
+ *
1467
+ * @example Named exports
1468
+ * `['useState']`
1469
+ *
1470
+ * @example Single export
1471
+ * `'React'`
1617
1472
  */
1618
1473
  name?: string | Array<string> | null;
1619
1474
  /**
1620
1475
  * Path for the export.
1621
- * @example '@kubb/core'
1476
+ *
1477
+ * @example
1478
+ * `'@kubb/core'`
1622
1479
  */
1623
1480
  path: string;
1624
1481
  /**
1625
- * Add type-only export prefix.
1482
+ * Add a type-only export prefix.
1626
1483
  * - `true` generates `export type { Type } from './path'`
1627
1484
  * - `false` generates `export { Type } from './path'`
1628
- * @default false
1629
1485
  */
1630
1486
  isTypeOnly?: boolean | null;
1631
1487
  /**
1632
1488
  * Export as an aliased namespace.
1633
1489
  * - `true` generates `export * as aliasName from './path'`
1634
1490
  * - `false` generates a standard export
1635
- * @default false
1636
1491
  */
1637
1492
  asAlias?: boolean | null;
1638
1493
  };
@@ -1657,22 +1512,19 @@ type SourceNode = BaseNode & {
1657
1512
  name?: string | null;
1658
1513
  /**
1659
1514
  * Mark this source as a type-only export.
1660
- * @default false
1661
1515
  */
1662
1516
  isTypeOnly?: boolean | null;
1663
1517
  /**
1664
- * Include `export` keyword in the generated source.
1665
- * @default false
1518
+ * Include the `export` keyword in the generated source.
1666
1519
  */
1667
1520
  isExportable?: boolean | null;
1668
1521
  /**
1669
1522
  * Include this source in barrel/index file generation.
1670
- * @default false
1671
1523
  */
1672
1524
  isIndexable?: boolean | null;
1673
1525
  /**
1674
- * Structured child nodes representing the content of this source fragment, in DOM order.
1675
- * Each entry is a {@link CodeNode}; use {@link TextNode} for raw string content.
1526
+ * Child nodes that make up this source fragment, in DOM order.
1527
+ * Use a {@link TextNode} for raw string content.
1676
1528
  */
1677
1529
  nodes?: Array<CodeNode>;
1678
1530
  };
@@ -1699,8 +1551,8 @@ type SourceNode = BaseNode & {
1699
1551
  type FileNode<TMeta extends object = object> = BaseNode & {
1700
1552
  kind: 'File';
1701
1553
  /**
1702
- * Unique identifier derived from a SHA256 hash of the file path. Computed
1703
- * by `createFile`; callers do not need to provide it.
1554
+ * Unique identifier derived from a SHA256 hash of the file path. `createFile`
1555
+ * computes it, so callers do not need to provide it.
1704
1556
  */
1705
1557
  id: string;
1706
1558
  /**
@@ -1735,7 +1587,7 @@ type FileNode<TMeta extends object = object> = BaseNode & {
1735
1587
  */
1736
1588
  exports: Array<ExportNode>;
1737
1589
  /**
1738
- * Optional metadata attached to this file (used by plugins for barrel generation etc.).
1590
+ * Optional metadata attached to this file, read by plugins during barrel generation.
1739
1591
  */
1740
1592
  meta?: TMeta;
1741
1593
  /**
@@ -1816,9 +1668,6 @@ type TypeExpression = string | TypeLiteralNode | IndexedAccessTypeNode;
1816
1668
  * ```
1817
1669
  */
1818
1670
  type TypeLiteralNode = BaseNode & {
1819
- /**
1820
- * Node kind.
1821
- */
1822
1671
  kind: 'TypeLiteral';
1823
1672
  /**
1824
1673
  * Members of the object type, rendered in order.
@@ -1849,9 +1698,6 @@ type TypeLiteralNode = BaseNode & {
1849
1698
  * ```
1850
1699
  */
1851
1700
  type IndexedAccessTypeNode = BaseNode & {
1852
- /**
1853
- * Node kind.
1854
- */
1855
1701
  kind: 'IndexedAccessType';
1856
1702
  /**
1857
1703
  * Name of the type being indexed, e.g. `'GetPetPathParams'`.
@@ -1873,9 +1719,6 @@ type IndexedAccessTypeNode = BaseNode & {
1873
1719
  * ```
1874
1720
  */
1875
1721
  type ObjectBindingPatternNode = BaseNode & {
1876
- /**
1877
- * Node kind.
1878
- */
1879
1722
  kind: 'ObjectBindingPattern';
1880
1723
  /**
1881
1724
  * Bound elements, rendered in order.
@@ -1913,9 +1756,6 @@ type ObjectBindingPatternNode = BaseNode & {
1913
1756
  * `{ id, name? }: { id: string; name?: string } = {}`
1914
1757
  */
1915
1758
  type FunctionParameterNode = BaseNode & {
1916
- /**
1917
- * Node kind.
1918
- */
1919
1759
  kind: 'FunctionParameter';
1920
1760
  /**
1921
1761
  * Parameter name, or an {@link ObjectBindingPatternNode} for a destructured group.
@@ -1949,9 +1789,6 @@ type FunctionParameterNode = BaseNode & {
1949
1789
  * - `call` → `(id, { method, url })` function call arguments
1950
1790
  */
1951
1791
  type FunctionParametersNode = BaseNode & {
1952
- /**
1953
- * Node kind.
1954
- */
1955
1792
  kind: 'FunctionParameters';
1956
1793
  /**
1957
1794
  * Ordered parameter nodes.
@@ -1963,9 +1800,9 @@ type FunctionParametersNode = BaseNode & {
1963
1800
  */
1964
1801
  type FunctionParamNode = FunctionParameterNode | FunctionParametersNode | TypeLiteralNode | IndexedAccessTypeNode | ObjectBindingPatternNode;
1965
1802
  /**
1966
- * Handler map keys, one per `FunctionParamNode` kind.
1803
+ * Handler-map keys for the function-parameter printer, one per {@link FunctionParamNode} kind.
1967
1804
  */
1968
- type FunctionNodeType = 'functionParameter' | 'functionParameters' | 'typeLiteral' | 'indexedAccessType' | 'objectBindingPattern';
1805
+ type FunctionParamKind = FunctionParamNode['kind'];
1969
1806
  /**
1970
1807
  * Definition for the {@link TypeLiteralNode}.
1971
1808
  */
@@ -2097,9 +1934,6 @@ type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
2097
1934
  * ```
2098
1935
  */
2099
1936
  type ParameterNode = BaseNode & {
2100
- /**
2101
- * Node kind.
2102
- */
2103
1937
  kind: 'Parameter';
2104
1938
  /**
2105
1939
  * Parameter name.
@@ -2156,12 +1990,9 @@ declare const createParameter: (input: UserParameterNode) => ParameterNode;
2156
1990
  * ```
2157
1991
  */
2158
1992
  type RequestBodyNode = BaseNode & {
2159
- /**
2160
- * Node kind.
2161
- */
2162
1993
  kind: 'RequestBody';
2163
1994
  /**
2164
- * Human-readable request body description.
1995
+ * Request body description carried over from the spec.
2165
1996
  */
2166
1997
  description?: string;
2167
1998
  /**
@@ -2170,11 +2001,11 @@ type RequestBodyNode = BaseNode & {
2170
2001
  */
2171
2002
  required?: boolean;
2172
2003
  /**
2173
- * All available content type entries for this request body.
2004
+ * Content type entries for this request body.
2174
2005
  *
2175
2006
  * When the adapter `contentType` option is set, this array contains exactly one entry for
2176
2007
  * that content type. Otherwise it contains one entry per content type declared in the spec,
2177
- * so that plugins can generate code for every variant (e.g. separate hooks for
2008
+ * so plugins can generate code for every variant (for example, separate hooks for
2178
2009
  * `application/json` and `multipart/form-data`).
2179
2010
  */
2180
2011
  content?: Array<ContentNode>;
@@ -2189,6 +2020,10 @@ type UserRequestBody = Omit<RequestBodyNode, 'kind' | 'content'> & {
2189
2020
  * Definition for the {@link RequestBodyNode}, normalizing each content entry into a `ContentNode`.
2190
2021
  */
2191
2022
  declare const requestBodyDef: NodeDef<RequestBodyNode, UserRequestBody>;
2023
+ /**
2024
+ * Creates a `RequestBodyNode`, normalizing each content entry into a `ContentNode`.
2025
+ */
2026
+ declare const createRequestBody: (input: UserRequestBody) => RequestBodyNode;
2192
2027
  //#endregion
2193
2028
  //#region src/nodes/http.d.ts
2194
2029
  /**
@@ -2316,7 +2151,7 @@ type OperationNodeBase = BaseNode & {
2316
2151
  */
2317
2152
  deprecated?: boolean;
2318
2153
  /**
2319
- * Parameters that could be used, we have QueryParams, PathParams, HeaderParams and CookieParams
2154
+ * Query, path, header, and cookie parameters for the operation.
2320
2155
  */
2321
2156
  parameters: Array<ParameterNode>;
2322
2157
  /**
@@ -2439,11 +2274,11 @@ type InputMeta = {
2439
2274
  baseURL?: string | null;
2440
2275
  /**
2441
2276
  * Names of schemas that participate in a circular reference chain.
2442
- * Computed once during the adapter pre-scan, use this instead of calling
2443
- * `findCircularSchemas` per generator call.
2277
+ * Computed once during the adapter pre-scan, so a generator never has to
2278
+ * call `findCircularSchemas` itself.
2444
2279
  *
2445
2280
  * Convert to a `Set` once at the start of a generator, not per-schema,
2446
- * to keep lookup O(1) without repeated allocations.
2281
+ * so lookups stay O(1) without repeated allocations.
2447
2282
  *
2448
2283
  * @example Wrap a circular schema in z.lazy()
2449
2284
  * ```ts
@@ -2454,11 +2289,11 @@ type InputMeta = {
2454
2289
  circularNames: ReadonlyArray<string>;
2455
2290
  /**
2456
2291
  * Names of schemas whose type is `enum`.
2457
- * Computed once during the adapter pre-scan, use this instead of filtering
2458
- * schemas per generator call.
2292
+ * Computed once during the adapter pre-scan, so a generator never has to
2293
+ * filter the schema list itself.
2459
2294
  *
2460
2295
  * Convert to a `Set` once at the start of a generator when you need repeated
2461
- * membership checks, rather than calling `.includes()` per schema.
2296
+ * membership checks, so each check stays O(1) instead of an array scan.
2462
2297
  *
2463
2298
  * @example Check if a referenced schema is an enum
2464
2299
  * `const enums = new Set(meta.enumNames)`
@@ -2514,24 +2349,24 @@ type InputNode<Stream extends boolean = false> = BaseNode & {
2514
2349
  */
2515
2350
  declare const inputDef: NodeDef<InputNode<false>, Partial<Omit<InputNode<false>, "kind">>>;
2516
2351
  /**
2517
- * Creates an `InputNode` with stable defaults for `schemas` and `operations`.
2352
+ * Creates an `InputNode`. Pass `stream: true` for the streaming variant whose `schemas` and
2353
+ * `operations` are `AsyncIterable` sources and whose `meta` is optional. Otherwise it builds the
2354
+ * eager variant with array `schemas`/`operations` and the defaulted `meta`.
2518
2355
  *
2519
- * @example
2356
+ * @example Eager
2520
2357
  * ```ts
2521
2358
  * const input = createInput()
2522
2359
  * // { kind: 'Input', schemas: [], operations: [] }
2523
2360
  * ```
2524
- */
2525
- declare function createInput(overrides?: Partial<Omit<InputNode, 'kind'>>): InputNode;
2526
- /**
2527
- * Creates a streaming `InputNode<true>` from pre-built `AsyncIterable` sources.
2528
2361
  *
2529
- * @example
2362
+ * @example Streaming
2530
2363
  * ```ts
2531
- * const node = createStreamInput(schemasIterable, operationsIterable, { title: 'My API' })
2364
+ * const node = createInput({ stream: true, schemas: schemasIterable, operations: operationsIterable, meta: { title: 'My API' } })
2532
2365
  * ```
2533
2366
  */
2534
- declare function createStreamInput(schemas: AsyncIterable<SchemaNode>, operations: AsyncIterable<OperationNode>, meta?: InputMeta): InputNode<true>;
2367
+ declare function createInput<Stream extends boolean = false>(options?: Partial<Omit<InputNode<Stream>, 'kind'>> & {
2368
+ stream?: Stream;
2369
+ }): InputNode<Stream>;
2535
2370
  //#endregion
2536
2371
  //#region src/nodes/output.d.ts
2537
2372
  /**
@@ -2594,892 +2429,5 @@ declare function createOutput(overrides?: Partial<Omit<OutputNode, 'kind'>>): Ou
2594
2429
  */
2595
2430
  type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FunctionParamNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | FunctionNode | ArrowFunctionNode;
2596
2431
  //#endregion
2597
- //#region src/dedupe.d.ts
2598
- /**
2599
- * A canonical destination for a deduplicated shape: the shared schema name and
2600
- * the synthetic `$ref` path that points at it.
2601
- */
2602
- type DedupeCanonical = {
2603
- /**
2604
- * Canonical schema name every duplicate occurrence refers to.
2605
- */
2606
- name: string;
2607
- /**
2608
- * `$ref` path stored on the generated `ref` nodes (for example `#/components/schemas/Status`).
2609
- */
2610
- ref: string;
2611
- };
2612
- /**
2613
- * The result of {@link buildDedupePlan}: a lookup from structural signature to its
2614
- * canonical target, plus the freshly hoisted definitions that must be added to
2615
- * the schema list.
2616
- */
2617
- type DedupePlan = {
2618
- /**
2619
- * Maps a structural signature to the canonical schema that represents it.
2620
- */
2621
- canonicalBySignature: Map<string, DedupeCanonical>;
2622
- /**
2623
- * Maps the name of a top-level schema that duplicates a canonical one to that canonical, so
2624
- * references to the duplicate can be repointed at the first schema with the same content.
2625
- */
2626
- aliasNames: Map<string, DedupeCanonical>;
2627
- /**
2628
- * New top-level schema definitions created for inline shapes that had no existing
2629
- * named component. Nested duplicates inside each definition are already collapsed.
2630
- */
2631
- hoisted: Array<SchemaNode>;
2632
- };
2633
- /**
2634
- * The lookups {@link applyDedupe} needs from a {@link DedupePlan}.
2635
- */
2636
- type DedupeLookups = Pick<DedupePlan, 'canonicalBySignature' | 'aliasNames'>;
2637
- /**
2638
- * Options that inject the naming and candidate policy into {@link buildDedupePlan}.
2639
- * The mechanics (grouping, counting, rewriting) live here. The policy lives in the caller.
2640
- */
2641
- type BuildDedupePlanOptions = {
2642
- /**
2643
- * Returns `true` when a node should be deduplicated. This is the only gate, so it must
2644
- * reject both ineligible kinds (return `false` for anything other than, say, enums and
2645
- * objects) and unsafe shapes (e.g. nodes that reference a circular schema).
2646
- */
2647
- isCandidate: (node: SchemaNode) => boolean;
2648
- /**
2649
- * Produces the canonical name for an inline shape with no existing named component.
2650
- * Return `null` to leave the shape inline (for example when no contextual name exists).
2651
- */
2652
- nameFor: (node: SchemaNode, signature: string) => string | null;
2653
- /**
2654
- * Builds the `$ref` path for a canonical name.
2655
- */
2656
- refFor: (name: string) => string;
2657
- /**
2658
- * Minimum number of occurrences before a shape is deduplicated.
2659
- *
2660
- * @default 2
2661
- */
2662
- minOccurrences?: number;
2663
- };
2664
- /**
2665
- * Rewrites a node, replacing every candidate sub-schema whose signature has a canonical
2666
- * target with a `ref` to that target. Replacing a node with a `ref` prunes its subtree,
2667
- * so nested duplicates inside a replaced shape are not visited again. A `ref` that points
2668
- * at a duplicate top-level schema (see `aliasNames`) is repointed at the first schema with
2669
- * the same content.
2670
- *
2671
- * Pass `skipRootMatch` when rewriting a canonical definition so its own root is not
2672
- * turned into a reference to itself. Nested duplicates are still collapsed.
2673
- *
2674
- * @example
2675
- * ```ts
2676
- * const next = applyDedupe(operationNode, plan)
2677
- * ```
2678
- */
2679
- declare function applyDedupe(node: SchemaNode, plan: DedupeLookups, skipRootMatch?: boolean): SchemaNode;
2680
- declare function applyDedupe(node: OperationNode, plan: DedupeLookups, skipRootMatch?: boolean): OperationNode;
2681
- /**
2682
- * Scans a forest of schema and operation nodes and produces a {@link DedupePlan}.
2683
- *
2684
- * A shape that occurs at least `minOccurrences` times is deduplicated: if any occurrence
2685
- * is a named top-level schema, the first one becomes the canonical (so other top-level
2686
- * duplicates and inline copies turn into references to it). Every other top-level name with
2687
- * the same content is recorded in `aliasNames`, so refs to it can be repointed at the
2688
- * canonical. Otherwise a new definition is hoisted using `nameFor`. The plan is then applied
2689
- * per node with {@link applyDedupe}.
2690
- *
2691
- * @example
2692
- * ```ts
2693
- * const plan = buildDedupePlan([...schemaNodes, ...operationNodes], {
2694
- * isCandidate: (node) => node.type === 'enum' || node.type === 'object',
2695
- * nameFor: (node) => node.name ?? null,
2696
- * refFor: (name) => `#/components/schemas/${name}`,
2697
- * })
2698
- * ```
2699
- */
2700
- declare function buildDedupePlan(roots: ReadonlyArray<Node>, options: BuildDedupePlanOptions): DedupePlan;
2701
- //#endregion
2702
- //#region src/dialect.d.ts
2703
- /**
2704
- * The spec-specific questions a schema parser answers while turning a source document into Kubb
2705
- * AST nodes. The rest of the pipeline is generic JSON Schema, so this is the one seam where
2706
- * OpenAPI, AsyncAPI, and plain JSON Schema differ.
2707
- */
2708
- type SchemaDialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema, TDocument = unknown> = {
2709
- /**
2710
- * Identifies the dialect in logs and diagnostics.
2711
- */
2712
- name: string;
2713
- /**
2714
- * Whether the schema is nullable.
2715
- */
2716
- isNullable: (schema?: TSchema) => boolean;
2717
- /**
2718
- * Whether the value is a `$ref` pointer.
2719
- */
2720
- isReference: (value?: unknown) => value is TRef;
2721
- /**
2722
- * Whether the schema carries a discriminator for polymorphism.
2723
- */
2724
- isDiscriminator: (value?: unknown) => value is TDiscriminated;
2725
- /**
2726
- * Whether the schema is binary data, converted to a `blob` node.
2727
- */
2728
- isBinary: (schema: TSchema) => boolean;
2729
- /**
2730
- * Resolves a local `$ref` against the document, or nullish when it cannot.
2731
- */
2732
- resolveRef: <TResolved>(document: TDocument, ref: string) => TResolved | null | undefined;
2733
- };
2734
- /**
2735
- * Types a {@link SchemaDialect} for an adapter. Adds no runtime behavior and only pins the
2736
- * dialect's type for inference.
2737
- *
2738
- * @example
2739
- * ```ts
2740
- * export const oasDialect = defineSchemaDialect({
2741
- * name: 'oas',
2742
- * isNullable,
2743
- * isReference,
2744
- * isDiscriminator,
2745
- * isBinary: (schema) => schema.type === 'string' && schema.contentMediaType === 'application/octet-stream',
2746
- * resolveRef,
2747
- * })
2748
- * ```
2749
- */
2750
- declare function defineSchemaDialect<TSchema, TRef, TDiscriminated, TDocument>(dialect: SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>): SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>;
2751
- //#endregion
2752
- //#region src/factory.d.ts
2753
- /**
2754
- * Identity-preserving node update: returns `node` unchanged when every field in
2755
- * `changes` already equals (by reference) the current value, otherwise a new node
2756
- * with the changes applied.
2757
- *
2758
- * Mirrors the TypeScript compiler's `factory.updateX` contract, pair it with the
2759
- * structural sharing in {@link transform} so a no-op rewrite doesn't allocate and
2760
- * downstream passes can detect "nothing changed" by identity. Comparison is
2761
- * shallow: a structurally-equal but newly-allocated array/object counts as a change.
2762
- *
2763
- * @example
2764
- * ```ts
2765
- * update(node, { name: node.name }) // -> same `node` reference
2766
- * update(node, { name: 'renamed' }) // -> new node, `name` replaced
2767
- * ```
2768
- */
2769
- declare function update<T extends Node>(node: T, changes: Partial<T>): T;
2770
- /**
2771
- * Input descriptor for {@link createFile}, before `id`, `name`, and `extname` are computed
2772
- * and `imports`/`exports`/`sources` are deduplicated.
2773
- */
2774
- type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind' | 'id' | 'name' | 'extname' | 'imports' | 'exports' | 'sources'> & Pick<Partial<FileNode<TMeta>>, 'imports' | 'exports' | 'sources'>;
2775
- /**
2776
- * Creates a fully resolved `FileNode` from a file input descriptor.
2777
- *
2778
- * Computes:
2779
- * - `id` SHA256 hash of the file path
2780
- * - `name` `baseName` without extension
2781
- * - `extname` extension extracted from `baseName`
2782
- *
2783
- * Deduplicates:
2784
- * - `sources` via `combineSources`
2785
- * - `exports` via `combineExports`
2786
- * - `imports` via `combineImports` (also filters unused imports)
2787
- *
2788
- * @throws {Error} when `baseName` has no extension.
2789
- *
2790
- * @example
2791
- * ```ts
2792
- * const file = createFile({
2793
- * baseName: 'petStore.ts',
2794
- * path: 'src/models/petStore.ts',
2795
- * sources: [createSource({ name: 'Pet', nodes: [createText('export type Pet = { id: number }')] })],
2796
- * imports: [createImport({ name: ['z'], path: 'zod' })],
2797
- * exports: [createExport({ name: ['Pet'], path: './petStore' })],
2798
- * })
2799
- * // file.id = SHA256 hash of 'src/models/petStore.ts'
2800
- * // file.name = 'petStore'
2801
- * // file.extname = '.ts'
2802
- * ```
2803
- */
2804
- declare function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta>;
2805
- //#endregion
2806
- //#region src/printer.d.ts
2807
- /**
2808
- * Runtime context passed as `this` to printer handlers.
2809
- *
2810
- * `this.transform` dispatches to node-level handlers from `nodes`.
2811
- *
2812
- * @example
2813
- * ```ts
2814
- * const context: PrinterHandlerContext<string, {}> = {
2815
- * options: {},
2816
- * transform: () => 'value',
2817
- * }
2818
- * ```
2819
- */
2820
- type PrinterHandlerContext<TOutput, TOptions extends object> = {
2821
- /**
2822
- * Recursively transform a nested `SchemaNode` to `TOutput` using the node-level handlers.
2823
- * Use `this.transform` inside `nodes` handlers and inside the `print` override.
2824
- */
2825
- transform: (node: SchemaNode) => TOutput | null;
2826
- /**
2827
- * Options for this printer instance.
2828
- */
2829
- options: TOptions;
2830
- };
2831
- /**
2832
- * Handler for one schema node type.
2833
- *
2834
- * Use a regular function (not an arrow function) if you need `this`.
2835
- *
2836
- * @example
2837
- * ```ts
2838
- * const handler: PrinterHandler<string, {}, 'string'> = function () {
2839
- * return 'string'
2840
- * }
2841
- * ```
2842
- */
2843
- type PrinterHandler<TOutput, TOptions extends object, T extends SchemaType = SchemaType> = (this: PrinterHandlerContext<TOutput, TOptions>, node: SchemaNodeByType[T]) => TOutput | null;
2844
- /**
2845
- * Partial map of per-node-type handler overrides for a printer.
2846
- *
2847
- * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`).
2848
- * Supply only the handlers you want to replace. The printer's built-in
2849
- * defaults fill in the rest.
2850
- *
2851
- * @example
2852
- * ```ts
2853
- * pluginZod({
2854
- * printer: {
2855
- * nodes: {
2856
- * date(): string {
2857
- * return 'z.string().date()'
2858
- * },
2859
- * } satisfies PrinterPartial<string, PrinterZodOptions>,
2860
- * },
2861
- * })
2862
- * ```
2863
- */
2864
- type PrinterPartial<TOutput, TOptions extends object> = Partial<{ [K in SchemaType]: PrinterHandler<TOutput, TOptions, K> }>;
2865
- /**
2866
- * Generic shape used by `definePrinter`.
2867
- *
2868
- * - `TName` unique string identifier (e.g. `'zod'`, `'ts'`)
2869
- * - `TOptions` options passed to and stored on the printer instance
2870
- * - `TOutput` the type emitted by node handlers
2871
- * - `TPrintOutput` type returned by public `print` (defaults to `TOutput`)
2872
- *
2873
- * @example
2874
- * ```ts
2875
- * type MyPrinter = PrinterFactoryOptions<'my', { strict: boolean }, string>
2876
- * ```
2877
- */
2878
- type PrinterFactoryOptions<TName extends string = string, TOptions extends object = object, TOutput = unknown, TPrintOutput = TOutput> = {
2879
- name: TName;
2880
- options: TOptions;
2881
- output: TOutput;
2882
- printOutput: TPrintOutput;
2883
- };
2884
- /**
2885
- * Printer instance returned by a printer factory.
2886
- *
2887
- * @example
2888
- * ```ts
2889
- * const printer = definePrinter((options: {}) => ({ name: 'x', options, nodes: {} }))({})
2890
- * ```
2891
- */
2892
- type Printer<T extends PrinterFactoryOptions = PrinterFactoryOptions> = {
2893
- /**
2894
- * Unique identifier supplied at creation time.
2895
- */
2896
- name: T['name'];
2897
- /**
2898
- * Options for this printer instance.
2899
- */
2900
- options: T['options'];
2901
- /**
2902
- * Node-level dispatcher, converts a `SchemaNode` directly to `TOutput` using the `nodes` handlers.
2903
- * Always dispatches through the `nodes` map. Never calls the `print` override.
2904
- * Use this when you need the raw output (e.g. `ts.TypeNode`) without declaration wrapping.
2905
- */
2906
- transform: (node: SchemaNode) => T['output'] | null;
2907
- /**
2908
- * Public printer. If the builder provides a root-level `print`, this calls that
2909
- * higher-level function (which may produce full declarations).
2910
- * Otherwise, falls back to the node-level dispatcher.
2911
- */
2912
- print: (node: SchemaNode) => T['printOutput'] | null;
2913
- };
2914
- /**
2915
- * Builder function passed to `definePrinter`.
2916
- *
2917
- * It receives resolved options and returns:
2918
- * - `name`
2919
- * - `options`
2920
- * - `nodes` handlers
2921
- * - optional top-level `print` override
2922
- *
2923
- * @example
2924
- * ```ts
2925
- * const build = (options: {}) => ({ name: 'x' as const, options, nodes: {} })
2926
- * ```
2927
- */
2928
- type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) => {
2929
- name: T['name'];
2930
- /**
2931
- * Options to store on the printer.
2932
- */
2933
- options: T['options'];
2934
- nodes: Partial<{ [K in SchemaType]: PrinterHandler<T['output'], T['options'], K> }>;
2935
- /**
2936
- * Optional root-level print override. When provided, becomes the public `printer.print`.
2937
- * Use `this.transform(node)` inside this function to dispatch to the node-level handlers (`nodes`),
2938
- * not the override itself, so recursion is safe.
2939
- */
2940
- print?: (this: PrinterHandlerContext<T['output'], T['options']>, node: SchemaNode) => T['printOutput'] | null;
2941
- };
2942
- /**
2943
- * Defines a schema printer: a function that takes a `SchemaNode` and emits
2944
- * code in your target language. Each plugin that produces code from schemas
2945
- * (TypeScript types, Zod schemas, Faker factories) ships a printer built
2946
- * with this helper.
2947
- *
2948
- * The builder receives resolved options and returns:
2949
- *
2950
- * - `name` unique identifier for the printer.
2951
- * - `options` stored on the returned printer instance.
2952
- * - `nodes` map of `SchemaType` → handler. Handlers return the rendered
2953
- * output (a string, a TypeScript AST node, ...) for that schema type.
2954
- * - `print` (optional), top-level override exposed as `printer.print`.
2955
- * Use `this.transform(node)` inside it to dispatch to `nodes` recursively.
2956
- *
2957
- * Without a `print` override, `printer.print` falls back to `printer.transform`
2958
- * (the node-level dispatcher).
2959
- *
2960
- * @example Tiny Zod printer
2961
- * ```ts
2962
- * import { definePrinter, type PrinterFactoryOptions } from '@kubb/ast'
2963
- *
2964
- * type PrinterZod = PrinterFactoryOptions<'zod', { strict?: boolean }, string>
2965
- *
2966
- * export const zodPrinter = definePrinter<PrinterZod>((options) => ({
2967
- * name: 'zod',
2968
- * options: { strict: options.strict ?? true },
2969
- * nodes: {
2970
- * string: () => 'z.string()',
2971
- * object(node) {
2972
- * const props = node.properties
2973
- * .map((p) => `${p.name}: ${this.transform(p.schema)}`)
2974
- * .join(', ')
2975
- * return `z.object({ ${props} })`
2976
- * },
2977
- * },
2978
- * }))
2979
- * ```
2980
- */
2981
- declare function definePrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
2982
- /**
2983
- * Generic printer-factory function used by `definePrinter` and `defineFunctionPrinter`.
2984
- **
2985
- * @example
2986
- * ```ts
2987
- * export const defineFunctionPrinter = createPrinterFactory<FunctionNode, FunctionNodeType, FunctionNodeByType>(
2988
- * (node) => kindToHandlerKey[node.kind],
2989
- * )
2990
- * ```
2991
- */
2992
- 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"]) => {
2993
- name: T["name"];
2994
- options: T["options"];
2995
- nodes: Partial<{ [K in TKey]: (this: {
2996
- transform: (node: TNode) => T["output"] | null;
2997
- options: T["options"];
2998
- }, node: TNodeByKey[K]) => T["output"] | null }>;
2999
- print?: (this: {
3000
- transform: (node: TNode) => T["output"] | null;
3001
- options: T["options"];
3002
- }, node: TNode) => T["printOutput"] | null;
3003
- }) => (options?: T["options"]) => {
3004
- name: T["name"];
3005
- options: T["options"];
3006
- transform: (node: TNode) => T["output"] | null;
3007
- print: (node: TNode) => T["printOutput"] | null;
3008
- };
3009
- //#endregion
3010
- //#region src/visitor.d.ts
3011
- /**
3012
- * Ordered mapping of `[NodeType, ParentType]` pairs.
3013
- *
3014
- * `ParentOf` uses this map to find parent types.
3015
- */
3016
- 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]];
3017
- /**
3018
- * Resolves the parent node type for a given AST node type.
3019
- *
3020
- * This is used by visitor context so `ctx.parent` is correctly typed
3021
- * for each callback.
3022
- *
3023
- * @example
3024
- * ```ts
3025
- * type InputParent = ParentOf<InputNode>
3026
- * // undefined
3027
- * ```
3028
- *
3029
- * @example
3030
- * ```ts
3031
- * type PropertyParent = ParentOf<PropertyNode>
3032
- * // SchemaNode
3033
- * ```
3034
- *
3035
- * @example
3036
- * ```ts
3037
- * type SchemaParent = ParentOf<SchemaNode>
3038
- * // InputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode
3039
- * ```
3040
- */
3041
- 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;
3042
- /**
3043
- * Traversal context passed as the second argument to every visitor callback.
3044
- * `parent` is typed from the current node type.
3045
- *
3046
- * @example
3047
- * ```ts
3048
- * const visitor: Visitor = {
3049
- * schema(node, { parent }) {
3050
- * // parent type is narrowed by node kind
3051
- * },
3052
- * }
3053
- * ```
3054
- */
3055
- type VisitorContext<T extends Node = Node> = {
3056
- /**
3057
- * Parent node of the currently visited node.
3058
- * For `InputNode`, this is `undefined`.
3059
- */
3060
- parent?: ParentOf<T>;
3061
- };
3062
- /**
3063
- * Synchronous visitor consumed by `transform`. Each optional callback runs
3064
- * for the matching node type. Return a new node to replace it, or `undefined`
3065
- * to leave it untouched.
3066
- *
3067
- * Plugins typically expose `transformer` so users can supply a `Visitor` that
3068
- * rewrites operation IDs, drops descriptions, or otherwise tweaks the AST
3069
- * before printing.
3070
- *
3071
- * @example Prefix every operationId
3072
- * ```ts
3073
- * const visitor: Visitor = {
3074
- * operation(node) {
3075
- * return { ...node, operationId: `api_${node.operationId}` }
3076
- * },
3077
- * }
3078
- * ```
3079
- *
3080
- * @example Strip schema descriptions
3081
- * ```ts
3082
- * const visitor: Visitor = {
3083
- * schema(node) {
3084
- * return { ...node, description: undefined }
3085
- * },
3086
- * }
3087
- * ```
3088
- */
3089
- type Visitor = {
3090
- input?(node: InputNode, context: VisitorContext<InputNode>): undefined | null | InputNode;
3091
- output?(node: OutputNode, context: VisitorContext<OutputNode>): undefined | null | OutputNode;
3092
- operation?(node: OperationNode, context: VisitorContext<OperationNode>): undefined | null | OperationNode;
3093
- schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): undefined | null | SchemaNode;
3094
- property?(node: PropertyNode, context: VisitorContext<PropertyNode>): undefined | null | PropertyNode;
3095
- parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): undefined | null | ParameterNode;
3096
- response?(node: ResponseNode, context: VisitorContext<ResponseNode>): undefined | null | ResponseNode;
3097
- };
3098
- /**
3099
- * Utility type for values that can be returned directly or asynchronously.
3100
- */
3101
- type MaybePromise<T> = T | Promise<T>;
3102
- /**
3103
- * Async visitor for `walk`. Synchronous `Visitor` objects are compatible.
3104
- *
3105
- * @example
3106
- * ```ts
3107
- * const visitor: AsyncVisitor = {
3108
- * async operation(node) {
3109
- * await Promise.resolve(node.operationId)
3110
- * },
3111
- * }
3112
- * ```
3113
- */
3114
- type AsyncVisitor = {
3115
- input?(node: InputNode, context: VisitorContext<InputNode>): MaybePromise<undefined | null | InputNode>;
3116
- output?(node: OutputNode, context: VisitorContext<OutputNode>): MaybePromise<undefined | null | OutputNode>;
3117
- operation?(node: OperationNode, context: VisitorContext<OperationNode>): MaybePromise<undefined | null | OperationNode>;
3118
- schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): MaybePromise<undefined | null | SchemaNode>;
3119
- property?(node: PropertyNode, context: VisitorContext<PropertyNode>): MaybePromise<undefined | null | PropertyNode>;
3120
- parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): MaybePromise<undefined | null | ParameterNode>;
3121
- response?(node: ResponseNode, context: VisitorContext<ResponseNode>): MaybePromise<undefined | null | ResponseNode>;
3122
- };
3123
- /**
3124
- * Visitor used by `collect`.
3125
- *
3126
- * @example
3127
- * ```ts
3128
- * const visitor: CollectVisitor<string> = {
3129
- * operation(node) {
3130
- * return node.operationId
3131
- * },
3132
- * }
3133
- * ```
3134
- */
3135
- type CollectVisitor<T> = {
3136
- input?(node: InputNode, context: VisitorContext<InputNode>): T | null | undefined;
3137
- output?(node: OutputNode, context: VisitorContext<OutputNode>): T | null | undefined;
3138
- operation?(node: OperationNode, context: VisitorContext<OperationNode>): T | null | undefined;
3139
- schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): T | null | undefined;
3140
- property?(node: PropertyNode, context: VisitorContext<PropertyNode>): T | null | undefined;
3141
- parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): T | null | undefined;
3142
- response?(node: ResponseNode, context: VisitorContext<ResponseNode>): T | null | undefined;
3143
- };
3144
- /**
3145
- * Options for `transform`.
3146
- *
3147
- * @example
3148
- * ```ts
3149
- * const options: TransformOptions = { depth: 'deep', schema: (node) => node }
3150
- * ```
3151
- *
3152
- * @example
3153
- * ```ts
3154
- * // Only transform the current node, not nested children
3155
- * const options: TransformOptions = { depth: 'shallow', schema: (node) => node }
3156
- * ```
3157
- */
3158
- type TransformOptions = Visitor & {
3159
- /**
3160
- * Traversal depth (`'deep'` by default).
3161
- * @default 'deep'
3162
- */
3163
- depth?: VisitorDepth;
3164
- /**
3165
- * Internal parent override used during recursion.
3166
- */
3167
- parent?: Node;
3168
- };
3169
- /**
3170
- * Options for `walk`.
3171
- *
3172
- * @example
3173
- * ```ts
3174
- * const options: WalkOptions = { depth: 'deep', concurrency: 10, root: () => {} }
3175
- * ```
3176
- */
3177
- type WalkOptions = AsyncVisitor & {
3178
- /**
3179
- * Traversal depth (`'deep'` by default).
3180
- * @default 'deep'
3181
- */
3182
- depth?: VisitorDepth;
3183
- /**
3184
- * Maximum number of sibling nodes visited concurrently.
3185
- * @default 30
3186
- */
3187
- concurrency?: number;
3188
- };
3189
- /**
3190
- * Options for `collect`.
3191
- *
3192
- * @example
3193
- * ```ts
3194
- * const options: CollectOptions<string> = { depth: 'shallow', schema: () => undefined }
3195
- * ```
3196
- */
3197
- type CollectOptions<T> = CollectVisitor<T> & {
3198
- /**
3199
- * Traversal depth (`'deep'` by default).
3200
- * @default 'deep'
3201
- */
3202
- depth?: VisitorDepth;
3203
- /**
3204
- * Internal parent override used during recursion.
3205
- */
3206
- parent?: Node;
3207
- };
3208
- /**
3209
- * Async depth-first traversal for side effects. Visitor return values are
3210
- * ignored. Use `transform` when you want to rewrite nodes.
3211
- *
3212
- * Sibling nodes at each depth run concurrently up to `options.concurrency`
3213
- * (defaults to `WALK_CONCURRENCY`). Higher values overlap I/O-bound visitor
3214
- * work. Lower values reduce memory pressure.
3215
- *
3216
- * @example Log every operation
3217
- * ```ts
3218
- * await walk(root, {
3219
- * operation(node) {
3220
- * console.log(node.operationId)
3221
- * },
3222
- * })
3223
- * ```
3224
- *
3225
- * @example Only visit the root node
3226
- * ```ts
3227
- * await walk(root, { depth: 'shallow', input: () => {} })
3228
- * ```
3229
- */
3230
- declare function walk(node: Node, options: WalkOptions): Promise<void>;
3231
- /**
3232
- * Synchronous depth-first transform. Each visitor callback gets a chance to
3233
- * return a replacement node; `undefined` keeps the original.
3234
- *
3235
- * The transform is immutable. The original tree is not mutated. A new tree
3236
- * is returned. Use `depth: 'shallow'` to skip recursion into children.
3237
- *
3238
- * @example Prefix every operationId
3239
- * ```ts
3240
- * const next = transform(root, {
3241
- * operation(node) {
3242
- * return { ...node, operationId: `prefixed_${node.operationId}` }
3243
- * },
3244
- * })
3245
- * ```
3246
- *
3247
- * @example Replace only the root node
3248
- * ```ts
3249
- * const next = transform(root, {
3250
- * depth: 'shallow',
3251
- * input: (node) => ({ ...node, meta: { ...node.meta, title: 'Rewritten' } }),
3252
- * })
3253
- * ```
3254
- */
3255
- declare function transform(node: InputNode, options: TransformOptions): InputNode;
3256
- declare function transform(node: OutputNode, options: TransformOptions): OutputNode;
3257
- declare function transform(node: OperationNode, options: TransformOptions): OperationNode;
3258
- declare function transform(node: SchemaNode, options: TransformOptions): SchemaNode;
3259
- declare function transform(node: PropertyNode, options: TransformOptions): PropertyNode;
3260
- declare function transform(node: ParameterNode, options: TransformOptions): ParameterNode;
3261
- declare function transform(node: ResponseNode, options: TransformOptions): ResponseNode;
3262
- declare function transform(node: Node, options: TransformOptions): Node;
3263
- /**
3264
- * Eager depth-first collection pass. Returns an array of every non-null value
3265
- * the visitor callbacks return.
3266
- *
3267
- * @example Collect every operationId
3268
- * ```ts
3269
- * const ids = collect<string>(root, {
3270
- * operation(node) {
3271
- * return node.operationId
3272
- * },
3273
- * })
3274
- * ```
3275
- */
3276
- declare function collect<T>(node: Node, options: CollectOptions<T>): Array<T>;
3277
- //#endregion
3278
- //#region src/utils/ast.d.ts
3279
- /**
3280
- * Merges a ref node with its resolved schema, giving usage-site fields precedence.
3281
- *
3282
- * Usage-site fields (`description`, `readOnly`, `nullable`, `deprecated`) on the ref node
3283
- * override the same fields in the resolved `node.schema`. Non-ref nodes are returned unchanged.
3284
- *
3285
- * @example
3286
- * ```ts
3287
- * // Ref with description override
3288
- * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })
3289
- * const merged = syncSchemaRef(ref) // merges with resolved Pet schema
3290
- * ```
3291
- */
3292
- declare function syncSchemaRef(node: SchemaNode): SchemaNode;
3293
- /**
3294
- * Type guard that returns `true` when a schema emits as a plain `string` type.
3295
- *
3296
- * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`
3297
- * types, returns `true` only when `representation` is `'string'` rather than `'date'`.
3298
- */
3299
- declare function isStringType(node: SchemaNode): boolean;
3300
- declare function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode>;
3301
- /**
3302
- * Creates a single-property object schema used as a discriminator literal.
3303
- *
3304
- * @example
3305
- * ```ts
3306
- * createDiscriminantNode({ propertyName: 'type', value: 'dog' })
3307
- * // -> { type: 'object', properties: [{ name: 'type', required: true, schema: enum('dog') }] }
3308
- * ```
3309
- */
3310
- declare function createDiscriminantNode({
3311
- propertyName,
3312
- value
3313
- }: {
3314
- propertyName: string;
3315
- value: string;
3316
- }): SchemaNode;
3317
- /**
3318
- * Resolver interface for {@link createOperationParams}.
3319
- *
3320
- * `ResolverTs` from `@kubb/plugin-ts` satisfies this interface and can be passed directly.
3321
- */
3322
- type OperationParamsResolver = {
3323
- /**
3324
- * Resolves the type name for an individual parameter.
3325
- *
3326
- * @example Individual path parameter name
3327
- * `resolver.resolveParamName(node, param) // → 'DeletePetPathPetId'`
3328
- */
3329
- resolveParamName(node: OperationNode, param: ParameterNode): string;
3330
- /**
3331
- * Resolves the request body type name.
3332
- *
3333
- * @example Request body type name
3334
- * `resolver.resolveDataName(node) // → 'CreatePetData'`
3335
- */
3336
- resolveDataName(node: OperationNode): string;
3337
- /**
3338
- * Resolves the grouped path parameters type name.
3339
- * When the return value equals `resolveParamName`, no indexed access is emitted.
3340
- *
3341
- * @example Grouped path params type name
3342
- * `resolver.resolvePathParamsName(node, param) // → 'DeletePetPathParams'`
3343
- */
3344
- resolvePathParamsName(node: OperationNode, param: ParameterNode): string;
3345
- /**
3346
- * Resolves the grouped query parameters type name.
3347
- * When the return value equals `resolveParamName`, an inline struct type is emitted instead.
3348
- *
3349
- * @example Grouped query params type name
3350
- * `resolver.resolveQueryParamsName(node, param) // → 'FindPetsByStatusQueryParams'`
3351
- */
3352
- resolveQueryParamsName(node: OperationNode, param: ParameterNode): string;
3353
- /**
3354
- * Resolves the grouped header parameters type name.
3355
- * When the return value equals `resolveParamName`, an inline struct type is emitted instead.
3356
- *
3357
- * @example Grouped header params type name
3358
- * `resolver.resolveHeaderParamsName(node, param) // → 'DeletePetHeaderParams'`
3359
- */
3360
- resolveHeaderParamsName(node: OperationNode, param: ParameterNode): string;
3361
- };
3362
- /**
3363
- * Options for {@link createOperationParams}.
3364
- */
3365
- type CreateOperationParamsOptions = {
3366
- /**
3367
- * How all operation parameters are grouped in the function signature.
3368
- * - `'object'` wraps all params into a single destructured object `{ petId, data, params }`
3369
- * - `'inline'` emits each param category as a separate top-level parameter
3370
- */
3371
- paramsType: 'object' | 'inline';
3372
- /**
3373
- * How path parameters are emitted when `paramsType` is `'inline'`.
3374
- * - `'object'` groups them as `{ petId, storeId }: PathParams`
3375
- * - `'inline'` spreads them as individual parameters `petId: string, storeId: string`
3376
- * - `'inlineSpread'` emits a single rest parameter `...pathParams: PathParams`
3377
- */
3378
- pathParamsType: 'object' | 'inline' | 'inlineSpread';
3379
- /**
3380
- * Converts parameter names to camelCase before output.
3381
- */
3382
- paramsCasing?: 'camelcase';
3383
- /**
3384
- * Resolver for parameter and request body type names.
3385
- * Pass `ResolverTs` from `@kubb/plugin-ts` directly.
3386
- * When omitted, falls back to the schema primitive or `'unknown'`.
3387
- */
3388
- resolver?: OperationParamsResolver;
3389
- /**
3390
- * Default value for the path parameters binding when `pathParamsType` is `'object'`.
3391
- * Falls back to `'{}'` when all path params are optional.
3392
- */
3393
- pathParamsDefault?: string;
3394
- /**
3395
- * Extra parameters appended after the standard operation parameters.
3396
- *
3397
- * @example Plugin-specific trailing parameter
3398
- * ```ts
3399
- * extraParams: [createFunctionParameter({ name: 'options', type: 'Partial<RequestOptions>', default: '{}' })]
3400
- * ```
3401
- */
3402
- extraParams?: Array<FunctionParameterNode>;
3403
- /**
3404
- * Override the default parameter names used for body, query, header, and rest-path groups.
3405
- *
3406
- * Useful when targeting languages or frameworks with different naming conventions.
3407
- *
3408
- * @default { data: 'data', params: 'params', headers: 'headers', path: 'pathParams' }
3409
- */
3410
- paramNames?: {
3411
- /**
3412
- * Name for the request body parameter.
3413
- * @default 'data'
3414
- */
3415
- data?: string;
3416
- /**
3417
- * Name for the query parameters group parameter.
3418
- * @default 'params'
3419
- */
3420
- params?: string;
3421
- /**
3422
- * Name for the header parameters group parameter.
3423
- * @default 'headers'
3424
- */
3425
- headers?: string;
3426
- /**
3427
- * Name for the rest path-parameters parameter when `pathParamsType` is `'inlineSpread'`.
3428
- * @default 'pathParams'
3429
- */
3430
- path?: string;
3431
- };
3432
- /**
3433
- * Applies a uniform transformation to every resolved type name before it is used
3434
- * in a parameter node. Use this for framework-level type wrappers.
3435
- *
3436
- * @example Vue Query, wrap every parameter type with `MaybeRefOrGetter`
3437
- * `typeWrapper: (t) => \`MaybeRefOrGetter<${t}>\``
3438
- */
3439
- typeWrapper?: (type: string) => string;
3440
- };
3441
- /**
3442
- * Converts an `OperationNode` into function parameters for code generation.
3443
- *
3444
- * Centralizes parameter grouping logic for all plugins. `paramsType` chooses between one
3445
- * destructured object parameter (`object`) and separate top-level parameters (`inline`), while
3446
- * `pathParamsType` controls how path params render in inline mode. Provide a `resolver` for type
3447
- * name resolution and `extraParams` for plugin-specific trailing parameters such as an `options` object.
3448
- */
3449
- declare function createOperationParams(node: OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode;
3450
- /**
3451
- * Extracts all string content from a `CodeNode` tree recursively.
3452
- *
3453
- * Collects text node values, identifier references in string fields (`params`, `generics`, `returnType`, `type`),
3454
- * and nested node content. Used internally to build the full source string for import filtering.
3455
- */
3456
- declare function extractStringsFromNodes(nodes: Array<CodeNode> | undefined): string;
3457
- declare function collectUsedSchemaNames(operations: ReadonlyArray<OperationNode>, schemas: ReadonlyArray<SchemaNode>): Set<string>;
3458
- /**
3459
- * Identifies all schemas that participate in circular dependency chains, including direct self-loops.
3460
- *
3461
- * Returns a Set of schema names with circular dependencies. Use this to wrap recursive schema positions
3462
- * in deferred constructs (lazy getter, `z.lazy(() => …)`) to prevent infinite recursion when generated code runs.
3463
- * Refs are followed by name only, keeping the algorithm linear in the schema graph size.
3464
- *
3465
- * @note Call this once on the full schema graph, then use `containsCircularRef()` to check individual schemas.
3466
- */
3467
- declare function findCircularSchemas(schemas: ReadonlyArray<SchemaNode>): Set<string>;
3468
- /**
3469
- * Type guard returning `true` when a schema or anything nested within it contains a ref to a circular schema.
3470
- *
3471
- * Use `excludeName` to ignore refs to specific schemas (useful when self-references are handled separately).
3472
- * Commonly used with `findCircularSchemas()` to detect where lazy wrappers are needed in code generation.
3473
- *
3474
- * @note Returns `true` for the first matching circular ref found. Use for fast dependency checks.
3475
- */
3476
- declare function containsCircularRef(node: SchemaNode | undefined, {
3477
- circularSchemas,
3478
- excludeName
3479
- }: {
3480
- circularSchemas: ReadonlySet<string>;
3481
- excludeName?: string;
3482
- }): boolean;
3483
- //#endregion
3484
- export { createParameter as $, InferSchemaNode as $t, applyDedupe as A, contentDef as At, inputDef as B, ScalarSchemaType as Bt, createFile as C, DistributiveOmit as Cn, createExport as Ct, DedupeCanonical as D, NodeKind as Dn, fileDef as Dt, defineSchemaDialect as E, syncOptionality as En, exportDef as Et, outputDef as F, IntersectionSchemaNode as Ft, operationDef as G, TimeSchemaNode as Gt, HttpOperationNode as H, SchemaNodeByType as Ht, InputMeta as I, NumberSchemaNode as It, responseDef as J, createSchema as Jt, ResponseNode as K, UnionSchemaNode as Kt, InputNode as L, ObjectSchemaNode as Lt, Node as M, DateSchemaNode as Mt, OutputNode as N, DatetimeSchemaNode as Nt, DedupeLookups as O, httpMethods as On, importDef as Ot, createOutput as P, EnumSchemaNode as Pt, ParameterNode as Q, propertyDef as Qt, createInput as R, PrimitiveSchemaType as Rt, UserFileNode as S, typeDef as Sn, SourceNode as St, SchemaDialect as T, defineNode as Tn, createSource as Tt, OperationNode as U, SchemaType as Ut, HttpMethod as V, SchemaNode as Vt, createOperation as W, StringSchemaNode as Wt, requestBodyDef as X, PropertyNode as Xt, StatusCode as Y, schemaDef as Yt, ParameterLocation as Z, createProperty as Zt, Printer as _, createText as _n, objectBindingPatternDef as _t, createDiscriminantNode as a, JSDocNode as an, IndexedAccessTypeNode as at, createPrinterFactory as b, jsxDef as bn, FileNode as bt, findCircularSchemas as c, TypeNode as cn, TypeLiteralNode as ct, ParentOf as d, constDef as dn, createIndexedAccessType as dt, ParserOptions as en, parameterDef as et, Visitor as f, createArrowFunction as fn, createObjectBindingPattern as ft, walk as g, createJsx as gn, indexedAccessTypeDef as gt, transform as h, createFunction as hn, functionParametersDef as ht, containsCircularRef as i, FunctionNode as in, FunctionParametersNode as it, buildDedupePlan as j, ArraySchemaNode as jt, DedupePlan as k, schemaTypes as kn, sourceDef as kt, isStringType as l, arrowFunctionDef as ln, createFunctionParameter as lt, collect as m, createConst as mn, functionParameterDef as mt, caseParams as n, CodeNode as nn, FunctionParamNode as nt, createOperationParams as o, JsxNode as on, ObjectBindingPatternNode as ot, VisitorContext as p, createBreak as pn, createTypeLiteral as pt, createResponse as q, UrlSchemaNode as qt, collectUsedSchemaNames as r, ConstNode as rn, FunctionParameterNode as rt, extractStringsFromNodes as s, TextNode as sn, TypeExpression as st, OperationParamsResolver as t, ArrowFunctionNode as tn, FunctionNodeType as tt, syncSchemaRef as u, breakDef as un, createFunctionParameters as ut, PrinterFactoryOptions as v, createType as vn, typeLiteralDef as vt, update as w, NodeDef as wn, createImport as wt, definePrinter as x, textDef as xn, ImportNode as xt, PrinterPartial as y, functionDef as yn, ExportNode as yt, createStreamInput as z, RefSchemaNode as zt };
3485
- //# sourceMappingURL=types-C5aVnRE1.d.ts.map
2432
+ export { fileDef as $, textDef as $t, FunctionParametersNode as A, InferSchemaNode as At, functionParameterDef as B, TypeNode as Bt, ParameterLocation as C, UrlSchemaNode as Ct, FunctionParamKind as D, UserPropertyNode as Dt, parameterDef as E, PropertyNode as Et, createFunctionParameter as F, ConstNode as Ft, ExportNode as G, createBreak as Gt, indexedAccessTypeDef as H, breakDef as Ht, createFunctionParameters as I, FunctionNode as It, SourceNode as J, createJsx as Jt, FileNode as K, createConst as Kt, createIndexedAccessType as L, JSDocNode as Lt, ObjectBindingPatternNode as M, ArrowFunctionNode as Mt, TypeExpression as N, BreakNode as Nt, FunctionParamNode as O, createProperty as Ot, TypeLiteralNode as P, CodeNode as Pt, exportDef as Q, jsxDef as Qt, createObjectBindingPattern as R, JsxNode as Rt, requestBodyDef as S, UnionSchemaNode as St, createParameter as T, schemaDef as Tt, objectBindingPatternDef as U, constDef as Ut, functionParametersDef as V, arrowFunctionDef as Vt, typeLiteralDef as W, createArrowFunction as Wt, createImport as X, createType as Xt, createExport as Y, createText as Yt, createSource as Z, functionDef as Zt, responseDef as _, SchemaNode as _t, InputMeta as a, BaseNode as an, createContent as at, UserRequestBody as b, StringSchemaNode as bt, inputDef as c, DatetimeSchemaNode as ct, HttpOperationNode as d, NumberSchemaNode as dt, typeDef as en, importDef as et, OperationNode as f, ObjectSchemaNode as ft, createResponse as g, ScalarSchemaType as gt, ResponseNode as h, ScalarSchemaNode as ht, outputDef as i, syncOptionality as in, contentDef as it, IndexedAccessTypeNode as j, ParserOptions as jt, FunctionParameterNode as k, propertyDef as kt, GenericOperationNode as l, EnumSchemaNode as lt, operationDef as m, RefSchemaNode as mt, OutputNode as n, NodeDef as nn, ContentNode as nt, InputNode as o, NodeKind as on, ArraySchemaNode as ot, createOperation as p, PrimitiveSchemaType as pt, ImportNode as q, createFunction as qt, createOutput as r, defineNode as rn, UserContent as rt, createInput as s, DateSchemaNode as st, Node as t, DistributiveOmit as tn, sourceDef as tt, HttpMethod as u, IntersectionSchemaNode as ut, StatusCode as v, SchemaNodeByType as vt, ParameterNode as w, createSchema as wt, createRequestBody as x, TimeSchemaNode as xt, RequestBodyNode as y, SchemaType as yt, createTypeLiteral as z, TextNode as zt };
2433
+ //# sourceMappingURL=index-BzjwdK2M.d.ts.map