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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/dist/{defineMacro-Bh5E_Il6.cjs → defineMacro-5Dvct8k_.cjs} +2 -2
  2. package/dist/{defineMacro-Bh5E_Il6.cjs.map → defineMacro-5Dvct8k_.cjs.map} +1 -1
  3. package/dist/{defineMacro-D9ekmTW5.d.ts → defineMacro-BXpTwp0y.d.ts} +2 -2
  4. package/dist/{defineMacro-CVrU3ajV.js → defineMacro-VfsvblGi.js} +2 -2
  5. package/dist/{defineMacro-CVrU3ajV.js.map → defineMacro-VfsvblGi.js.map} +1 -1
  6. package/dist/{index-q_ldM1YP.d.ts → index-DJEyS5y6.d.ts} +8 -2
  7. package/dist/index.cjs +2 -2
  8. package/dist/index.d.ts +7 -7
  9. package/dist/index.js +2 -2
  10. package/dist/macros.cjs +3 -3
  11. package/dist/macros.d.ts +1 -1
  12. package/dist/macros.js +3 -3
  13. package/dist/{operationParams-Dme8H-sR.d.ts → operationParams-BaY12i2I.d.ts} +3 -66
  14. package/dist/{refs-D2qwT5ck.js → refs-D18OeCgb.js} +2 -2
  15. package/dist/{refs-D2qwT5ck.js.map → refs-D18OeCgb.js.map} +1 -1
  16. package/dist/{refs-8IwpesXW.cjs → refs-DuP3_Leg.cjs} +2 -2
  17. package/dist/{refs-8IwpesXW.cjs.map → refs-DuP3_Leg.cjs.map} +1 -1
  18. package/dist/{types-Df1jVmRy.d.ts → types-BsP1SK9j.d.ts} +2 -2
  19. package/dist/types.d.ts +4 -4
  20. package/dist/utils.cjs +2 -7
  21. package/dist/utils.d.ts +3 -30
  22. package/dist/utils.js +3 -3
  23. package/dist/{visitor-CLLDwBvv.cjs → visitor-CQdSiClY.cjs} +7 -1
  24. package/dist/visitor-CQdSiClY.cjs.map +1 -0
  25. package/dist/{visitor-DG5ROqRx.js → visitor-dcVC5TOW.js} +7 -1
  26. package/dist/visitor-dcVC5TOW.js.map +1 -0
  27. package/package.json +1 -1
  28. package/dist/visitor-CLLDwBvv.cjs.map +0 -1
  29. package/dist/visitor-DG5ROqRx.js.map +0 -1
@@ -1,4 +1,4 @@
1
- const require_visitor = require("./visitor-CLLDwBvv.cjs");
1
+ const require_visitor = require("./visitor-CQdSiClY.cjs");
2
2
  //#region src/defineMacro.ts
3
3
  /**
4
4
  * Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain
@@ -111,4 +111,4 @@ Object.defineProperty(exports, "defineMacro", {
111
111
  }
112
112
  });
113
113
 
114
- //# sourceMappingURL=defineMacro-Bh5E_Il6.cjs.map
114
+ //# sourceMappingURL=defineMacro-5Dvct8k_.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"defineMacro-Bh5E_Il6.cjs","names":["visitorKeys","transform"],"sources":["../src/defineMacro.ts"],"sourcesContent":["import type { VisitorDepth } from './constants.ts'\nimport type { VisitorKey } from './defineNode.ts'\nimport { visitorKeys } from './defineNode.ts'\nimport type { Node } from './nodes/index.ts'\nimport type { Visitor, VisitorContext } from './visitor.ts'\nimport { transform } from './visitor.ts'\n\n/**\n * Ordering hint shared by macros and plugins. `pre` runs before unmarked items, `post` after,\n * and `undefined` keeps declaration order.\n */\nexport type Enforce = 'pre' | 'post'\n\n/**\n * Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain\n * list keeps its authored order.\n */\nfunction enforceWeight(enforce?: Enforce): number {\n if (enforce === 'pre') return 0\n if (enforce === 'post') return 2\n return 1\n}\n\n/**\n * A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a\n * {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an\n * optional `when` gate. Macros run on the shared AST, so the same macro works across every adapter\n * and output target. Exports follow the `macro<Name>` convention, mirroring plugins (`pluginTs`).\n */\nexport type Macro = Visitor & {\n /**\n * Macro identifier used to tell macros apart, for example `'simplify-union'`.\n */\n name: string\n /**\n * Ordering hint. `pre` macros run before unmarked macros, `post` macros run after.\n * Ordering within a bucket follows list order.\n */\n enforce?: Enforce\n /**\n * Gate checked against the current node before any callback runs. When it returns `false`\n * the macro is skipped for that node.\n */\n when?: (node: Node) => boolean\n}\n\n/**\n * Types a macro for inference and a single construction site, mirroring `definePlugin`.\n * Adds no runtime behavior.\n *\n * @example\n * ```ts\n * const macroUntagged = defineMacro({\n * name: 'untagged',\n * operation(node) {\n * return node.tags?.length ? undefined : { ...node, tags: ['untagged'] }\n * },\n * })\n * ```\n */\nexport function defineMacro(macro: Macro): Macro {\n return macro\n}\n\ntype MacroCallback = (node: Node, context: VisitorContext) => Node | null | undefined\n\ntype ChainProps = {\n macros: ReadonlyArray<Macro>\n key: VisitorKey\n node: Node\n context: VisitorContext\n}\n\n/**\n * Runs every macro's callback for one node kind in order, chaining the result so each macro sees\n * the previous macro's output. Returns `undefined` when nothing changed, so `transform` keeps the\n * original reference (structural sharing).\n */\nfunction chain({ macros, key, node, context }: ChainProps): Node | undefined {\n let current = node\n\n for (const macro of macros) {\n const callback = macro[key] as MacroCallback | undefined\n if (!callback) continue\n if (macro.when && !macro.when(current)) continue\n\n const next = callback(current, context)\n if (next != null) current = next\n }\n\n return current === node ? undefined : current\n}\n\n/**\n * Folds an ordered list of macros into a single {@link Visitor} that `transform` (and the per-plugin\n * transform layer in `@kubb/core`) can run. Macros are stable-sorted by `enforce`, then applied\n * sequentially per node so later macros see earlier output. This differs from a plain visitor, which\n * has no names, ordering, or composition.\n *\n * @example\n * ```ts\n * const visitor = composeMacros([macroSimplifyUnion, macroDiscriminatorEnum])\n * const next = transform(root, visitor)\n * ```\n */\nexport function composeMacros(macros: ReadonlyArray<Macro>): Visitor {\n const ordered = [...macros].sort((a, b) => enforceWeight(a.enforce) - enforceWeight(b.enforce))\n\n const visitor: Visitor = {}\n for (const key of visitorKeys) {\n if (!ordered.some((macro) => typeof macro[key] === 'function')) continue\n\n const callback = (node: Node, context: VisitorContext) => chain({ macros: ordered, key, node, context })\n ;(visitor as Record<VisitorKey, MacroCallback>)[key] = callback\n }\n\n return visitor\n}\n\n/**\n * Runs a list of macros over a node tree and returns the rewritten tree. Keeps `transform`'s\n * structural sharing, so an empty or no-op macro list returns the same reference. Pass\n * `depth: 'shallow'` to rewrite the root node only.\n *\n * @example\n * ```ts\n * const next = applyMacros(root, [macroIntegerToString])\n * ```\n *\n * @example Apply to the root node only\n * ```ts\n * const named = applyMacros(node, [macroEnumName({ parentName, propName, enumSuffix })], { depth: 'shallow' })\n * ```\n */\nexport function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyArray<Macro>, options?: { depth?: VisitorDepth }): TNode {\n if (macros.length === 0) return root\n\n return transform(root, { ...composeMacros(macros), ...options }) as TNode\n}\n"],"mappings":";;;;;;AAiBA,SAAS,cAAc,SAA2B;CAChD,IAAI,YAAY,OAAO,OAAO;CAC9B,IAAI,YAAY,QAAQ,OAAO;CAC/B,OAAO;AACT;;;;;;;;;;;;;;;AAuCA,SAAgB,YAAY,OAAqB;CAC/C,OAAO;AACT;;;;;;AAgBA,SAAS,MAAM,EAAE,QAAQ,KAAK,MAAM,WAAyC;CAC3E,IAAI,UAAU;CAEd,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,WAAW,MAAM;EACvB,IAAI,CAAC,UAAU;EACf,IAAI,MAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,GAAG;EAExC,MAAM,OAAO,SAAS,SAAS,OAAO;EACtC,IAAI,QAAQ,MAAM,UAAU;CAC9B;CAEA,OAAO,YAAY,OAAO,KAAA,IAAY;AACxC;;;;;;;;;;;;;AAcA,SAAgB,cAAc,QAAuC;CACnE,MAAM,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,cAAc,EAAE,OAAO,IAAI,cAAc,EAAE,OAAO,CAAC;CAE9F,MAAM,UAAmB,CAAC;CAC1B,KAAK,MAAM,OAAOA,gBAAAA,aAAa;EAC7B,IAAI,CAAC,QAAQ,MAAM,UAAU,OAAO,MAAM,SAAS,UAAU,GAAG;EAEhE,MAAM,YAAY,MAAY,YAA4B,MAAM;GAAE,QAAQ;GAAS;GAAK;GAAM;EAAQ,CAAC;EACtG,QAA+C,OAAO;CACzD;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAgC,MAAa,QAA8B,SAA2C;CACpI,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,OAAOC,gBAAAA,UAAU,MAAM;EAAE,GAAG,cAAc,MAAM;EAAG,GAAG;CAAQ,CAAC;AACjE"}
1
+ {"version":3,"file":"defineMacro-5Dvct8k_.cjs","names":["visitorKeys","transform"],"sources":["../src/defineMacro.ts"],"sourcesContent":["import type { VisitorDepth } from './constants.ts'\nimport type { VisitorKey } from './defineNode.ts'\nimport { visitorKeys } from './defineNode.ts'\nimport type { Node } from './nodes/index.ts'\nimport type { Visitor, VisitorContext } from './visitor.ts'\nimport { transform } from './visitor.ts'\n\n/**\n * Ordering hint shared by macros and plugins. `pre` runs before unmarked items, `post` after,\n * and `undefined` keeps declaration order.\n */\nexport type Enforce = 'pre' | 'post'\n\n/**\n * Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain\n * list keeps its authored order.\n */\nfunction enforceWeight(enforce?: Enforce): number {\n if (enforce === 'pre') return 0\n if (enforce === 'post') return 2\n return 1\n}\n\n/**\n * A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a\n * {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an\n * optional `when` gate. Macros run on the shared AST, so the same macro works across every adapter\n * and output target. Exports follow the `macro<Name>` convention, mirroring plugins (`pluginTs`).\n */\nexport type Macro = Visitor & {\n /**\n * Macro identifier used to tell macros apart, for example `'simplify-union'`.\n */\n name: string\n /**\n * Ordering hint. `pre` macros run before unmarked macros, `post` macros run after.\n * Ordering within a bucket follows list order.\n */\n enforce?: Enforce\n /**\n * Gate checked against the current node before any callback runs. When it returns `false`\n * the macro is skipped for that node.\n */\n when?: (node: Node) => boolean\n}\n\n/**\n * Types a macro for inference and a single construction site, mirroring `definePlugin`.\n * Adds no runtime behavior.\n *\n * @example\n * ```ts\n * const macroUntagged = defineMacro({\n * name: 'untagged',\n * operation(node) {\n * return node.tags?.length ? undefined : { ...node, tags: ['untagged'] }\n * },\n * })\n * ```\n */\nexport function defineMacro(macro: Macro): Macro {\n return macro\n}\n\ntype MacroCallback = (node: Node, context: VisitorContext) => Node | null | undefined\n\ntype ChainProps = {\n macros: ReadonlyArray<Macro>\n key: VisitorKey\n node: Node\n context: VisitorContext\n}\n\n/**\n * Runs every macro's callback for one node kind in order, chaining the result so each macro sees\n * the previous macro's output. Returns `undefined` when nothing changed, so `transform` keeps the\n * original reference (structural sharing).\n */\nfunction chain({ macros, key, node, context }: ChainProps): Node | undefined {\n let current = node\n\n for (const macro of macros) {\n const callback = macro[key] as MacroCallback | undefined\n if (!callback) continue\n if (macro.when && !macro.when(current)) continue\n\n const next = callback(current, context)\n if (next != null) current = next\n }\n\n return current === node ? undefined : current\n}\n\n/**\n * Folds an ordered list of macros into a single {@link Visitor} that `transform` (and the per-plugin\n * transform layer in `@kubb/core`) can run. Macros are stable-sorted by `enforce`, then applied\n * sequentially per node so later macros see earlier output. This differs from a plain visitor, which\n * has no names, ordering, or composition.\n *\n * @example\n * ```ts\n * const visitor = composeMacros([macroSimplifyUnion, macroDiscriminatorEnum])\n * const next = transform(root, visitor)\n * ```\n */\nexport function composeMacros(macros: ReadonlyArray<Macro>): Visitor {\n const ordered = [...macros].sort((a, b) => enforceWeight(a.enforce) - enforceWeight(b.enforce))\n\n const visitor: Visitor = {}\n for (const key of visitorKeys) {\n if (!ordered.some((macro) => typeof macro[key] === 'function')) continue\n\n const callback = (node: Node, context: VisitorContext) => chain({ macros: ordered, key, node, context })\n ;(visitor as Record<VisitorKey, MacroCallback>)[key] = callback\n }\n\n return visitor\n}\n\n/**\n * Runs a list of macros over a node tree and returns the rewritten tree. Keeps `transform`'s\n * structural sharing, so an empty or no-op macro list returns the same reference. Pass\n * `depth: 'shallow'` to rewrite the root node only.\n *\n * @example\n * ```ts\n * const next = applyMacros(root, [macroIntegerToString])\n * ```\n *\n * @example Apply to the root node only\n * ```ts\n * const named = applyMacros(node, [macroEnumName({ parentName, propName, enumSuffix })], { depth: 'shallow' })\n * ```\n */\nexport function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyArray<Macro>, options?: { depth?: VisitorDepth }): TNode {\n if (macros.length === 0) return root\n\n return transform(root, { ...composeMacros(macros), ...options }) as TNode\n}\n"],"mappings":";;;;;;AAiBA,SAAS,cAAc,SAA2B;CAChD,IAAI,YAAY,OAAO,OAAO;CAC9B,IAAI,YAAY,QAAQ,OAAO;CAC/B,OAAO;AACT;;;;;;;;;;;;;;;AAuCA,SAAgB,YAAY,OAAqB;CAC/C,OAAO;AACT;;;;;;AAgBA,SAAS,MAAM,EAAE,QAAQ,KAAK,MAAM,WAAyC;CAC3E,IAAI,UAAU;CAEd,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,WAAW,MAAM;EACvB,IAAI,CAAC,UAAU;EACf,IAAI,MAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,GAAG;EAExC,MAAM,OAAO,SAAS,SAAS,OAAO;EACtC,IAAI,QAAQ,MAAM,UAAU;CAC9B;CAEA,OAAO,YAAY,OAAO,KAAA,IAAY;AACxC;;;;;;;;;;;;;AAcA,SAAgB,cAAc,QAAuC;CACnE,MAAM,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,cAAc,EAAE,OAAO,IAAI,cAAc,EAAE,OAAO,CAAC;CAE9F,MAAM,UAAmB,CAAC;CAC1B,KAAK,MAAM,OAAOA,gBAAAA,aAAa;EAC7B,IAAI,CAAC,QAAQ,MAAM,UAAU,OAAO,MAAM,SAAS,UAAU,GAAG;EAEhE,MAAM,YAAY,MAAY,YAA4B,MAAM;GAAE,QAAQ;GAAS;GAAK;GAAM;EAAQ,CAAC;EACtG,QAA+C,OAAO;CACzD;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAgC,MAAa,QAA8B,SAA2C;CACpI,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,OAAOC,gBAAAA,UAAU,MAAM;EAAE,GAAG,cAAc,MAAM;EAAG,GAAG;CAAQ,CAAC;AACjE"}
@@ -1,5 +1,5 @@
1
1
  import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
