@kubb/ast 5.0.0-beta.36 → 5.0.0-beta.38

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.
@@ -4,8 +4,8 @@ import { t as __name } from "./chunk-C0LytTxp.js";
4
4
  /**
5
5
  * Traversal depth for AST visitor utilities.
6
6
  *
7
- * - `'shallow'` visits only the immediate node, skipping children.
8
- * - `'deep'` recursively visits all descendant nodes.
7
+ * - `'shallow'` visits only the immediate node, skipping children.
8
+ * - `'deep'` recursively visits all descendant nodes.
9
9
  */
10
10
  type VisitorDepth = 'shallow' | 'deep';
11
11
  /**
@@ -412,7 +412,7 @@ type TextNode = BaseNode & {
412
412
  * AST node representing a line break in the source output.
413
413
  *
414
414
  * Corresponds to `<br/>` in JSX components. When printed, produces an empty
415
- * string that joined with `\n` by `printNodes` creates a blank line
415
+ * string that, joined with `\n` by `printNodes` creates a blank line
416
416
  * between surrounding code nodes.
417
417
  *
418
418
  * @example
@@ -644,7 +644,7 @@ type ObjectSchemaNode = SchemaNodeBase & {
644
644
  */
645
645
  type: 'object';
646
646
  /**
647
- * Primitive type always `'object'` for object schemas.
647
+ * Primitive type, always `'object'` for object schemas.
648
648
  */
649
649
  primitive: 'object';
650
650
  /**
@@ -840,13 +840,10 @@ type RefSchemaNode = SchemaNodeBase & {
840
840
  */
841
841
  pattern?: string;
842
842
  /**
843
- * The fully-parsed schema that this ref resolves to.
844
- * Populated during OAS parsing when the referenced definition can be resolved.
845
- * `null` when the ref cannot be resolved or is part of a circular chain.
846
- * `undefined` when resolution has not been attempted.
847
- *
848
- * Useful for inspecting the referenced schema's structure (e.g. `primitive`, `properties`)
849
- * without following the reference manually.
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.
850
847
  */
851
848
  schema?: SchemaNode | null;
852
849
  };