2
- import { C as ParameterNode, Et as PropertyNode, _t as SchemaNode, f as OperationNode, h as ResponseNode, n as OutputNode, o as InputNode, rt as ContentNode, t as Node, y as RequestBodyNode } from "./index-q_ldM1YP.js";
2
+ import { C as ParameterNode, Et as PropertyNode, _t as SchemaNode, f as OperationNode, h as ResponseNode, n as OutputNode, o as InputNode, rt as ContentNode, t as Node, y as RequestBodyNode } from "./index-DJEyS5y6.js";
3
3
 
4
4
  //#region src/constants.d.ts
5
5
  /**
@@ -463,4 +463,4 @@ declare function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyAr
463
463
  }): TNode;
464
464
  //#endregion
465
465
  export { defineMacro as a, VisitorContext as c, walk as d, schemaTypes as f, composeMacros as i, collect as l, Macro as n, ParentOf as o, applyMacros as r, Visitor as s, Enforce as t, transform as u };
466
- //# sourceMappingURL=defineMacro-D9ekmTW5.d.ts.map
466
+ //# sourceMappingURL=defineMacro-BXpTwp0y.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import "./rolldown-runtime-CNktS9qV.js";
2
- import { r as transform, st as visitorKeys } from "./visitor-DG5ROqRx.js";
2
+ import { r as transform, st as visitorKeys } from "./visitor-dcVC5TOW.js";
3
3
  //#region src/defineMacro.ts
4
4
  /**
5
5
  * Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain
@@ -95,4 +95,4 @@ function applyMacros(root, macros, options) {
95
95
  //#endregion
96
96
  export { composeMacros as n, defineMacro as r, applyMacros as t };
97
97
 
98
- //# sourceMappingURL=defineMacro-CVrU3ajV.js.map
98
+ //# sourceMappingURL=defineMacro-VfsvblGi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"defineMacro-CVrU3ajV.js","names":[],"sources":["../src/defineMacro.ts"],"sourcesContent":["import type { VisitorDepth } from './constants.ts'\nimport type { VisitorKey } from './defineNode.ts'\nimport { visitorKeys } from './defineNode.ts'\nimport type { Node } from './nodes/index.ts'\nimport type { Visitor, VisitorContext } from './visitor.ts'\nimport { transform } from './visitor.ts'\n\n/**\n * Ordering hint shared by macros and plugins. `pre` runs before unmarked items, `post` after,\n * and `undefined` keeps declaration order.\n */\nexport type Enforce = 'pre' | 'post'\n\n/**\n * Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain\n * list keeps its authored order.\n */\nfunction enforceWeight(enforce?: Enforce): number {\n if (enforce === 'pre') return 0\n if (enforce === 'post') return 2\n return 1\n}\n\n/**\n * A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a\n * {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an\n * optional `when` gate. Macros run on the shared AST, so the same macro works across every adapter\n * and output target. Exports follow the `macro<Name>` convention, mirroring plugins (`pluginTs`).\n */\nexport type Macro = Visitor & {\n /**\n * Macro identifier used to tell macros apart, for example `'simplify-union'`.\n */\n name: string\n /**\n * Ordering hint. `pre` macros run before unmarked macros, `post` macros run after.\n * Ordering within a bucket follows list order.\n */\n enforce?: Enforce\n /**\n * Gate checked against the current node before any callback runs. When it returns `false`\n * the macro is skipped for that node.\n */\n when?: (node: Node) => boolean\n}\n\n/**\n * Types a macro for inference and a single construction site, mirroring `definePlugin`.\n * Adds no runtime behavior.\n *\n * @example\n * ```ts\n * const macroUntagged = defineMacro({\n * name: 'untagged',\n * operation(node) {\n * return node.tags?.length ? undefined : { ...node, tags: ['untagged'] }\n * },\n * })\n * ```\n */\nexport function defineMacro(macro: Macro): Macro {\n return macro\n}\n\ntype MacroCallback = (node: Node, context: VisitorContext) => Node | null | undefined\n\ntype ChainProps = {\n macros: ReadonlyArray<Macro>\n key: VisitorKey\n node: Node\n context: VisitorContext\n}\n\n/**\n * Runs every macro's callback for one node kind in order, chaining the result so each macro sees\n * the previous macro's output. Returns `undefined` when nothing changed, so `transform` keeps the\n * original reference (structural sharing).\n */\nfunction chain({ macros, key, node, context }: ChainProps): Node | undefined {\n let current = node\n\n for (const macro of macros) {\n const callback = macro[key] as MacroCallback | undefined\n if (!callback) continue\n if (macro.when && !macro.when(current)) continue\n\n const next = callback(current, context)\n if (next != null) current = next\n }\n\n return current === node ? undefined : current\n}\n\n/**\n * Folds an ordered list of macros into a single {@link Visitor} that `transform` (and the per-plugin\n * transform layer in `@kubb/core`) can run. Macros are stable-sorted by `enforce`, then applied\n * sequentially per node so later macros see earlier output. This differs from a plain visitor, which\n * has no names, ordering, or composition.\n *\n * @example\n * ```ts\n * const visitor = composeMacros([macroSimplifyUnion, macroDiscriminatorEnum])\n * const next = transform(root, visitor)\n * ```\n */\nexport function composeMacros(macros: ReadonlyArray<Macro>): Visitor {\n const ordered = [...macros].sort((a, b) => enforceWeight(a.enforce) - enforceWeight(b.enforce))\n\n const visitor: Visitor = {}\n for (const key of visitorKeys) {\n if (!ordered.some((macro) => typeof macro[key] === 'function')) continue\n\n const callback = (node: Node, context: VisitorContext) => chain({ macros: ordered, key, node, context })\n ;(visitor as Record<VisitorKey, MacroCallback>)[key] = callback\n }\n\n return visitor\n}\n\n/**\n * Runs a list of macros over a node tree and returns the rewritten tree. Keeps `transform`'s\n * structural sharing, so an empty or no-op macro list returns the same reference. Pass\n * `depth: 'shallow'` to rewrite the root node only.\n *\n * @example\n * ```ts\n * const next = applyMacros(root, [macroIntegerToString])\n * ```\n *\n * @example Apply to the root node only\n * ```ts\n * const named = applyMacros(node, [macroEnumName({ parentName, propName, enumSuffix })], { depth: 'shallow' })\n * ```\n */\nexport function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyArray<Macro>, options?: { depth?: VisitorDepth }): TNode {\n if (macros.length === 0) return root\n\n return transform(root, { ...composeMacros(macros), ...options }) as TNode\n}\n"],"mappings":";;;;;;;AAiBA,SAAS,cAAc,SAA2B;CAChD,IAAI,YAAY,OAAO,OAAO;CAC9B,IAAI,YAAY,QAAQ,OAAO;CAC/B,OAAO;AACT;;;;;;;;;;;;;;;AAuCA,SAAgB,YAAY,OAAqB;CAC/C,OAAO;AACT;;;;;;AAgBA,SAAS,MAAM,EAAE,QAAQ,KAAK,MAAM,WAAyC;CAC3E,IAAI,UAAU;CAEd,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,WAAW,MAAM;EACvB,IAAI,CAAC,UAAU;EACf,IAAI,MAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,GAAG;EAExC,MAAM,OAAO,SAAS,SAAS,OAAO;EACtC,IAAI,QAAQ,MAAM,UAAU;CAC9B;CAEA,OAAO,YAAY,OAAO,KAAA,IAAY;AACxC;;;;;;;;;;;;;AAcA,SAAgB,cAAc,QAAuC;CACnE,MAAM,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,cAAc,EAAE,OAAO,IAAI,cAAc,EAAE,OAAO,CAAC;CAE9F,MAAM,UAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,aAAa;EAC7B,IAAI,CAAC,QAAQ,MAAM,UAAU,OAAO,MAAM,SAAS,UAAU,GAAG;EAEhE,MAAM,YAAY,MAAY,YAA4B,MAAM;GAAE,QAAQ;GAAS;GAAK;GAAM;EAAQ,CAAC;EACtG,QAA+C,OAAO;CACzD;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAgC,MAAa,QAA8B,SAA2C;CACpI,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,OAAO,UAAU,MAAM;EAAE,GAAG,cAAc,MAAM;EAAG,GAAG;CAAQ,CAAC;AACjE"}
1
+ {"version":3,"file":"defineMacro-VfsvblGi.js","names":[],"sources":["../src/defineMacro.ts"],"sourcesContent":["import type { VisitorDepth } from './constants.ts'\nimport type { VisitorKey } from './defineNode.ts'\nimport { visitorKeys } from './defineNode.ts'\nimport type { Node } from './nodes/index.ts'\nimport type { Visitor, VisitorContext } from './visitor.ts'\nimport { transform } from './visitor.ts'\n\n/**\n * Ordering hint shared by macros and plugins. `pre` runs before unmarked items, `post` after,\n * and `undefined` keeps declaration order.\n */\nexport type Enforce = 'pre' | 'post'\n\n/**\n * Sort weight for an `enforce` hint. `pre` sorts before unmarked items and `post` after, so a plain\n * list keeps its authored order.\n */\nfunction enforceWeight(enforce?: Enforce): number {\n if (enforce === 'pre') return 0\n if (enforce === 'post') return 2\n return 1\n}\n\n/**\n * A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a\n * {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an\n * optional `when` gate. Macros run on the shared AST, so the same macro works across every adapter\n * and output target. Exports follow the `macro<Name>` convention, mirroring plugins (`pluginTs`).\n */\nexport type Macro = Visitor & {\n /**\n * Macro identifier used to tell macros apart, for example `'simplify-union'`.\n */\n name: string\n /**\n * Ordering hint. `pre` macros run before unmarked macros, `post` macros run after.\n * Ordering within a bucket follows list order.\n */\n enforce?: Enforce\n /**\n * Gate checked against the current node before any callback runs. When it returns `false`\n * the macro is skipped for that node.\n */\n when?: (node: Node) => boolean\n}\n\n/**\n * Types a macro for inference and a single construction site, mirroring `definePlugin`.\n * Adds no runtime behavior.\n *\n * @example\n * ```ts\n * const macroUntagged = defineMacro({\n * name: 'untagged',\n * operation(node) {\n * return node.tags?.length ? undefined : { ...node, tags: ['untagged'] }\n * },\n * })\n * ```\n */\nexport function defineMacro(macro: Macro): Macro {\n return macro\n}\n\ntype MacroCallback = (node: Node, context: VisitorContext) => Node | null | undefined\n\ntype ChainProps = {\n macros: ReadonlyArray<Macro>\n key: VisitorKey\n node: Node\n context: VisitorContext\n}\n\n/**\n * Runs every macro's callback for one node kind in order, chaining the result so each macro sees\n * the previous macro's output. Returns `undefined` when nothing changed, so `transform` keeps the\n * original reference (structural sharing).\n */\nfunction chain({ macros, key, node, context }: ChainProps): Node | undefined {\n let current = node\n\n for (const macro of macros) {\n const callback = macro[key] as MacroCallback | undefined\n if (!callback) continue\n if (macro.when && !macro.when(current)) continue\n\n const next = callback(current, context)\n if (next != null) current = next\n }\n\n return current === node ? undefined : current\n}\n\n/**\n * Folds an ordered list of macros into a single {@link Visitor} that `transform` (and the per-plugin\n * transform layer in `@kubb/core`) can run. Macros are stable-sorted by `enforce`, then applied\n * sequentially per node so later macros see earlier output. This differs from a plain visitor, which\n * has no names, ordering, or composition.\n *\n * @example\n * ```ts\n * const visitor = composeMacros([macroSimplifyUnion, macroDiscriminatorEnum])\n * const next = transform(root, visitor)\n * ```\n */\nexport function composeMacros(macros: ReadonlyArray<Macro>): Visitor {\n const ordered = [...macros].sort((a, b) => enforceWeight(a.enforce) - enforceWeight(b.enforce))\n\n const visitor: Visitor = {}\n for (const key of visitorKeys) {\n if (!ordered.some((macro) => typeof macro[key] === 'function')) continue\n\n const callback = (node: Node, context: VisitorContext) => chain({ macros: ordered, key, node, context })\n ;(visitor as Record<VisitorKey, MacroCallback>)[key] = callback\n }\n\n return visitor\n}\n\n/**\n * Runs a list of macros over a node tree and returns the rewritten tree. Keeps `transform`'s\n * structural sharing, so an empty or no-op macro list returns the same reference. Pass\n * `depth: 'shallow'` to rewrite the root node only.\n *\n * @example\n * ```ts\n * const next = applyMacros(root, [macroIntegerToString])\n * ```\n *\n * @example Apply to the root node only\n * ```ts\n * const named = applyMacros(node, [macroEnumName({ parentName, propName, enumSuffix })], { depth: 'shallow' })\n * ```\n */\nexport function applyMacros<TNode extends Node>(root: TNode, macros: ReadonlyArray<Macro>, options?: { depth?: VisitorDepth }): TNode {\n if (macros.length === 0) return root\n\n return transform(root, { ...composeMacros(macros), ...options }) as TNode\n}\n"],"mappings":";;;;;;;AAiBA,SAAS,cAAc,SAA2B;CAChD,IAAI,YAAY,OAAO,OAAO;CAC9B,IAAI,YAAY,QAAQ,OAAO;CAC/B,OAAO;AACT;;;;;;;;;;;;;;;AAuCA,SAAgB,YAAY,OAAqB;CAC/C,OAAO;AACT;;;;;;AAgBA,SAAS,MAAM,EAAE,QAAQ,KAAK,MAAM,WAAyC;CAC3E,IAAI,UAAU;CAEd,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,WAAW,MAAM;EACvB,IAAI,CAAC,UAAU;EACf,IAAI,MAAM,QAAQ,CAAC,MAAM,KAAK,OAAO,GAAG;EAExC,MAAM,OAAO,SAAS,SAAS,OAAO;EACtC,IAAI,QAAQ,MAAM,UAAU;CAC9B;CAEA,OAAO,YAAY,OAAO,KAAA,IAAY;AACxC;;;;;;;;;;;;;AAcA,SAAgB,cAAc,QAAuC;CACnE,MAAM,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC,MAAM,GAAG,MAAM,cAAc,EAAE,OAAO,IAAI,cAAc,EAAE,OAAO,CAAC;CAE9F,MAAM,UAAmB,CAAC;CAC1B,KAAK,MAAM,OAAO,aAAa;EAC7B,IAAI,CAAC,QAAQ,MAAM,UAAU,OAAO,MAAM,SAAS,UAAU,GAAG;EAEhE,MAAM,YAAY,MAAY,YAA4B,MAAM;GAAE,QAAQ;GAAS;GAAK;GAAM;EAAQ,CAAC;EACtG,QAA+C,OAAO;CACzD;CAEA,OAAO;AACT;;;;;;;;;;;;;;;;AAiBA,SAAgB,YAAgC,MAAa,QAA8B,SAA2C;CACpI,IAAI,OAAO,WAAW,GAAG,OAAO;CAEhC,OAAO,UAAU,MAAM;EAAE,GAAG,cAAc,MAAM;EAAG,GAAG;CAAQ,CAAC;AACjE"}
@@ -1818,7 +1818,7 @@ type FunctionParameterProperty = {
1818
1818
  optional?: boolean;
1819
1819
  };
1820
1820
  type FunctionParameterInput = {
1821
- name: string;
1821
+ name: string | ObjectBindingPatternNode;
1822
1822
  type?: TypeExpression;
1823
1823
  optional?: boolean;
1824
1824
  default?: string;
@@ -1882,6 +1882,12 @@ declare const createObjectBindingPattern: (input: Pick<ObjectBindingPatternNode,
1882
1882
  * createFunctionParameter({ properties: [{ name: 'id', type: 'string' }, { name: 'name', type: 'string', optional: true }], default: '{}' })
1883
1883
  * // → { id, name }: { id: string; name?: string } = {}
1884
1884
  * ```
1885
+ *
1886
+ * @example Destructured group typed from a single reference
1887
+ * ```ts
1888
+ * createFunctionParameter({ name: createObjectBindingPattern({ elements: [{ name: 'path' }] }), type: "Omit<Config, 'url'>", default: '{}' })
1889
+ * // → { path }: Omit<Config, 'url'> = {}
1890
+ * ```
1885
1891
  */
1886
1892
  declare const createFunctionParameter: (input: FunctionParameterInput) => FunctionParameterNode;
1887
1893
  /**
@@ -2419,4 +2425,4 @@ declare function createOutput(overrides?: Partial<Omit<OutputNode, 'kind'>>): Ou
2419
2425
  type Node = InputNode | OutputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FunctionParamNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | FunctionNode | ArrowFunctionNode;
2420
2426
  //#endregion
2421
2427
  export { exportDef as $, textDef as $t, IndexedAccessTypeNode as A, InferSchemaNode as At, functionParametersDef as B, TypeNode as Bt, ParameterNode as C, UrlSchemaNode as Ct, FunctionParamNode as D, UserPropertyNode as Dt, FunctionParamKind as E, PropertyNode as Et, createFunctionParameters as F, ConstNode as Ft, FileNode as G, createBreak as Gt, objectBindingPatternDef as H, breakDef as Ht, createIndexedAccessType as I, FunctionNode as It, UserFileNode as J, createJsx as Jt, ImportNode as K, createConst as Kt, createObjectBindingPattern as L, JSDocNode as Lt, TypeExpression as M, ArrowFunctionNode as Mt, TypeLiteralNode as N, BreakNode as Nt, FunctionParameterNode as O, createProperty as Ot, createFunctionParameter as P, CodeNode as Pt, createSource as Q, jsxDef as Qt, createTypeLiteral as R, JsxNode as Rt, ParameterLocation as S, UnionSchemaNode as St, parameterDef as T, schemaDef as Tt, typeLiteralDef as U, constDef as Ut, indexedAccessTypeDef as V, arrowFunctionDef as Vt, ExportNode as W, createArrowFunction as Wt, createFile as X, createType as Xt, createExport as Y, createText as Yt, createImport as Z, functionDef as Zt, createResponse as _, SchemaNode as _t, InputMeta as a, NodeKind as an, createContent as at, createRequestBody as b, StringSchemaNode as bt, inputDef as c, DatetimeSchemaNode as ct, HttpOperationNode as d, NumberSchemaNode as dt, typeDef as en, fileDef as et, OperationNode as f, ObjectSchemaNode as ft, StatusCode as g, ScalarSchemaType as gt, ResponseNode as h, ScalarSchemaNode as ht, outputDef as i, BaseNode as in, contentDef as it, ObjectBindingPatternNode as j, ParserOptions as jt, FunctionParametersNode as k, propertyDef as kt, GenericOperationNode as l, EnumSchemaNode as lt, operationDef as m, RefSchemaNode as mt, OutputNode as n, NodeDef as nn, sourceDef as nt, InputNode as o, ArraySchemaNode as ot, createOperation as p, PrimitiveSchemaType as pt, SourceNode as q, createFunction as qt, createOutput as r, defineNode as rn, ContentNode as rt, createInput as s, DateSchemaNode as st, Node as t, DistributiveOmit as tn, importDef as tt, HttpMethod as u, IntersectionSchemaNode as ut, responseDef as v, SchemaNodeByType as vt, createParameter as w, createSchema as wt, requestBodyDef as x, TimeSchemaNode as xt, RequestBodyNode as y, SchemaType as yt, functionParameterDef as z, TextNode as zt };
2422
- //# sourceMappingURL=index-q_ldM1YP.d.ts.map
2428
+ //# sourceMappingURL=index-DJEyS5y6.d.ts.map
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_visitor = require("./visitor-CLLDwBvv.cjs");
3
- const require_defineMacro = require("./defineMacro-Bh5E_Il6.cjs");
2
+ const require_visitor = require("./visitor-CQdSiClY.cjs");
3
+ const require_defineMacro = require("./defineMacro-5Dvct8k_.cjs");
4
4
  //#region src/defineDialect.ts
5
5
  /**
6
6
  * Types a {@link Dialect} for an adapter. Adds no runtime behavior and only pins the
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { n as __name, t as __exportAll } from "./rolldown-runtime-CNktS9qV.js";
2
- import { a as defineMacro, c as VisitorContext, d as walk, f as schemaTypes, i as composeMacros, l as collect, n as Macro, o as ParentOf, r as applyMacros, s as Visitor, t as Enforce, u as transform } from "./defineMacro-D9ekmTW5.js";
3
- import { a as Dialect, i as createPrinter, n as PrinterFactoryOptions, o as SchemaDialect, r as PrinterPartial, s as defineDialect, t as Printer } from "./types-Df1jVmRy.js";
4
- import { $ as exportDef, $t as textDef, A as IndexedAccessTypeNode, At as InferSchemaNode, B as functionParametersDef, Bt as TypeNode, C as ParameterNode, Ct as UrlSchemaNode, D as FunctionParamNode, Dt as UserPropertyNode, E as FunctionParamKind, Et as PropertyNode, F as createFunctionParameters, Ft as ConstNode, G as FileNode, Gt as createBreak, H as objectBindingPatternDef, Ht as breakDef, I as createIndexedAccessType, It as FunctionNode, J as UserFileNode, Jt as createJsx, K as ImportNode, Kt as createConst, L as createObjectBindingPattern, Lt as JSDocNode, M as TypeExpression, Mt as ArrowFunctionNode, N as TypeLiteralNode, Nt as BreakNode, O as FunctionParameterNode, Ot as createProperty, P as createFunctionParameter, Pt as CodeNode, Q as createSource, Qt as jsxDef, R as createTypeLiteral, Rt as JsxNode, S as ParameterLocation, St as UnionSchemaNode, T as parameterDef, Tt as schemaDef, U as typeLiteralDef, Ut as constDef, V as indexedAccessTypeDef, Vt as arrowFunctionDef, W as ExportNode, Wt as createArrowFunction, X as createFile, Xt as createType, Y as createExport, Yt as createText, Z as createImport, Zt as functionDef, _ as createResponse, _t as SchemaNode, a as InputMeta, an as NodeKind, at as createContent, b as createRequestBody, bt as StringSchemaNode, c as inputDef, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, en as typeDef, et as fileDef, f as OperationNode, ft as ObjectSchemaNode, g as StatusCode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, i as outputDef, in as BaseNode, it as contentDef, j as ObjectBindingPatternNode, jt as ParserOptions, k as FunctionParametersNode, kt as propertyDef, l as GenericOperationNode, lt as EnumSchemaNode, m as operationDef, mt as RefSchemaNode, n as OutputNode, nn as NodeDef, nt as sourceDef, o as InputNode, ot as ArraySchemaNode, p as createOperation, pt as PrimitiveSchemaType, q as SourceNode, qt as createFunction, r as createOutput, rn as defineNode, rt as ContentNode, s as createInput, st as DateSchemaNode, t as Node, tn as DistributiveOmit, tt as importDef, u as HttpMethod, ut as IntersectionSchemaNode, v as responseDef, vt as SchemaNodeByType, w as createParameter, wt as createSchema, x as requestBodyDef, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, z as functionParameterDef, zt as TextNode } from "./index-q_ldM1YP.js";
5
- import { n as OperationParamsResolver } from "./operationParams-Dme8H-sR.js";
2
+ import { a as defineMacro, c as VisitorContext, d as walk, f as schemaTypes, i as composeMacros, l as collect, n as Macro, o as ParentOf, r as applyMacros, s as Visitor, t as Enforce, u as transform } from "./defineMacro-BXpTwp0y.js";
3
+ import { a as Dialect, i as createPrinter, n as PrinterFactoryOptions, o as SchemaDialect, r as PrinterPartial, s as defineDialect, t as Printer } from "./types-BsP1SK9j.js";
4
+ import { $ as exportDef, $t as textDef, A as IndexedAccessTypeNode, At as InferSchemaNode, B as functionParametersDef, Bt as TypeNode, C as ParameterNode, Ct as UrlSchemaNode, D as FunctionParamNode, Dt as UserPropertyNode, E as FunctionParamKind, Et as PropertyNode, F as createFunctionParameters, Ft as ConstNode, G as FileNode, Gt as createBreak, H as objectBindingPatternDef, Ht as breakDef, I as createIndexedAccessType, It as FunctionNode, J as UserFileNode, Jt as createJsx, K as ImportNode, Kt as createConst, L as createObjectBindingPattern, Lt as JSDocNode, M as TypeExpression, Mt as ArrowFunctionNode, N as TypeLiteralNode, Nt as BreakNode, O as FunctionParameterNode, Ot as createProperty, P as createFunctionParameter, Pt as CodeNode, Q as createSource, Qt as jsxDef, R as createTypeLiteral, Rt as JsxNode, S as ParameterLocation, St as UnionSchemaNode, T as parameterDef, Tt as schemaDef, U as typeLiteralDef, Ut as constDef, V as indexedAccessTypeDef, Vt as arrowFunctionDef, W as ExportNode, Wt as createArrowFunction, X as createFile, Xt as createType, Y as createExport, Yt as createText, Z as createImport, Zt as functionDef, _ as createResponse, _t as SchemaNode, a as InputMeta, an as NodeKind, at as createContent, b as createRequestBody, bt as StringSchemaNode, c as inputDef, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, en as typeDef, et as fileDef, f as OperationNode, ft as ObjectSchemaNode, g as StatusCode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, i as outputDef, in as BaseNode, it as contentDef, j as ObjectBindingPatternNode, jt as ParserOptions, k as FunctionParametersNode, kt as propertyDef, l as GenericOperationNode, lt as EnumSchemaNode, m as operationDef, mt as RefSchemaNode, n as OutputNode, nn as NodeDef, nt as sourceDef, o as InputNode, ot as ArraySchemaNode, p as createOperation, pt as PrimitiveSchemaType, q as SourceNode, qt as createFunction, r as createOutput, rn as defineNode, rt as ContentNode, s as createInput, st as DateSchemaNode, t as Node, tn as DistributiveOmit, tt as importDef, u as HttpMethod, ut as IntersectionSchemaNode, v as responseDef, vt as SchemaNodeByType, w as createParameter, wt as createSchema, x as requestBodyDef, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, z as functionParameterDef, zt as TextNode } from "./index-DJEyS5y6.js";
5
+ import { t as OperationParamsResolver } from "./operationParams-BaY12i2I.js";
6
6
 
7
7
  //#region src/guards.d.ts
8
8
  /**
@@ -59,7 +59,7 @@ declare function update<T extends Node>(node: T, changes: Partial<T>): T;
59
59
  * Every node definition. Adding a node means adding its `defineNode` to one
60
60
  * `nodes/*.ts` file and listing it here. The visitor tables in `visitor.ts` derive from it.
61
61
  */
62
- declare const nodeDefs: (NodeDef<PropertyNode, UserPropertyNode> | NodeDef<ConstNode, Omit<ConstNode, "kind">> | NodeDef<TypeNode, Omit<TypeNode, "kind">> | NodeDef<FunctionNode, Omit<FunctionNode, "kind">> | NodeDef<ArrowFunctionNode, Omit<ArrowFunctionNode, "kind">> | NodeDef<TextNode, string> | NodeDef<BreakNode, void> | NodeDef<JsxNode, string> | NodeDef<SchemaNode, (Omit<ObjectSchemaNode, "kind" | "primitive" | "properties"> & {
62
+ declare const nodeDefs: (NodeDef<PropertyNode, UserPropertyNode> | NodeDef<SchemaNode, (Omit<ObjectSchemaNode, "kind" | "primitive" | "properties"> & {
63
63
  properties?: Array<PropertyNode>;
64
64
  primitive?: "object";
65
65
  }) | DistributiveOmit<ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | (BaseNode & {
@@ -115,7 +115,7 @@ declare const nodeDefs: (NodeDef<PropertyNode, UserPropertyNode> | NodeDef<Const
115
115
  format?: string;
116
116
  } & {
117
117
  type: "ipv6";
118
- }) | ScalarSchemaNode, "kind">> | NodeDef<InputNode<false>, Partial<Omit<InputNode<false>, "kind">>> | NodeDef<OutputNode, Partial<Omit<OutputNode, "kind">>> | NodeDef<RequestBodyNode, Omit<RequestBodyNode, "kind">> | NodeDef<OperationNode, {
118
+ }) | ScalarSchemaNode, "kind">> | NodeDef<ConstNode, Omit<ConstNode, "kind">> | NodeDef<TypeNode, Omit<TypeNode, "kind">> | NodeDef<FunctionNode, Omit<FunctionNode, "kind">> | NodeDef<ArrowFunctionNode, Omit<ArrowFunctionNode, "kind">> | NodeDef<TextNode, string> | NodeDef<BreakNode, void> | NodeDef<JsxNode, string> | NodeDef<InputNode<false>, Partial<Omit<InputNode<false>, "kind">>> | NodeDef<OutputNode, Partial<Omit<OutputNode, "kind">>> | NodeDef<RequestBodyNode, Omit<RequestBodyNode, "kind">> | NodeDef<OperationNode, {
119
119
  [key: string]: unknown;
120
120
  operationId: string;
121
121
  method?: HttpOperationNode["method"];
@@ -127,7 +127,7 @@ declare const nodeDefs: (NodeDef<PropertyNode, UserPropertyNode> | NodeDef<Const
127
127
  mediaType?: string | null;
128
128
  keysToOmit?: Array<string> | null;
129
129
  }> | NodeDef<ParameterNode, Pick<ParameterNode, "name" | "schema" | "in"> & Partial<Omit<ParameterNode, "kind" | "name" | "schema" | "in">>> | NodeDef<ObjectBindingPatternNode, Pick<ObjectBindingPatternNode, "elements">> | NodeDef<TypeLiteralNode, Pick<TypeLiteralNode, "members">> | NodeDef<FunctionParameterNode, {
130
- name: string;
130
+ name: string | ObjectBindingPatternNode;
131
131
  type?: TypeExpression;
132
132
  optional?: boolean;
133
133
  default?: string;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-CNktS9qV.js";
2
- import { $ as createJsx, A as indexedAccessTypeDef, B as sourceDef, C as createFunctionParameter, D as createTypeLiteral, E as createObjectBindingPattern, F as createImport, G as createContent, I as createSource, J as constDef, K as arrowFunctionDef, L as exportDef, M as typeLiteralDef, N as createExport, O as functionParameterDef, P as createFile, Q as createFunction, R as fileDef, S as inputDef, T as createIndexedAccessType, W as contentDef, X as createBreak, Y as createArrowFunction, Z as createConst, _ as createOperation, a as nodeDefs, at as typeDef, b as requestBodyDef, c as createResponse, ct as isHttpOperationNode, d as propertyDef, dt as schemaTypes, et as createText, f as createParameter, g as outputDef, h as createOutput, i as walk, it as textDef, j as objectBindingPatternDef, k as functionParametersDef, l as responseDef, lt as narrowSchema, m as optionality, nt as functionDef, o as createSchema, ot as defineNode, p as parameterDef, q as breakDef, r as transform, rt as jsxDef, s as schemaDef, t as collect, tt as createType, u as createProperty, v as operationDef, w as createFunctionParameters, x as createInput, y as createRequestBody, z as importDef } from "./visitor-DG5ROqRx.js";
3
- import { n as composeMacros, r as defineMacro, t as applyMacros } from "./defineMacro-CVrU3ajV.js";
2
+ import { $ as createJsx, A as indexedAccessTypeDef, B as sourceDef, C as createFunctionParameter, D as createTypeLiteral, E as createObjectBindingPattern, F as createImport, G as createContent, I as createSource, J as constDef, K as arrowFunctionDef, L as exportDef, M as typeLiteralDef, N as createExport, O as functionParameterDef, P as createFile, Q as createFunction, R as fileDef, S as inputDef, T as createIndexedAccessType, W as contentDef, X as createBreak, Y as createArrowFunction, Z as createConst, _ as createOperation, a as nodeDefs, at as typeDef, b as requestBodyDef, c as createResponse, ct as isHttpOperationNode, d as propertyDef, dt as schemaTypes, et as createText, f as createParameter, g as outputDef, h as createOutput, i as walk, it as textDef, j as objectBindingPatternDef, k as functionParametersDef, l as responseDef, lt as narrowSchema, m as optionality, nt as functionDef, o as createSchema, ot as defineNode, p as parameterDef, q as breakDef, r as transform, rt as jsxDef, s as schemaDef, t as collect, tt as createType, u as createProperty, v as operationDef, w as createFunctionParameters, x as createInput, y as createRequestBody, z as importDef } from "./visitor-dcVC5TOW.js";
3
+ import { n as composeMacros, r as defineMacro, t as applyMacros } from "./defineMacro-VfsvblGi.js";
4
4
  //#region src/defineDialect.ts
5
5
  /**
6
6
  * Types a {@link Dialect} for an adapter. Adds no runtime behavior and only pins the
package/dist/macros.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_visitor = require("./visitor-CLLDwBvv.cjs");
3
- const require_defineMacro = require("./defineMacro-Bh5E_Il6.cjs");
4
- const require_refs = require("./refs-8IwpesXW.cjs");
2
+ const require_visitor = require("./visitor-CQdSiClY.cjs");
3
+ const require_defineMacro = require("./defineMacro-5Dvct8k_.cjs");
4
+ const require_refs = require("./refs-DuP3_Leg.cjs");
5
5
  //#region src/macros/macroDiscriminatorEnum.ts
6
6
  /**
7
7
  * Builds a macro that replaces a discriminator property's schema with a string enum of the given
package/dist/macros.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
2
- import { n as Macro } from "./defineMacro-D9ekmTW5.js";
2
+ import { n as Macro } from "./defineMacro-BXpTwp0y.js";
3
3
 
4
4
  //#region src/macros/macroDiscriminatorEnum.d.ts
5
5
  type Props$1 = {
package/dist/macros.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import "./rolldown-runtime-CNktS9qV.js";
2
- import { lt as narrowSchema, o as createSchema, u as createProperty } from "./visitor-DG5ROqRx.js";
3
- import { r as defineMacro } from "./defineMacro-CVrU3ajV.js";
4
- import { n as enumPropName } from "./refs-D2qwT5ck.js";
2
+ import { lt as narrowSchema, o as createSchema, u as createProperty } from "./visitor-dcVC5TOW.js";
3
+ import { r as defineMacro } from "./defineMacro-VfsvblGi.js";
4
+ import { n as enumPropName } from "./refs-D18OeCgb.js";
5
5
  //#region src/macros/macroDiscriminatorEnum.ts
6
6
  /**
7
7
  * Builds a macro that replaces a discriminator property's schema with a string enum of the given
@@ -1,5 +1,5 @@
1
1
  import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
2
- import { C as ParameterNode, M as TypeExpression, N as TypeLiteralNode, O as FunctionParameterNode, f as OperationNode, k as FunctionParametersNode } from "./index-q_ldM1YP.js";
2
+ import { C as ParameterNode, O as FunctionParameterNode, f as OperationNode, k as FunctionParametersNode } from "./index-DJEyS5y6.js";
3
3
 
4
4
  //#region src/utils/operationParams.d.ts
5
5
  /**
@@ -10,19 +10,6 @@ import { C as ParameterNode, M as TypeExpression, N as TypeLiteralNode, O as Fun
10
10
  * original array is returned unchanged.
11
11
  */
12
12
  declare function caseParams(params: Array<ParameterNode>, casing: 'camelcase' | undefined): Array<ParameterNode>;
13
- /**
14
- * Named type for a group of parameters (query or header) emitted as a single typed parameter.
15
- */
16
- type ParamGroupType = {
17
- /**
18
- * Type expression for the group, a plain group-name reference.
19
- */
20
- type: TypeExpression;
21
- /**
22
- * Whether the parameter group is optional.
23
- */
24
- optional: boolean;
25
- };
26
13
  /**
27
14
  * Resolver interface for {@link createOperationParams}.
28
15
  *
@@ -147,22 +134,6 @@ type CreateOperationParamsOptions = {
147
134
  */
148
135
  typeWrapper?: (type: string) => string;
149
136
  };
150
- /**
151
- * Resolves the {@link TypeExpression} for an individual parameter.
152
- *
153
- * Without a resolver, it falls back to the schema primitive (a plain type-name string). When the
154
- * parameter belongs to a named group, it emits an {@link IndexedAccessTypeNode} like
155
- * `GroupParams['petId']`, otherwise the resolved individual name.
156
- */
157
- declare function resolveParamType({
158
- node,
159
- param,
160
- resolver
161
- }: {
162
- node: OperationNode;
163
- param: ParameterNode;
164
- resolver: OperationParamsResolver | undefined;
165
- }): TypeExpression;
166
137
  /**
167
138
  * Converts an `OperationNode` into function parameters for code generation.
168
139
  *
@@ -172,40 +143,6 @@ declare function resolveParamType({
172
143
  * name resolution and `extraParams` for plugin-specific trailing parameters such as an `options` object.
173
144
  */
174
145
  declare function createOperationParams(node: OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode;
175
- /**
176
- * Shared arguments for building a query or header parameter group.
177
- */
178
- type BuildGroupArgs = {
179
- name: string;
180
- node: OperationNode;
181
- params: Array<ParameterNode>;
182
- groupType: ParamGroupType | null;
183
- resolver: OperationParamsResolver | undefined;
184
- wrapType: (type: string) => string;
185
- };
186
- /**
187
- * Builds a single {@link FunctionParameterNode} for a query or header group.
188
- * Returns an empty array when there are no params to emit.
189
- *
190
- * A pre-resolved `groupType` emits `name: GroupType`. Otherwise it builds an inline
191
- * {@link TypeLiteralNode} from the individual params.
192
- */
193
- declare function buildGroupParam(args: BuildGroupArgs): Array<FunctionParameterNode>;
194
- /**
195
- * Builds a {@link TypeLiteralNode} for an inline anonymous type grouping named fields.
196
- *
197
- * Used when query or header parameters have no dedicated group type name.
198
- * Each language printer renders this appropriately (TypeScript: `{ petId: string; name?: string }`).
199
- */
200
- declare function buildTypeLiteral({
201
- node,
202
- params,
203
- resolver
204
- }: {
205
- node: OperationNode;
206
- params: Array<ParameterNode>;
207
- resolver: OperationParamsResolver | undefined;
208
- }): TypeLiteralNode;
209
146
  //#endregion
210
- export { buildTypeLiteral as a, resolveParamType as c, buildGroupParam as i, OperationParamsResolver as n, caseParams as o, ParamGroupType as r, createOperationParams as s, BuildGroupArgs as t };
211
- //# sourceMappingURL=operationParams-Dme8H-sR.d.ts.map
147
+ export { caseParams as n, createOperationParams as r, OperationParamsResolver as t };
148
+ //# sourceMappingURL=operationParams-BaY12i2I.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import "./rolldown-runtime-CNktS9qV.js";
2
- import { U as pascalCase, lt as narrowSchema, o as createSchema } from "./visitor-DG5ROqRx.js";
2
+ import { U as pascalCase, lt as narrowSchema, o as createSchema } from "./visitor-dcVC5TOW.js";
3
3
  //#region src/utils/refs.ts
4
4
  const plainStringTypes = new Set([
5
5
  "string",
@@ -114,4 +114,4 @@ function resolveGroupType({ node, params, group, resolver }) {
114
114
  //#endregion
115
115
  export { resolveGroupType as a, isStringType as i, enumPropName as n, resolveRefName as o, extractRefName as r, syncSchemaRef as s, childName as t };
116
116
 
117
- //# sourceMappingURL=refs-D2qwT5ck.js.map
117
+ //# sourceMappingURL=refs-D18OeCgb.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"refs-D2qwT5ck.js","names":[],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { narrowSchema } from '../guards.ts'\nimport type { OperationNode, ParameterNode, SchemaNode } from '../nodes/index.ts'\nimport { createSchema, type SchemaType } from '../nodes/schema.ts'\nimport type { OperationParamsResolver, ParamGroupType } from './operationParams.ts'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/**\n * Returns the last path segment of a reference string.\n *\n * @example\n * `extractRefName('#/components/schemas/Pet') // 'Pet'`\n */\nexport function extractRefName(ref: string): string {\n return ref.split('/').at(-1) ?? ref\n}\n\n/**\n * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls\n * back to `name` then nested `schema.name`.\n *\n * Returns `null` for non-ref nodes or when no name resolves.\n *\n * @example\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`\n */\nexport function resolveRefName(node: SchemaNode | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.ref) return extractRefName(node.ref) ?? node.name ?? node.schema?.name ?? null\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n\n/**\n * Merges a ref node with its resolved schema, giving usage-site fields precedence.\n *\n * Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the\n * same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`,\n * `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref\n * nodes and refs without a resolved `schema` are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n\n if (!ref) return node\n if (!ref.schema) return node\n\n const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref\n\n // Filter out undefined override values so they don't shadow the resolved schema's fields.\n const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== undefined))\n\n return createSchema({ ...ref.schema, ...definedOverrides })\n}\n\n/**\n * Type guard that returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n\n/**\n * Derives a {@link ParamGroupType} for a query or header group from the resolver.\n *\n * Returns `null` when there is no resolver, no params, or the group name equals the\n * individual param name (so there is no real group to emit).\n */\nexport function resolveGroupType({\n node,\n params,\n group,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n group: 'query' | 'header'\n resolver: OperationParamsResolver | undefined\n}): ParamGroupType | null {\n if (!resolver || !params.length) {\n return null\n }\n const firstParam = params[0]!\n const groupMethod = group === 'query' ? resolver.resolveQueryParamsName : resolver.resolveHeaderParamsName\n const groupName = groupMethod.call(resolver, node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) {\n return null\n }\n return { type: groupName, optional: params.every((p) => !p.required) }\n}\n"],"mappings":";;;AAMA,MAAM,mBAAmB,IAAI,IAAgB;CAAC;CAAU;CAAQ;CAAS;CAAO;AAAU,CAAU;;;;;;;AAQpG,SAAgB,eAAe,KAAqB;CAClD,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;AAClC;;;;;;;;;;AAWA,SAAgB,eAAe,MAA6C;CAC1E,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,KAAK,OAAO,eAAe,KAAK,GAAG,KAAK,KAAK,QAAQ,KAAK,QAAQ,QAAQ;CAEnF,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;;;AAYA,SAAgB,UAAU,YAAuC,UAAiC;CAChG,OAAO,aAAa,WAAW,CAAC,YAAY,QAAQ,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI;AACrE;;;;;;;;AASA,SAAgB,aAAa,YAAuC,UAAkB,YAA4B;CAChH,OAAO,WAAW;EAAC;EAAY;EAAU;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC;AAChF;;;;;;;;;;;;;;;AAgBA,SAAgB,cAAc,MAA8B;CAC1D,MAAM,MAAM,aAAa,MAAM,KAAK;CAEpC,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,CAAC,IAAI,QAAQ,OAAO;CAExB,MAAM,EAAE,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,KAAK,MAAM,QAAQ,SAAS,GAAG,cAAc;CAG5F,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,SAAS,CAAC,CAAC,QAAQ,GAAG,OAAO,MAAM,KAAA,CAAS,CAAC;CAExG,OAAO,aAAa;EAAE,GAAG,IAAI;EAAQ,GAAG;CAAiB,CAAC;AAC5D;;;;;;;AAQA,SAAgB,aAAa,MAA2B;CACtD,IAAI,iBAAiB,IAAI,KAAK,IAAI,GAChC,OAAO;CAGT,MAAM,WAAW,aAAa,MAAM,MAAM,KAAK,aAAa,MAAM,MAAM;CACxE,IAAI,UACF,OAAO,SAAS,mBAAmB;CAGrC,OAAO;AACT;;;;;;;AAQA,SAAgB,iBAAiB,EAC/B,MACA,QACA,OACA,YAMwB;CACxB,IAAI,CAAC,YAAY,CAAC,OAAO,QACvB,OAAO;CAET,MAAM,aAAa,OAAO;CAE1B,MAAM,aADc,UAAU,UAAU,SAAS,yBAAyB,SAAS,wBAAA,CACrD,KAAK,UAAU,MAAM,UAAU;CAC7D,IAAI,cAAc,SAAS,iBAAiB,MAAM,UAAU,GAC1D,OAAO;CAET,OAAO;EAAE,MAAM;EAAW,UAAU,OAAO,OAAO,MAAM,CAAC,EAAE,QAAQ;CAAE;AACvE"}
1
+ {"version":3,"file":"refs-D18OeCgb.js","names":[],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { narrowSchema } from '../guards.ts'\nimport type { OperationNode, ParameterNode, SchemaNode } from '../nodes/index.ts'\nimport { createSchema, type SchemaType } from '../nodes/schema.ts'\nimport type { OperationParamsResolver, ParamGroupType } from './operationParams.ts'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/**\n * Returns the last path segment of a reference string.\n *\n * @example\n * `extractRefName('#/components/schemas/Pet') // 'Pet'`\n */\nexport function extractRefName(ref: string): string {\n return ref.split('/').at(-1) ?? ref\n}\n\n/**\n * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls\n * back to `name` then nested `schema.name`.\n *\n * Returns `null` for non-ref nodes or when no name resolves.\n *\n * @example\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`\n */\nexport function resolveRefName(node: SchemaNode | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.ref) return extractRefName(node.ref) ?? node.name ?? node.schema?.name ?? null\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n\n/**\n * Merges a ref node with its resolved schema, giving usage-site fields precedence.\n *\n * Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the\n * same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`,\n * `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref\n * nodes and refs without a resolved `schema` are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n\n if (!ref) return node\n if (!ref.schema) return node\n\n const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref\n\n // Filter out undefined override values so they don't shadow the resolved schema's fields.\n const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== undefined))\n\n return createSchema({ ...ref.schema, ...definedOverrides })\n}\n\n/**\n * Type guard that returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n\n/**\n * Derives a {@link ParamGroupType} for a query or header group from the resolver.\n *\n * Returns `null` when there is no resolver, no params, or the group name equals the\n * individual param name (so there is no real group to emit).\n */\nexport function resolveGroupType({\n node,\n params,\n group,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n group: 'query' | 'header'\n resolver: OperationParamsResolver | undefined\n}): ParamGroupType | null {\n if (!resolver || !params.length) {\n return null\n }\n const firstParam = params[0]!\n const groupMethod = group === 'query' ? resolver.resolveQueryParamsName : resolver.resolveHeaderParamsName\n const groupName = groupMethod.call(resolver, node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) {\n return null\n }\n return { type: groupName, optional: params.every((p) => !p.required) }\n}\n"],"mappings":";;;AAMA,MAAM,mBAAmB,IAAI,IAAgB;CAAC;CAAU;CAAQ;CAAS;CAAO;AAAU,CAAU;;;;;;;AAQpG,SAAgB,eAAe,KAAqB;CAClD,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;AAClC;;;;;;;;;;AAWA,SAAgB,eAAe,MAA6C;CAC1E,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,KAAK,OAAO,eAAe,KAAK,GAAG,KAAK,KAAK,QAAQ,KAAK,QAAQ,QAAQ;CAEnF,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;;;AAYA,SAAgB,UAAU,YAAuC,UAAiC;CAChG,OAAO,aAAa,WAAW,CAAC,YAAY,QAAQ,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI;AACrE;;;;;;;;AASA,SAAgB,aAAa,YAAuC,UAAkB,YAA4B;CAChH,OAAO,WAAW;EAAC;EAAY;EAAU;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC;AAChF;;;;;;;;;;;;;;;AAgBA,SAAgB,cAAc,MAA8B;CAC1D,MAAM,MAAM,aAAa,MAAM,KAAK;CAEpC,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,CAAC,IAAI,QAAQ,OAAO;CAExB,MAAM,EAAE,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,KAAK,MAAM,QAAQ,SAAS,GAAG,cAAc;CAG5F,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,SAAS,CAAC,CAAC,QAAQ,GAAG,OAAO,MAAM,KAAA,CAAS,CAAC;CAExG,OAAO,aAAa;EAAE,GAAG,IAAI;EAAQ,GAAG;CAAiB,CAAC;AAC5D;;;;;;;AAQA,SAAgB,aAAa,MAA2B;CACtD,IAAI,iBAAiB,IAAI,KAAK,IAAI,GAChC,OAAO;CAGT,MAAM,WAAW,aAAa,MAAM,MAAM,KAAK,aAAa,MAAM,MAAM;CACxE,IAAI,UACF,OAAO,SAAS,mBAAmB;CAGrC,OAAO;AACT;;;;;;;AAQA,SAAgB,iBAAiB,EAC/B,MACA,QACA,OACA,YAMwB;CACxB,IAAI,CAAC,YAAY,CAAC,OAAO,QACvB,OAAO;CAET,MAAM,aAAa,OAAO;CAE1B,MAAM,aADc,UAAU,UAAU,SAAS,yBAAyB,SAAS,wBAAA,CACrD,KAAK,UAAU,MAAM,UAAU;CAC7D,IAAI,cAAc,SAAS,iBAAiB,MAAM,UAAU,GAC1D,OAAO;CAET,OAAO;EAAE,MAAM;EAAW,UAAU,OAAO,OAAO,MAAM,CAAC,EAAE,QAAQ;CAAE;AACvE"}
@@ -1,4 +1,4 @@
1
- const require_visitor = require("./visitor-CLLDwBvv.cjs");
1
+ const require_visitor = require("./visitor-CQdSiClY.cjs");
2
2
  //#region src/utils/refs.ts
3
3
  const plainStringTypes = new Set([
4
4
  "string",
@@ -154,4 +154,4 @@ Object.defineProperty(exports, "syncSchemaRef", {
154
154
  }
155
155
  });
156
156
 
157
- //# sourceMappingURL=refs-8IwpesXW.cjs.map
157
+ //# sourceMappingURL=refs-DuP3_Leg.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"refs-8IwpesXW.cjs","names":["pascalCase","narrowSchema","createSchema"],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { narrowSchema } from '../guards.ts'\nimport type { OperationNode, ParameterNode, SchemaNode } from '../nodes/index.ts'\nimport { createSchema, type SchemaType } from '../nodes/schema.ts'\nimport type { OperationParamsResolver, ParamGroupType } from './operationParams.ts'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/**\n * Returns the last path segment of a reference string.\n *\n * @example\n * `extractRefName('#/components/schemas/Pet') // 'Pet'`\n */\nexport function extractRefName(ref: string): string {\n return ref.split('/').at(-1) ?? ref\n}\n\n/**\n * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls\n * back to `name` then nested `schema.name`.\n *\n * Returns `null` for non-ref nodes or when no name resolves.\n *\n * @example\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`\n */\nexport function resolveRefName(node: SchemaNode | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.ref) return extractRefName(node.ref) ?? node.name ?? node.schema?.name ?? null\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n\n/**\n * Merges a ref node with its resolved schema, giving usage-site fields precedence.\n *\n * Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the\n * same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`,\n * `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref\n * nodes and refs without a resolved `schema` are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n\n if (!ref) return node\n if (!ref.schema) return node\n\n const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref\n\n // Filter out undefined override values so they don't shadow the resolved schema's fields.\n const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== undefined))\n\n return createSchema({ ...ref.schema, ...definedOverrides })\n}\n\n/**\n * Type guard that returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n\n/**\n * Derives a {@link ParamGroupType} for a query or header group from the resolver.\n *\n * Returns `null` when there is no resolver, no params, or the group name equals the\n * individual param name (so there is no real group to emit).\n */\nexport function resolveGroupType({\n node,\n params,\n group,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n group: 'query' | 'header'\n resolver: OperationParamsResolver | undefined\n}): ParamGroupType | null {\n if (!resolver || !params.length) {\n return null\n }\n const firstParam = params[0]!\n const groupMethod = group === 'query' ? resolver.resolveQueryParamsName : resolver.resolveHeaderParamsName\n const groupName = groupMethod.call(resolver, node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) {\n return null\n }\n return { type: groupName, optional: params.every((p) => !p.required) }\n}\n"],"mappings":";;AAMA,MAAM,mBAAmB,IAAI,IAAgB;CAAC;CAAU;CAAQ;CAAS;CAAO;AAAU,CAAU;;;;;;;AAQpG,SAAgB,eAAe,KAAqB;CAClD,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;AAClC;;;;;;;;;;AAWA,SAAgB,eAAe,MAA6C;CAC1E,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,KAAK,OAAO,eAAe,KAAK,GAAG,KAAK,KAAK,QAAQ,KAAK,QAAQ,QAAQ;CAEnF,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;;;AAYA,SAAgB,UAAU,YAAuC,UAAiC;CAChG,OAAO,aAAaA,gBAAAA,WAAW,CAAC,YAAY,QAAQ,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI;AACrE;;;;;;;;AASA,SAAgB,aAAa,YAAuC,UAAkB,YAA4B;CAChH,OAAOA,gBAAAA,WAAW;EAAC;EAAY;EAAU;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC;AAChF;;;;;;;;;;;;;;;AAgBA,SAAgB,cAAc,MAA8B;CAC1D,MAAM,MAAMC,gBAAAA,aAAa,MAAM,KAAK;CAEpC,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,CAAC,IAAI,QAAQ,OAAO;CAExB,MAAM,EAAE,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,KAAK,MAAM,QAAQ,SAAS,GAAG,cAAc;CAG5F,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,SAAS,CAAC,CAAC,QAAQ,GAAG,OAAO,MAAM,KAAA,CAAS,CAAC;CAExG,OAAOC,gBAAAA,aAAa;EAAE,GAAG,IAAI;EAAQ,GAAG;CAAiB,CAAC;AAC5D;;;;;;;AAQA,SAAgB,aAAa,MAA2B;CACtD,IAAI,iBAAiB,IAAI,KAAK,IAAI,GAChC,OAAO;CAGT,MAAM,WAAWD,gBAAAA,aAAa,MAAM,MAAM,KAAKA,gBAAAA,aAAa,MAAM,MAAM;CACxE,IAAI,UACF,OAAO,SAAS,mBAAmB;CAGrC,OAAO;AACT;;;;;;;AAQA,SAAgB,iBAAiB,EAC/B,MACA,QACA,OACA,YAMwB;CACxB,IAAI,CAAC,YAAY,CAAC,OAAO,QACvB,OAAO;CAET,MAAM,aAAa,OAAO;CAE1B,MAAM,aADc,UAAU,UAAU,SAAS,yBAAyB,SAAS,wBAAA,CACrD,KAAK,UAAU,MAAM,UAAU;CAC7D,IAAI,cAAc,SAAS,iBAAiB,MAAM,UAAU,GAC1D,OAAO;CAET,OAAO;EAAE,MAAM;EAAW,UAAU,OAAO,OAAO,MAAM,CAAC,EAAE,QAAQ;CAAE;AACvE"}
1
+ {"version":3,"file":"refs-DuP3_Leg.cjs","names":["pascalCase","narrowSchema","createSchema"],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { narrowSchema } from '../guards.ts'\nimport type { OperationNode, ParameterNode, SchemaNode } from '../nodes/index.ts'\nimport { createSchema, type SchemaType } from '../nodes/schema.ts'\nimport type { OperationParamsResolver, ParamGroupType } from './operationParams.ts'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/**\n * Returns the last path segment of a reference string.\n *\n * @example\n * `extractRefName('#/components/schemas/Pet') // 'Pet'`\n */\nexport function extractRefName(ref: string): string {\n return ref.split('/').at(-1) ?? ref\n}\n\n/**\n * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls\n * back to `name` then nested `schema.name`.\n *\n * Returns `null` for non-ref nodes or when no name resolves.\n *\n * @example\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`\n */\nexport function resolveRefName(node: SchemaNode | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.ref) return extractRefName(node.ref) ?? node.name ?? node.schema?.name ?? null\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n\n/**\n * Merges a ref node with its resolved schema, giving usage-site fields precedence.\n *\n * Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the\n * same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`,\n * `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref\n * nodes and refs without a resolved `schema` are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n\n if (!ref) return node\n if (!ref.schema) return node\n\n const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref\n\n // Filter out undefined override values so they don't shadow the resolved schema's fields.\n const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== undefined))\n\n return createSchema({ ...ref.schema, ...definedOverrides })\n}\n\n/**\n * Type guard that returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n\n/**\n * Derives a {@link ParamGroupType} for a query or header group from the resolver.\n *\n * Returns `null` when there is no resolver, no params, or the group name equals the\n * individual param name (so there is no real group to emit).\n */\nexport function resolveGroupType({\n node,\n params,\n group,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n group: 'query' | 'header'\n resolver: OperationParamsResolver | undefined\n}): ParamGroupType | null {\n if (!resolver || !params.length) {\n return null\n }\n const firstParam = params[0]!\n const groupMethod = group === 'query' ? resolver.resolveQueryParamsName : resolver.resolveHeaderParamsName\n const groupName = groupMethod.call(resolver, node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) {\n return null\n }\n return { type: groupName, optional: params.every((p) => !p.required) }\n}\n"],"mappings":";;AAMA,MAAM,mBAAmB,IAAI,IAAgB;CAAC;CAAU;CAAQ;CAAS;CAAO;AAAU,CAAU;;;;;;;AAQpG,SAAgB,eAAe,KAAqB;CAClD,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;AAClC;;;;;;;;;;AAWA,SAAgB,eAAe,MAA6C;CAC1E,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,KAAK,OAAO,eAAe,KAAK,GAAG,KAAK,KAAK,QAAQ,KAAK,QAAQ,QAAQ;CAEnF,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;;;AAYA,SAAgB,UAAU,YAAuC,UAAiC;CAChG,OAAO,aAAaA,gBAAAA,WAAW,CAAC,YAAY,QAAQ,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI;AACrE;;;;;;;;AASA,SAAgB,aAAa,YAAuC,UAAkB,YAA4B;CAChH,OAAOA,gBAAAA,WAAW;EAAC;EAAY;EAAU;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC;AAChF;;;;;;;;;;;;;;;AAgBA,SAAgB,cAAc,MAA8B;CAC1D,MAAM,MAAMC,gBAAAA,aAAa,MAAM,KAAK;CAEpC,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,CAAC,IAAI,QAAQ,OAAO;CAExB,MAAM,EAAE,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,KAAK,MAAM,QAAQ,SAAS,GAAG,cAAc;CAG5F,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,SAAS,CAAC,CAAC,QAAQ,GAAG,OAAO,MAAM,KAAA,CAAS,CAAC;CAExG,OAAOC,gBAAAA,aAAa;EAAE,GAAG,IAAI;EAAQ,GAAG;CAAiB,CAAC;AAC5D;;;;;;;AAQA,SAAgB,aAAa,MAA2B;CACtD,IAAI,iBAAiB,IAAI,KAAK,IAAI,GAChC,OAAO;CAGT,MAAM,WAAWD,gBAAAA,aAAa,MAAM,MAAM,KAAKA,gBAAAA,aAAa,MAAM,MAAM;CACxE,IAAI,UACF,OAAO,SAAS,mBAAmB;CAGrC,OAAO;AACT;;;;;;;AAQA,SAAgB,iBAAiB,EAC/B,MACA,QACA,OACA,YAMwB;CACxB,IAAI,CAAC,YAAY,CAAC,OAAO,QACvB,OAAO;CAET,MAAM,aAAa,OAAO;CAE1B,MAAM,aADc,UAAU,UAAU,SAAS,yBAAyB,SAAS,wBAAA,CACrD,KAAK,UAAU,MAAM,UAAU;CAC7D,IAAI,cAAc,SAAS,iBAAiB,MAAM,UAAU,GAC1D,OAAO;CAET,OAAO;EAAE,MAAM;EAAW,UAAU,OAAO,OAAO,MAAM,CAAC,EAAE,QAAQ;CAAE;AACvE"}
@@ -1,5 +1,5 @@
1
1
  import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
2
- import { _t as SchemaNode, vt as SchemaNodeByType, yt as SchemaType } from "./index-q_ldM1YP.js";
2
+ import { _t as SchemaNode, vt as SchemaNodeByType, yt as SchemaType } from "./index-DJEyS5y6.js";
3
3
 
4
4
  //#region src/defineDialect.d.ts
5
5
  /**
@@ -241,4 +241,4 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
241
241
  declare function createPrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
242
242
  //#endregion
243
243
  export { Dialect as a, createPrinter as i, PrinterFactoryOptions as n, SchemaDialect as o, PrinterPartial as r, defineDialect as s, Printer as t };
244
- //# sourceMappingURL=types-Df1jVmRy.d.ts.map
244
+ //# sourceMappingURL=types-BsP1SK9j.d.ts.map
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { c as VisitorContext, n as Macro, o as ParentOf, s as Visitor, t as Enforce } from "./defineMacro-D9ekmTW5.js";
2
- import { a as Dialect, n as PrinterFactoryOptions, o as SchemaDialect, r as PrinterPartial, t as Printer } from "./types-Df1jVmRy.js";
3
- import { A as IndexedAccessTypeNode, At as InferSchemaNode, Bt as TypeNode, C as ParameterNode, Ct as UrlSchemaNode, D as FunctionParamNode, E as FunctionParamKind, Et as PropertyNode, Ft as ConstNode, G as FileNode, It as FunctionNode, J as UserFileNode, K as ImportNode, Lt as JSDocNode, M as TypeExpression, Mt as ArrowFunctionNode, N as TypeLiteralNode, Nt as BreakNode, O as FunctionParameterNode, Pt as CodeNode, Rt as JsxNode, S as ParameterLocation, St as UnionSchemaNode, W as ExportNode, _t as SchemaNode, a as InputMeta, an as NodeKind, bt as StringSchemaNode, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, f as OperationNode, ft as ObjectSchemaNode, g as StatusCode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, j as ObjectBindingPatternNode, jt as ParserOptions, k as FunctionParametersNode, l as GenericOperationNode, lt as EnumSchemaNode, mt as RefSchemaNode, n as OutputNode, nn as NodeDef, o as InputNode, ot as ArraySchemaNode, pt as PrimitiveSchemaType, q as SourceNode, rt as ContentNode, st as DateSchemaNode, t as Node, tn as DistributiveOmit, u as HttpMethod, ut as IntersectionSchemaNode, vt as SchemaNodeByType, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, zt as TextNode } from "./index-q_ldM1YP.js";
4
- import { n as OperationParamsResolver } from "./operationParams-Dme8H-sR.js";
1
+ import { c as VisitorContext, n as Macro, o as ParentOf, s as Visitor, t as Enforce } from "./defineMacro-BXpTwp0y.js";
2
+ import { a as Dialect, n as PrinterFactoryOptions, o as SchemaDialect, r as PrinterPartial, t as Printer } from "./types-BsP1SK9j.js";
3
+ import { A as IndexedAccessTypeNode, At as InferSchemaNode, Bt as TypeNode, C as ParameterNode, Ct as UrlSchemaNode, D as FunctionParamNode, E as FunctionParamKind, Et as PropertyNode, Ft as ConstNode, G as FileNode, It as FunctionNode, J as UserFileNode, K as ImportNode, Lt as JSDocNode, M as TypeExpression, Mt as ArrowFunctionNode, N as TypeLiteralNode, Nt as BreakNode, O as FunctionParameterNode, Pt as CodeNode, Rt as JsxNode, S as ParameterLocation, St as UnionSchemaNode, W as ExportNode, _t as SchemaNode, a as InputMeta, an as NodeKind, bt as StringSchemaNode, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, f as OperationNode, ft as ObjectSchemaNode, g as StatusCode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, j as ObjectBindingPatternNode, jt as ParserOptions, k as FunctionParametersNode, l as GenericOperationNode, lt as EnumSchemaNode, mt as RefSchemaNode, n as OutputNode, nn as NodeDef, o as InputNode, ot as ArraySchemaNode, pt as PrimitiveSchemaType, q as SourceNode, rt as ContentNode, st as DateSchemaNode, t as Node, tn as DistributiveOmit, u as HttpMethod, ut as IntersectionSchemaNode, vt as SchemaNodeByType, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, zt as TextNode } from "./index-DJEyS5y6.js";
4
+ import { t as OperationParamsResolver } from "./operationParams-BaY12i2I.js";
5
5
  export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, Dialect, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, FunctionParamKind, FunctionParamNode, FunctionParameterNode, FunctionParametersNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, IndexedAccessTypeNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectBindingPatternNode, ObjectSchemaNode, OperationNode, OperationParamsResolver, OutputNode, ParameterLocation, ParameterNode, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaDialect, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeExpression, TypeLiteralNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext };
package/dist/utils.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_visitor = require("./visitor-CLLDwBvv.cjs");
3
- const require_refs = require("./refs-8IwpesXW.cjs");
2
+ const require_visitor = require("./visitor-CQdSiClY.cjs");
3
+ const require_refs = require("./refs-DuP3_Leg.cjs");
4
4
  //#region ../../internals/utils/src/promise.ts
5
5
  /**
6
6
  * Wraps `factory` with a keyed cache backed by the provided store.
@@ -772,11 +772,9 @@ function buildTypeLiteral({ node, params, resolver }) {
772
772
  })) });
773
773
  }
774
774
  //#endregion
775
- exports.buildGroupParam = buildGroupParam;
776
775
  exports.buildJSDoc = buildJSDoc;
777
776
  exports.buildList = buildList;
778
777
  exports.buildObject = buildObject;
779
- exports.buildTypeLiteral = buildTypeLiteral;
780
778
  exports.caseParams = caseParams;
781
779
  exports.childName = require_refs.childName;
782
780
  exports.collectUsedSchemaNames = collectUsedSchemaNames;
@@ -796,9 +794,6 @@ exports.mapSchemaMembers = mapSchemaMembers;
796
794
  exports.mapSchemaProperties = mapSchemaProperties;
797
795
  exports.mergeAdjacentObjectsLazy = mergeAdjacentObjectsLazy;
798
796
  exports.objectKey = objectKey;
799
- exports.resolveGroupType = require_refs.resolveGroupType;
800
- exports.resolveParamType = resolveParamType;
801
- exports.resolveRefName = require_refs.resolveRefName;
802
797
  exports.stringify = stringify;
803
798
  exports.stringifyObject = stringifyObject;
804
799
  exports.syncSchemaRef = require_refs.syncSchemaRef;
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
2
- import { C as ParameterNode, Et as PropertyNode, Pt as CodeNode, St as UnionSchemaNode, _t as SchemaNode, f as OperationNode, ft as ObjectSchemaNode, ot as ArraySchemaNode, ut as IntersectionSchemaNode } from "./index-q_ldM1YP.js";
3
- import { a as buildTypeLiteral, c as resolveParamType, i as buildGroupParam, n as OperationParamsResolver, o as caseParams, r as ParamGroupType, s as createOperationParams, t as BuildGroupArgs } from "./operationParams-Dme8H-sR.js";
2
+ import { Et as PropertyNode, Pt as CodeNode, St as UnionSchemaNode, _t as SchemaNode, f as OperationNode, ft as ObjectSchemaNode, ot as ArraySchemaNode, ut as IntersectionSchemaNode } from "./index-DJEyS5y6.js";
3
+ import { n as caseParams, r as createOperationParams } from "./operationParams-BaY12i2I.js";
4
4
 
5
5
  //#region ../../internals/utils/src/reserved.d.ts
6
6
  /**
@@ -97,16 +97,6 @@ declare function extractStringsFromNodes(nodes: Array<CodeNode> | undefined): st
97
97
  * `extractRefName('#/components/schemas/Pet') // 'Pet'`
98
98
  */
99
99
  declare function extractRefName(ref: string): string;
100
- /**
101
- * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls
102
- * back to `name` then nested `schema.name`.
103
- *
104
- * Returns `null` for non-ref nodes or when no name resolves.
105
- *
106
- * @example
107
- * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`
108
- */
109
- declare function resolveRefName(node: SchemaNode | undefined): string | null;
110
100
  /**
111
101
  * Builds a PascalCase child schema name by joining a parent name and property name.
112
102
  * Returns `null` when there is no parent to nest under.
@@ -148,23 +138,6 @@ declare function syncSchemaRef(node: SchemaNode): SchemaNode;
148
138
  * types, returns `true` only when `representation` is `'string'` rather than `'date'`.
149
139
  */
150
140
  declare function isStringType(node: SchemaNode): boolean;
151
- /**
152
- * Derives a {@link ParamGroupType} for a query or header group from the resolver.
153
- *
154
- * Returns `null` when there is no resolver, no params, or the group name equals the
155
- * individual param name (so there is no real group to emit).
156
- */
157
- declare function resolveGroupType({
158
- node,
159
- params,
160
- group,
161
- resolver
162
- }: {
163
- node: OperationNode;
164
- params: Array<ParameterNode>;
165
- group: 'query' | 'header';
166
- resolver: OperationParamsResolver | undefined;
167
- }): ParamGroupType | null;
168
141
  //#endregion
169
142
  //#region src/utils/schemaMerge.d.ts
170
143
  /**
@@ -377,5 +350,5 @@ declare function lazyGetter({
377
350
  body: string;
378
351
  }): string;
379
352
  //#endregion
380
- export { type BuildGroupArgs, type MappedProperty, type MappedSchema, type ParamGroupType, type SchemaTransform, buildGroupParam, buildJSDoc, buildList, buildObject, buildTypeLiteral, caseParams, childName, collectUsedSchemaNames, containsCircularRef, createOperationParams, enumPropName, extractRefName, extractStringsFromNodes, findCircularSchemas, getNestedAccessor, isStringType, isValidVarName, jsStringEscape, lazyGetter, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, objectKey, resolveGroupType, resolveParamType, resolveRefName, stringify, stringifyObject, syncSchemaRef, toRegExpString, trimQuotes };
353
+ export { buildJSDoc, buildList, buildObject, caseParams, childName, collectUsedSchemaNames, containsCircularRef, createOperationParams, enumPropName, extractRefName, extractStringsFromNodes, findCircularSchemas, getNestedAccessor, isStringType, isValidVarName, jsStringEscape, lazyGetter, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, objectKey, stringify, stringifyObject, syncSchemaRef, toRegExpString, trimQuotes };
381
354
  //# sourceMappingURL=utils.d.ts.map
package/dist/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import "./rolldown-runtime-CNktS9qV.js";
2
- import { C as createFunctionParameter, D as createTypeLiteral, H as camelCase, T as createIndexedAccessType, V as extractStringsFromNodes, lt as narrowSchema, n as collectLazy, o as createSchema, t as collect, ut as INDENT, w as createFunctionParameters } from "./visitor-DG5ROqRx.js";
3
- import { a as resolveGroupType, i as isStringType, n as enumPropName, o as resolveRefName, r as extractRefName, s as syncSchemaRef, t as childName } from "./refs-D2qwT5ck.js";
2
+ import { C as createFunctionParameter, D as createTypeLiteral, H as camelCase, T as createIndexedAccessType, V as extractStringsFromNodes, lt as narrowSchema, n as collectLazy, o as createSchema, t as collect, ut as INDENT, w as createFunctionParameters } from "./visitor-dcVC5TOW.js";
3
+ import { a as resolveGroupType, i as isStringType, n as enumPropName, o as resolveRefName, r as extractRefName, s as syncSchemaRef, t as childName } from "./refs-D18OeCgb.js";
4
4
  //#region ../../internals/utils/src/promise.ts
5
5
  /**
6
6
  * Wraps `factory` with a keyed cache backed by the provided store.
@@ -772,6 +772,6 @@ function buildTypeLiteral({ node, params, resolver }) {
772
772
  })) });
773
773
  }
774
774
  //#endregion
775
- export { buildGroupParam, buildJSDoc, buildList, buildObject, buildTypeLiteral, caseParams, childName, collectUsedSchemaNames, containsCircularRef, createOperationParams, enumPropName, extractRefName, extractStringsFromNodes, findCircularSchemas, getNestedAccessor, isStringType, isValidVarName, jsStringEscape, lazyGetter, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, objectKey, resolveGroupType, resolveParamType, resolveRefName, stringify, stringifyObject, syncSchemaRef, toRegExpString, trimQuotes };
775
+ export { buildJSDoc, buildList, buildObject, caseParams, childName, collectUsedSchemaNames, containsCircularRef, createOperationParams, enumPropName, extractRefName, extractStringsFromNodes, findCircularSchemas, getNestedAccessor, isStringType, isValidVarName, jsStringEscape, lazyGetter, mapSchemaItems, mapSchemaMembers, mapSchemaProperties, mergeAdjacentObjectsLazy, objectKey, stringify, stringifyObject, syncSchemaRef, toRegExpString, trimQuotes };
776
776
 
777
777
  //# sourceMappingURL=utils.js.map
@@ -799,6 +799,12 @@ const createObjectBindingPattern = objectBindingPatternDef.create;
799
799
  * createFunctionParameter({ properties: [{ name: 'id', type: 'string' }, { name: 'name', type: 'string', optional: true }], default: '{}' })
800
800
  * // → { id, name }: { id: string; name?: string } = {}
801
801
  * ```
802
+ *
803
+ * @example Destructured group typed from a single reference
804
+ * ```ts
805
+ * createFunctionParameter({ name: createObjectBindingPattern({ elements: [{ name: 'path' }] }), type: "Omit<Config, 'url'>", default: '{}' })
806
+ * // → { path }: Omit<Config, 'url'> = {}
807
+ * ```
802
808
  */
803
809
  const createFunctionParameter = functionParameterDef.create;
804
810
  /**
@@ -1740,4 +1746,4 @@ Object.defineProperty(exports, "walk", {
1740
1746
  }
1741
1747
  });
1742
1748
 
1743
- //# sourceMappingURL=visitor-CLLDwBvv.cjs.map
1749
+ //# sourceMappingURL=visitor-CQdSiClY.cjs.map