@@ -1361,9 +1358,9 @@ type FileNode<TMeta extends object = object> = BaseNode & {
1361
1358
  * AST node representing a language-agnostic type expression used as a function parameter
1362
1359
  * type annotation. Each language printer renders the variant into its own syntax.
1363
1360
  *
1364
- * - `struct` an inline anonymous type grouping named fields.
1361
+ * - `struct` an inline anonymous type grouping named fields.
1365
1362
  * TypeScript renders as `{ petId: string; name?: string }`.
1366
- * - `member` a single named field accessed from a named group type.
1363
+ * - `member` a single named field accessed from a named group type.
1367
1364
  * TypeScript renders as `PathParams['petId']`.
1368
1365
  *
1369
1366
  * @example Reference variant
@@ -1391,7 +1388,7 @@ type ParamsTypeNode = BaseNode & {
1391
1388
  kind: 'ParamsType';
1392
1389
  } & ({
1393
1390
  /**
1394
- * Reference variant a plain type name or identifier.
1391
+ * Reference variant, a plain type name or identifier.
1395
1392
  * TypeScript renders as-is, e.g. `string`, `QueryParams`, `Partial<Config>`.
1396
1393
  */
1397
1394
  variant: 'reference';
@@ -1401,7 +1398,7 @@ type ParamsTypeNode = BaseNode & {
1401
1398
  name: string;
1402
1399
  } | {
1403
1400
  /**
1404
- * Struct variant an inline anonymous type grouping named fields.
1401
+ * Struct variant, an inline anonymous type grouping named fields.
1405
1402
  * TypeScript renders as `{ key: Type; other?: OtherType }`.
1406
1403
  */
1407
1404
  variant: 'struct';
@@ -1415,7 +1412,7 @@ type ParamsTypeNode = BaseNode & {
1415
1412
  }>;
1416
1413
  } | {
1417
1414
  /**
1418
- * Member variant a single named field accessed from a group type.
1415
+ * Member variant, a single named field accessed from a group type.
1419
1416
  * TypeScript renders as `Base['key']`.
1420
1417
  */
1421
1418
  variant: 'member';
@@ -1475,7 +1472,7 @@ type FunctionParameterNode = BaseNode & {
1475
1472
  rest?: boolean;
1476
1473
  }
1477
1474
  /**
1478
- * Optional parameter rendered with `?` and may be omitted by the caller.
1475
+ * Optional parameter, rendered with `?` and may be omitted by the caller.
1479
1476
  * Cannot be combined with `default` because a defaulted parameter is already optional.
1480
1477
  */
1481
1478
  & ({
@@ -1552,10 +1549,10 @@ type ParameterGroupNode = BaseNode & {
1552
1549
  * Nodes are plain immutable data.
1553
1550
  *
1554
1551
  * Renders differently depending on the output mode:
1555
- * - `declaration` → `(id: string, config: Config = {})` function declaration parameters
1556
- * - `call` → `(id, { method, url })` function call arguments
1557
- * - `keys` → `{ id, config }` key names only (for destructuring)
1558
- * - `values` → `{ id: id, config: config }` key → value pairs
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
1559
1556
  */
1560
1557
  type FunctionParametersNode = BaseNode & {
1561
1558
  /**
@@ -1572,7 +1569,7 @@ type FunctionParametersNode = BaseNode & {
1572
1569
  */
1573
1570
  type FunctionParamNode = FunctionParameterNode | ParameterGroupNode | FunctionParametersNode | ParamsTypeNode;
1574
1571
  /**
1575
- * Handler map keys one per `FunctionParamNode` kind.
1572
+ * Handler map keys, one per `FunctionParamNode` kind.
1576
1573
  */
1577
1574
  type FunctionNodeType = 'functionParameter' | 'parameterGroup' | 'functionParameters' | 'paramsType';
1578
1575
  //#endregion
@@ -1858,7 +1855,7 @@ type OutputNode = BaseNode & {
1858
1855
  /**
1859
1856
  * Metadata for an API document, populated by the adapter and available to every generator.
1860
1857
  *
1861
- * All fields are plain JSON-serializable values no `Set`, no `Map`, no class instances.
1858
+ * All fields are plain JSON-serializable values, no `Set`, no `Map`, no class instances.
1862
1859
  * Computed fields (`circularNames`, `enumNames`) are pre-calculated once during the adapter
1863
1860
  * pre-scan so generators never need to iterate the full schema list themselves.
1864
1861
  *
@@ -1886,7 +1883,7 @@ type InputMeta = {
1886
1883
  baseURL?: string | null;
1887
1884
  /**
1888
1885
  * Names of schemas that participate in a circular reference chain.
1889
- * Computed once during the adapter pre-scan use this instead of calling
1886
+ * Computed once during the adapter pre-scan, use this instead of calling
1890
1887
  * `findCircularSchemas` per generator call.
1891
1888
  *
1892
1889
  * Convert to a `Set` once at the start of a generator, not per-schema,
@@ -1901,7 +1898,7 @@ type InputMeta = {
1901
1898
  circularNames: ReadonlyArray<string>;
1902
1899
  /**
1903
1900
  * Names of schemas whose type is `enum`.
1904
- * Computed once during the adapter pre-scan use this instead of filtering
1901
+ * Computed once during the adapter pre-scan, use this instead of filtering
1905
1902
  * schemas per generator call.
1906
1903
  *
1907
1904
  * Convert to a `Set` once at the start of a generator when you need repeated
@@ -1947,14 +1944,14 @@ type InputNode = BaseNode & {
1947
1944
  /**
1948
1945
  * Streaming variant of `InputNode` for memory-efficient processing of large API specs.
1949
1946
  *
1950
- * `schemas` and `operations` are `AsyncIterable` rather than arrays each `for await`
1947
+ * `schemas` and `operations` are `AsyncIterable` rather than arrays, each `for await`
1951
1948
  * loop creates a fresh parse pass from the cached in-memory document, so multiple
1952
1949
  * consumers (plugins) can iterate independently without keeping all nodes in memory.
1953
1950
  *
1954
1951
  * @example
1955
1952
  * ```ts
1956
1953
  * for await (const schema of inputStreamNode.schemas) {
1957
- * // only this one SchemaNode is live here; previous ones are GC-eligible
1954
+ * // only this one SchemaNode is live here. Previous ones are GC-eligible
1958
1955
  * }
1959
1956
  * ```
1960
1957
  */
@@ -2031,7 +2028,7 @@ type DedupePlan = {
2031
2028
  };
2032
2029
  /**
2033
2030
  * Options that inject the naming and candidate policy into {@link buildDedupePlan}.
2034
- * The mechanics (grouping, counting, rewriting) live here; the policy lives in the caller.
2031
+ * The mechanics (grouping, counting, rewriting) live here. The policy lives in the caller.
2035
2032
  */
2036
2033
  type BuildDedupePlanOptions = {
2037
2034
  /**
@@ -2062,7 +2059,7 @@ type BuildDedupePlanOptions = {
2062
2059
  * so nested duplicates inside a replaced shape are not visited again.
2063
2060
  *
2064
2061
  * Pass `skipRootMatch` when rewriting a canonical definition so its own root is not
2065
- * turned into a reference to itself; nested duplicates are still collapsed.
2062
+ * turned into a reference to itself. Nested duplicates are still collapsed.
2066
2063
  *
2067
2064
  * @example
2068
2065
  * ```ts
@@ -2076,7 +2073,7 @@ declare function applyDedupe(node: OperationNode, canonicalBySignature: Readonly
2076
2073
  *
2077
2074
  * A shape that occurs at least `minOccurrences` times is deduplicated: if any occurrence
2078
2075
  * is a named top-level schema, that name becomes the canonical (so other top-level duplicates
2079
- * and inline copies turn into references to it); otherwise a new definition is hoisted using
2076
+ * and inline copies turn into references to it). Otherwise a new definition is hoisted using
2080
2077
  * `nameFor`. The plan is then applied per node with {@link applyDedupe}.
2081
2078
  *
2082
2079
  * @example
@@ -2092,26 +2089,20 @@ declare function buildDedupePlan(roots: ReadonlyArray<Node>, options: BuildDedup
2092
2089
  //#endregion
2093
2090
  //#region src/dialect.d.ts
2094
2091
  /**
2095
- * The spec-specific decisions a schema parser makes while converting a source
2096
- * document's schemas into Kubb AST nodes.
2097
- *
2098
- * Everything else in an adapter's schema pipeline is generic JSON Schema shared
2099
- * across specs; the dialect is the one seam where a spec differs the
2100
- * "dialect layer" analogue of a database driver targeting Postgres vs MySQL.
2101
- * Pair it with {@link dispatch}: the rule table decides *which* converter runs,
2102
- * the dialect answers the spec-specific questions inside them.
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.
2103
2097
  *
2104
- * The guard methods (`isReference`, `isDiscriminator`) are type predicates so
2105
- * converters narrow the schema after a check; the type parameters carry those
2106
- * narrowed types through.
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.
2107
2100
  *
2108
- * Scope: this is the seam for the **JSON Schema family** OpenAPI, AsyncAPI, and
2109
- * plain JSON Schema all share `$ref`, `allOf`/`oneOf`, `enum`, and `format`, and
2110
- * differ only in these few decisions. A spec built on a different type system
2111
- * (e.g. GraphQL, with non-null wrappers, interfaces, and named-type references
2112
- * instead of `$ref`) does not implement a `SchemaDialect`; it reuses the universal
2113
- * layer directly — the `Adapter` port, the AST factories, and {@link dispatch}
2114
- * with its own rule table — to emit the same nodes.
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.
2115
2106
  *
2116
2107
  * @typeParam TSchema - The adapter's schema object type (e.g. an OpenAPI `SchemaObject`).
2117
2108
  * @typeParam TRef - The narrowed `$ref` pointer type `isReference` proves.
@@ -2128,7 +2119,7 @@ type SchemaDialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema,
2128
2119
  };
2129
2120
  /**
2130
2121
  * Identity helper that types a {@link SchemaDialect} for an adapter. Like
2131
- * `defineParser`, it adds no runtime behavior it pins the dialect's type for
2122
+ * `defineParser`, it adds no runtime behavior, it pins the dialect's type for
2132
2123
  * inference and gives adapter authors a discoverable anchor.
2133
2124
  *
2134
2125
  * @example
@@ -2161,7 +2152,7 @@ type DispatchRule<TContext, TNode> = {
2161
2152
  * Produces a node for the context, or `null` to fall through to the next rule.
2162
2153
  *
2163
2154
  * Returning `null` lets a broad `match` defer: e.g. "has a `format`" matches many schemas,
2164
- * but only some formats are convertible the rest fall through to plain `type` handling.
2155
+ * but only some formats are convertible, the rest fall through to plain `type` handling.
2165
2156
  */
2166
2157
  convert: (context: TContext) => TNode | null;
2167
2158
  };
@@ -2175,7 +2166,7 @@ type DispatchRule<TContext, TNode> = {
2175
2166
  *
2176
2167
  * An adapter derives a context from a source spec node, then declares an ordered table of
2177
2168
  * rules mapping spec shapes onto Kubb AST nodes. To add support for a new spec, write a new
2178
- * context type and a new rules table the traversal here is reused unchanged.
2169
+ * context type and a new rules table, the traversal here is reused unchanged.
2179
2170
  *
2180
2171
  * Order is significant: earlier rules win, so list higher-precedence or more specific shapes
2181
2172
  * first (e.g. composition keywords before plain `type`). A rule whose `match` returns `true`
@@ -2205,7 +2196,7 @@ type ParserOptions = {
2205
2196
  dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
2206
2197
  /**
2207
2198
  * How `type: 'integer'` (and `format: 'int64'`) maps to TypeScript.
2208
- * - `'number'` fits most JSON APIs; loses precision above `Number.MAX_SAFE_INTEGER`.
2199
+ * - `'number'` fits most JSON APIs. Loses precision above `Number.MAX_SAFE_INTEGER`.
2209
2200
  * - `'bigint'` is exact for 64-bit IDs, but does not round-trip through JSON.
2210
2201
  *
2211
2202
  * @default 'number'
@@ -2365,7 +2356,7 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K>
2365
2356
  * `changes` already equals (by reference) the current value, otherwise a new node
2366
2357
  * with the changes applied.
2367
2358
  *
2368
- * Mirrors the TypeScript compiler's `factory.updateX` contract pair it with the
2359
+ * Mirrors the TypeScript compiler's `factory.updateX` contract, pair it with the
2369
2360
  * structural sharing in {@link transform} so a no-op rewrite doesn't allocate and
2370
2361
  * downstream passes can detect "nothing changed" by identity. Comparison is
2371
2362
  * shallow: a structurally-equal but newly-allocated array/object counts as a change.
@@ -2596,7 +2587,7 @@ declare function createResponse(props: Pick<ResponseNode, 'statusCode'> & Partia
2596
2587
  * // → params?: QueryParams
2597
2588
  * ```
2598
2589
  *
2599
- * @example Param with default (implicitly optional; cannot combine with `optional: true`)
2590
+ * @example Param with default (implicitly optional. Cannot combine with `optional: true`)
2600
2591
  * ```ts
2601
2592
  * createFunctionParameter({ name: 'config', type: createParamsType({ variant: 'reference', name: 'RequestConfig' }), default: '{}' })
2602
2593
  * // → config: RequestConfig = {}
@@ -2666,7 +2657,7 @@ declare function createParamsType(props: {
2666
2657
  * // call → { id, name }
2667
2658
  * ```
2668
2659
  *
2669
- * @example Inline (spread) children emitted as individual top-level parameters
2660
+ * @example Inline (spread), children emitted as individual top-level parameters
2670
2661
  * ```ts
2671
2662
  * createParameterGroup({
2672
2663
  * properties: [createFunctionParameter({ name: 'petId', type: createParamsType({ variant: 'reference', name: 'string' }), optional: false })],
@@ -2743,9 +2734,9 @@ type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind'
2743
2734
  * Creates a fully resolved `FileNode` from a file input descriptor.
2744
2735
  *
2745
2736
  * Computes:
2746
- * - `id` SHA256 hash of the file path
2747
- * - `name` `baseName` without extension
2748
- * - `extname` extension extracted from `baseName`
2737
+ * - `id` SHA256 hash of the file path
2738
+ * - `name` `baseName` without extension
2739
+ * - `extname` extension extracted from `baseName`
2749
2740
  *
2750
2741
  * Deduplicates:
2751
2742
  * - `sources` via `combineSources`
@@ -2965,7 +2956,7 @@ type PrinterHandler<TOutput, TOptions extends object, T extends SchemaType = Sch
2965
2956
  * Partial map of per-node-type handler overrides for a printer.
2966
2957
  *
2967
2958
  * Each key is a `SchemaType` string (e.g. `'date'`, `'string'`).
2968
- * Supply only the handlers you want to replace; the printer's built-in
2959
+ * Supply only the handlers you want to replace. The printer's built-in
2969
2960
  * defaults fill in the rest.
2970
2961
  *
2971
2962
  * @example
@@ -2985,10 +2976,10 @@ type PrinterPartial<TOutput, TOptions extends object> = Partial<{ [K in SchemaTy
2985
2976
  /**
2986
2977
  * Generic shape used by `definePrinter`.
2987
2978
  *
2988
- * - `TName` unique string identifier (e.g. `'zod'`, `'ts'`)
2989
- * - `TOptions` options passed to and stored on the printer instance
2990
- * - `TOutput` the type emitted by node handlers
2991
- * - `TPrintOutput` type returned by public `print` (defaults to `TOutput`)
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`)
2992
2983
  *
2993
2984
  * @example
2994
2985
  * ```ts
@@ -3019,8 +3010,8 @@ type Printer<T extends PrinterFactoryOptions = PrinterFactoryOptions> = {
3019
3010
  */
3020
3011
  options: T['options'];
3021
3012
  /**
3022
- * Node-level dispatcher converts a `SchemaNode` directly to `TOutput` using the `nodes` handlers.
3023
- * Always dispatches through the `nodes` map; never calls the `print` override.
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.
3024
3015
  * Use this when you need the raw output (e.g. `ts.TypeNode`) without declaration wrapping.
3025
3016
  */
3026
3017
  transform: (node: SchemaNode) => T['output'] | null;
@@ -3055,7 +3046,7 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
3055
3046
  /**
3056
3047
  * Optional root-level print override. When provided, becomes the public `printer.print`.
3057
3048
  * Use `this.transform(node)` inside this function to dispatch to the node-level handlers (`nodes`),
3058
- * not the override itself so recursion is safe.
3049
+ * not the override itself, so recursion is safe.
3059
3050
  */
3060
3051
  print?: (this: PrinterHandlerContext<T['output'], T['options']>, node: SchemaNode) => T['printOutput'] | null;
3061
3052
  };
@@ -3067,11 +3058,11 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
3067
3058
  *
3068
3059
  * The builder receives resolved options and returns:
3069
3060
  *
3070
- * - `name` unique identifier for the printer.
3071
- * - `options` stored on the returned printer instance.
3072
- * - `nodes` map of `SchemaType` → handler. Handlers return the rendered
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
3073
3064
  * output (a string, a TypeScript AST node, ...) for that schema type.
3074
- * - `print` (optional) top-level override exposed as `printer.print`.
3065
+ * - `print` (optional), top-level override exposed as `printer.print`.
3075
3066
  * Use `this.transform(node)` inside it to dispatch to `nodes` recursively.
3076
3067
  *
3077
3068
  * Without a `print` override, `printer.print` falls back to `printer.transform`
@@ -3331,7 +3322,7 @@ type CollectOptions<T> = CollectVisitor<T> & {
3331
3322
  *
3332
3323
  * Sibling nodes at each depth run concurrently up to `options.concurrency`
3333
3324
  * (defaults to `WALK_CONCURRENCY`). Higher values overlap I/O-bound visitor
3334
- * work; lower values reduce memory pressure.
3325
+ * work. Lower values reduce memory pressure.
3335
3326
  *
3336
3327
  * @example Log every operation
3337
3328
  * ```ts
@@ -3352,7 +3343,7 @@ declare function walk(node: Node, options: WalkOptions): Promise<void>;
3352
3343
  * Synchronous depth-first transform. Each visitor callback gets a chance to
3353
3344
  * return a replacement node; `undefined` keeps the original.
3354
3345
  *
3355
- * The transform is immutable. The original tree is not mutated; a new tree
3346
+ * The transform is immutable. The original tree is not mutated. A new tree
3356
3347
  * is returned. Use `depth: 'shallow'` to skip recursion into children.
3357
3348
  *
3358
3349
  * @example Prefix every operationId
@@ -3553,7 +3544,7 @@ type CreateOperationParamsOptions = {
3553
3544
  * Applies a uniform transformation to every resolved type name before it is used
3554
3545
  * in a parameter node. Use this for framework-level type wrappers.
3555
3546
  *
3556
- * @example Vue Query wrap every parameter type with `MaybeRefOrGetter`
3547
+ * @example Vue Query, wrap every parameter type with `MaybeRefOrGetter`
3557
3548
  * `typeWrapper: (t) => \`MaybeRefOrGetter<${t}>\``
3558
3549
  */
3559
3550
  typeWrapper?: (type: string) => string;
@@ -3591,7 +3582,7 @@ declare function findCircularSchemas(schemas: ReadonlyArray<SchemaNode>): Set<st
3591
3582
  * Use `excludeName` to ignore refs to specific schemas (useful when self-references are handled separately).
3592
3583
  * Commonly used with `findCircularSchemas()` to detect where lazy wrappers are needed in code generation.
3593
3584
  *
3594
- * @note Returns `true` for the first matching circular ref found; use for fast dependency checks.
3585
+ * @note Returns `true` for the first matching circular ref found. Use for fast dependency checks.
3595
3586
  */
3596
3587
  declare function containsCircularRef(node: SchemaNode | undefined, {
3597
3588
  circularSchemas,
@@ -3602,4 +3593,4 @@ declare function containsCircularRef(node: SchemaNode | undefined, {
3602
3593
  }): boolean;
3603
3594
  //#endregion
3604
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 };
3605
- //# sourceMappingURL=types-CE8VJ5_y.d.ts.map
3596
+ //# sourceMappingURL=types-CEIHPTfs.d.ts.map
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $t as ScalarSchemaType, At as FunctionParameterNode, Bt as DateSchemaNode, C as PrinterFactoryOptions, Ct as HttpStatusCode, D as DistributiveOmit, Dt as ParameterNode, Et as ParameterLocation, Ft as FileNode, Gt as IntersectionSchemaNode, Ht as EnumSchemaNode, It as ImportNode, Jt as NumberSchemaNode, Kt as Ipv4SchemaNode, Lt as SourceNode, Mt as ParameterGroupNode, Nt as ParamsTypeNode, O as UserFileNode, Ot as FunctionNodeType, Pt as ExportNode, Qt as ScalarSchemaNode, Rt as ArraySchemaNode, S as Printer, Sn as VisitorDepth, St as ResponseNode, Tt as StatusCode, Ut as EnumValueNode, Vt as DatetimeSchemaNode, Wt as FormatStringSchemaNode, Xt as PrimitiveSchemaType, Yt as ObjectSchemaNode, Zt as RefSchemaNode, _ as VisitorContext, _n as TypeDeclarationNode, _t as HttpMethod, an as TimeSchemaNode, bn as NodeKind, bt as OperationNodeBase, cn as PropertyNode, ct as DedupePlan, d as AsyncVisitor, dn as CodeNode, dt as Node, en as SchemaNode, et as InferSchemaNode, f as CollectOptions, fn as ConstNode, ft as InputMeta, g as Visitor, gn as TextNode, gt as GenericOperationNode, h as TransformOptions, hn as JsxNode, ht as OutputNode, in as StringSchemaNode, it as SchemaDialect, jt as FunctionParametersNode, kt as FunctionParamNode, ln as ArrowFunctionNode, m as ParentOf, mn as JSDocNode, mt as InputStreamNode, nn as SchemaType, nt as DispatchRule, on as UnionSchemaNode, ot as BuildDedupePlanOptions, p as CollectVisitor, pn as FunctionNode, pt as InputNode, qt as Ipv6SchemaNode, rn as SpecialSchemaType, sn as UrlSchemaNode, st as DedupeCanonical, t as OperationParamsResolver, tn as SchemaNodeByType, tt as ParserOptions, un as BreakNode, v as WalkOptions, vn as TypeNode, vt as HttpOperationNode, w as PrinterPartial, wt as MediaType, xn as ScalarPrimitive, xt as OperationProtocol, yn as BaseNode, yt as OperationNode, zt as ComplexSchemaType } from "./types-CE8VJ5_y.js";
1
+ import { $t as ScalarSchemaType, At as FunctionParameterNode, Bt as DateSchemaNode, C as PrinterFactoryOptions, Ct as HttpStatusCode, D as DistributiveOmit, Dt as ParameterNode, Et as ParameterLocation, Ft as FileNode, Gt as IntersectionSchemaNode, Ht as EnumSchemaNode, It as ImportNode, Jt as NumberSchemaNode, Kt as Ipv4SchemaNode, Lt as SourceNode, Mt as ParameterGroupNode, Nt as ParamsTypeNode, O as UserFileNode, Ot as FunctionNodeType, Pt as ExportNode, Qt as ScalarSchemaNode, Rt as ArraySchemaNode, S as Printer, Sn as VisitorDepth, St as ResponseNode, Tt as StatusCode, Ut as EnumValueNode, Vt as DatetimeSchemaNode, Wt as FormatStringSchemaNode, Xt as PrimitiveSchemaType, Yt as ObjectSchemaNode, Zt as RefSchemaNode, _ as VisitorContext, _n as TypeDeclarationNode, _t as HttpMethod, an as TimeSchemaNode, bn as NodeKind, bt as OperationNodeBase, cn as PropertyNode, ct as DedupePlan, d as AsyncVisitor, dn as CodeNode, dt as Node, en as SchemaNode, et as InferSchemaNode, f as CollectOptions, fn as ConstNode, ft as InputMeta, g as Visitor, gn as TextNode, gt as GenericOperationNode, h as TransformOptions, hn as JsxNode, ht as OutputNode, in as StringSchemaNode, it as SchemaDialect, jt as FunctionParametersNode, kt as FunctionParamNode, ln as ArrowFunctionNode, m as ParentOf, mn as JSDocNode, mt as InputStreamNode, nn as SchemaType, nt as DispatchRule, on as UnionSchemaNode, ot as BuildDedupePlanOptions, p as CollectVisitor, pn as FunctionNode, pt as InputNode, qt as Ipv6SchemaNode, rn as SpecialSchemaType, sn as UrlSchemaNode, st as DedupeCanonical, t as OperationParamsResolver, tn as SchemaNodeByType, tt as ParserOptions, un as BreakNode, v as WalkOptions, vn as TypeNode, vt as HttpOperationNode, w as PrinterPartial, wt as MediaType, xn as ScalarPrimitive, xt as OperationProtocol, yn as BaseNode, yt as OperationNode, zt as ComplexSchemaType } from "./types-CEIHPTfs.js";
2
2
  export type { ArraySchemaNode, ArrowFunctionNode, AsyncVisitor, BaseNode, BreakNode, BuildDedupePlanOptions, CodeNode, CollectOptions, CollectVisitor, ComplexSchemaType, ConstNode, DateSchemaNode, DatetimeSchemaNode, DedupeCanonical, DedupePlan, DispatchRule, DistributiveOmit, EnumSchemaNode, EnumValueNode, ExportNode, FileNode, FormatStringSchemaNode, FunctionNode, FunctionNodeType, FunctionParamNode, FunctionParameterNode, FunctionParametersNode, GenericOperationNode, HttpMethod, HttpOperationNode, HttpStatusCode, ImportNode, InferSchemaNode, InputMeta, InputNode, InputStreamNode, IntersectionSchemaNode, Ipv4SchemaNode, Ipv6SchemaNode, JSDocNode, JsxNode, MediaType, Node, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OperationNodeBase, OperationParamsResolver, OperationProtocol, OutputNode, ParameterGroupNode, ParameterLocation, ParameterNode, ParamsTypeNode, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, ResponseNode, ScalarPrimitive, ScalarSchemaNode, ScalarSchemaType, SchemaDialect, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, SpecialSchemaType, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TransformOptions, TypeDeclarationNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext, VisitorDepth, WalkOptions };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/ast",
3
- "version": "5.0.0-beta.36",
3
+ "version": "5.0.0-beta.38",
4
4
  "description": "Spec-agnostic AST layer for Kubb. Defines the node tree, visitor pattern, factory functions, and type guards used across all code generation plugins.",
5
5
  "keywords": [
6
6
  "ast",
package/src/constants.ts CHANGED
@@ -4,8 +4,8 @@ import type { SchemaType } from './nodes/schema.ts'
4
4
  /**
5
5
  * Traversal depth for AST visitor utilities.
6
6
  *
7
- * - `'shallow'` visits only the immediate node, skipping children.
8
- * - `'deep'` recursively visits all descendant nodes.
7
+ * - `'shallow'` visits only the immediate node, skipping children.
8
+ * - `'deep'` recursively visits all descendant nodes.
9
9
  */
10
10
  export type VisitorDepth = 'shallow' | 'deep'
11
11
 
package/src/dedupe.ts CHANGED
@@ -37,7 +37,7 @@ export type DedupePlan = {
37
37
 
38
38
  /**
39
39
  * Options that inject the naming and candidate policy into {@link buildDedupePlan}.
40
- * The mechanics (grouping, counting, rewriting) live here; the policy lives in the caller.
40
+ * The mechanics (grouping, counting, rewriting) live here. The policy lives in the caller.
41
41
  */
42
42
  export type BuildDedupePlanOptions = {
43
43
  /**
@@ -89,7 +89,7 @@ function createRefNode(node: SchemaNode, canonical: DedupeCanonical): SchemaNode
89
89
  * so nested duplicates inside a replaced shape are not visited again.
90
90
  *
91
91
  * Pass `skipRootMatch` when rewriting a canonical definition so its own root is not
92
- * turned into a reference to itself; nested duplicates are still collapsed.
92
+ * turned into a reference to itself. Nested duplicates are still collapsed.
93
93
  *
94
94
  * @example
95
95
  * ```ts
@@ -129,7 +129,7 @@ function cleanDefinition(node: SchemaNode, name: string): SchemaNode {
129
129
  *
130
130
  * A shape that occurs at least `minOccurrences` times is deduplicated: if any occurrence
131
131
  * is a named top-level schema, that name becomes the canonical (so other top-level duplicates
132
- * and inline copies turn into references to it); otherwise a new definition is hoisted using
132
+ * and inline copies turn into references to it). Otherwise a new definition is hoisted using
133
133
  * `nameFor`. The plan is then applied per node with {@link applyDedupe}.
134
134
  *
135
135
  * @example
package/src/dialect.ts CHANGED
@@ -1,24 +1,18 @@
1
1
  /**
2
- * The spec-specific decisions a schema parser makes while converting a source
3
- * document's schemas into Kubb AST nodes.
2
+ * The spec-specific decisions a schema parser makes when converting a source document's schemas
3
+ * into Kubb AST nodes. Everything else in an adapter's schema pipeline is generic JSON Schema,
4
+ * shared across specs, so the dialect is the one seam where specs differ, like a database driver
5
+ * targeting Postgres vs MySQL. Pair it with {@link dispatch}: the rule table picks which converter
6
+ * runs, the dialect answers the spec-specific questions inside it.
4
7
  *
5
- * Everything else in an adapter's schema pipeline is generic JSON Schema shared
6
- * across specs; the dialect is the one seam where a spec differs — the
7
- * "dialect layer" analogue of a database driver targeting Postgres vs MySQL.
8
- * Pair it with {@link dispatch}: the rule table decides *which* converter runs,
9
- * the dialect answers the spec-specific questions inside them.
8
+ * The guards (`isReference`, `isDiscriminator`) are type predicates, so converters narrow the
9
+ * schema after a check and the type parameters carry the narrowed types through.
10
10
  *
11
- * The guard methods (`isReference`, `isDiscriminator`) are type predicates so
12
- * converters narrow the schema after a check; the type parameters carry those
13
- * narrowed types through.
14
- *
15
- * Scope: this is the seam for the **JSON Schema family** — OpenAPI, AsyncAPI, and
16
- * plain JSON Schema all share `$ref`, `allOf`/`oneOf`, `enum`, and `format`, and
17
- * differ only in these few decisions. A spec built on a different type system
18
- * (e.g. GraphQL, with non-null wrappers, interfaces, and named-type references
19
- * instead of `$ref`) does not implement a `SchemaDialect`; it reuses the universal
20
- * layer directly — the `Adapter` port, the AST factories, and {@link dispatch}
21
- * with its own rule table — to emit the same nodes.
11
+ * This is the seam for the JSON Schema family: OpenAPI, AsyncAPI, and plain JSON Schema share
12
+ * `$ref`, `allOf`/`oneOf`, `enum`, and `format` and differ only in these few decisions. A spec on
13
+ * a different type system (GraphQL, with non-null wrappers and named-type references instead of
14
+ * `$ref`) skips `SchemaDialect` and reuses the universal layer directly: the `Adapter` port, the
15
+ * AST factories, and {@link dispatch} with its own rule table.
22
16
  *
23
17
  * @typeParam TSchema - The adapter's schema object type (e.g. an OpenAPI `SchemaObject`).
24
18
  * @typeParam TRef - The narrowed `$ref` pointer type `isReference` proves.
@@ -42,7 +36,7 @@ export type SchemaDialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TS
42
36
 
43
37
  /**
44
38
  * Identity helper that types a {@link SchemaDialect} for an adapter. Like
45
- * `defineParser`, it adds no runtime behavior it pins the dialect's type for
39
+ * `defineParser`, it adds no runtime behavior, it pins the dialect's type for
46
40
  * inference and gives adapter authors a discoverable anchor.
47
41
  *
48
42
  * @example
package/src/dispatch.ts CHANGED
@@ -15,7 +15,7 @@ export type DispatchRule<TContext, TNode> = {
15
15
  * Produces a node for the context, or `null` to fall through to the next rule.
16
16
  *
17
17
  * Returning `null` lets a broad `match` defer: e.g. "has a `format`" matches many schemas,
18
- * but only some formats are convertible the rest fall through to plain `type` handling.
18
+ * but only some formats are convertible, the rest fall through to plain `type` handling.
19
19
  */
20
20
  convert: (context: TContext) => TNode | null
21
21
  }
@@ -30,7 +30,7 @@ export type DispatchRule<TContext, TNode> = {
30
30
  *
31
31
  * An adapter derives a context from a source spec node, then declares an ordered table of
32
32
  * rules mapping spec shapes onto Kubb AST nodes. To add support for a new spec, write a new
33
- * context type and a new rules table the traversal here is reused unchanged.
33
+ * context type and a new rules table, the traversal here is reused unchanged.
34
34
  *
35
35
  * Order is significant: earlier rules win, so list higher-precedence or more specific shapes
36
36
  * first (e.g. composition keywords before plain `type`). A rule whose `match` returns `true`
package/src/factory.ts CHANGED
@@ -74,7 +74,7 @@ export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omi
74
74
  * `changes` already equals (by reference) the current value, otherwise a new node
75
75
  * with the changes applied.
76
76
  *
77
- * Mirrors the TypeScript compiler's `factory.updateX` contract pair it with the
77
+ * Mirrors the TypeScript compiler's `factory.updateX` contract, pair it with the
78
78
  * structural sharing in {@link transform} so a no-op rewrite doesn't allocate and
79
79
  * downstream passes can detect "nothing changed" by identity. Comparison is
80
80
  * shallow: a structurally-equal but newly-allocated array/object counts as a change.
@@ -251,7 +251,7 @@ export function createOperation(props: {
251
251
 
252
252
  /**
253
253
  * Maps schema `type` to its underlying `primitive`.
254
- * Primitive types map to themselves; special string formats map to `'string'`.
254
+ * Primitive types map to themselves. Special string formats map to `'string'`.
255
255
  * Complex types (`ref`, `enum`, `union`, `intersection`, `tuple`, `blob`) are left unset.
256
256
  */
257
257
  const TYPE_TO_PRIMITIVE: Partial<Record<SchemaNode['type'], PrimitiveSchemaType>> = {
@@ -455,7 +455,7 @@ export function createResponse(
455
455
  * // → params?: QueryParams
456
456
  * ```
457
457
  *
458
- * @example Param with default (implicitly optional; cannot combine with `optional: true`)
458
+ * @example Param with default (implicitly optional. Cannot combine with `optional: true`)
459
459
  * ```ts
460
460
  * createFunctionParameter({ name: 'config', type: createParamsType({ variant: 'reference', name: 'RequestConfig' }), default: '{}' })
461
461
  * // → config: RequestConfig = {}
@@ -525,7 +525,7 @@ export function createParamsType(
525
525
  * // call → { id, name }
526
526
  * ```
527
527
  *
528
- * @example Inline (spread) children emitted as individual top-level parameters
528
+ * @example Inline (spread), children emitted as individual top-level parameters
529
529
  * ```ts
530
530
  * createParameterGroup({
531
531
  * properties: [createFunctionParameter({ name: 'petId', type: createParamsType({ variant: 'reference', name: 'string' }), optional: false })],
@@ -628,9 +628,9 @@ export type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>,
628
628
  * Creates a fully resolved `FileNode` from a file input descriptor.
629
629
  *
630
630
  * Computes:
631
- * - `id` SHA256 hash of the file path
632
- * - `name` `baseName` without extension
633
- * - `extname` extension extracted from `baseName`
631
+ * - `id` SHA256 hash of the file path
632
+ * - `name` `baseName` without extension
633
+ * - `extname` extension extracted from `baseName`
634
634
  *
635
635
  * Deduplicates:
636
636
  * - `sources` via `combineSources`
package/src/infer.ts CHANGED
@@ -30,7 +30,7 @@ export type ParserOptions = {
30
30
  dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date'
31
31
  /**
32
32
  * How `type: 'integer'` (and `format: 'int64'`) maps to TypeScript.
33
- * - `'number'` fits most JSON APIs; loses precision above `Number.MAX_SAFE_INTEGER`.
33
+ * - `'number'` fits most JSON APIs. Loses precision above `Number.MAX_SAFE_INTEGER`.
34
34
  * - `'bigint'` is exact for 64-bit IDs, but does not round-trip through JSON.
35
35
  *
36
36
  * @default 'number'
package/src/nodes/code.ts CHANGED
@@ -255,7 +255,7 @@ export type TextNode = BaseNode & {
255
255
  * AST node representing a line break in the source output.
256
256
  *
257
257
  * Corresponds to `<br/>` in JSX components. When printed, produces an empty
258
- * string that joined with `\n` by `printNodes` creates a blank line
258
+ * string that, joined with `\n` by `printNodes` creates a blank line
259
259
  * between surrounding code nodes.
260
260
  *
261
261
  * @example