@kubb/ast 5.23.2 → 5.23.4

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 (167) hide show
  1. package/dist/{constants-Ckeonm-D.js → constants-BTTus9ee.js} +1 -1
  2. package/dist/{constants-Ckeonm-D.js.map → constants-BTTus9ee.js.map} +1 -1
  3. package/dist/{constants-CquR083U.cjs → constants-DztHlVmY.cjs} +1 -1
  4. package/dist/{constants-CquR083U.cjs.map → constants-DztHlVmY.cjs.map} +1 -1
  5. package/dist/factory.cjs +3 -3
  6. package/dist/factory.d.cts +4 -4
  7. package/dist/factory.d.ts +4 -4
  8. package/dist/factory.js +3 -3
  9. package/dist/{file-xJnBQPGq.d.ts → file-B269mZh4.d.cts} +96 -40
  10. package/dist/file-Bq2GPaxh.js +427 -0
  11. package/dist/file-Bq2GPaxh.js.map +1 -0
  12. package/dist/file-C4pqV8yl.cjs +469 -0
  13. package/dist/file-C4pqV8yl.cjs.map +1 -0
  14. package/dist/{file-CvlMAp_d.js → file-D_ih0x7q.js} +32 -19
  15. package/dist/file-D_ih0x7q.js.map +1 -0
  16. package/dist/{file-Dd50jPkH.cjs → file-DiPZBLSP.cjs} +32 -19
  17. package/dist/file-DiPZBLSP.cjs.map +1 -0
  18. package/dist/{file-BVqSiSvV.d.cts → file-oLlejzZV.d.ts} +96 -40
  19. package/dist/file.cjs +5 -2
  20. package/dist/file.d.cts +2 -2
  21. package/dist/file.d.ts +2 -2
  22. package/dist/file.js +3 -1
  23. package/dist/{graph-BcwFCvei.js → graph-BUEOBomo.js} +5 -5
  24. package/dist/{graph-BcwFCvei.js.map → graph-BUEOBomo.js.map} +1 -1
  25. package/dist/{graph-DcIY6tQb.cjs → graph-CFJ4wzFR.cjs} +5 -5
  26. package/dist/{graph-DcIY6tQb.cjs.map → graph-CFJ4wzFR.cjs.map} +1 -1
  27. package/dist/graph.cjs +1 -1
  28. package/dist/graph.d.cts +1 -1
  29. package/dist/graph.d.ts +1 -1
  30. package/dist/graph.js +1 -1
  31. package/dist/{guards-COVJE6TU.cjs → guards-4drgx10i.cjs} +1 -1
  32. package/dist/{guards-COVJE6TU.cjs.map → guards-4drgx10i.cjs.map} +1 -1
  33. package/dist/{guards-DlJkKsT1.js → guards-DKw4uwc5.js} +1 -1
  34. package/dist/{guards-DlJkKsT1.js.map → guards-DKw4uwc5.js.map} +1 -1
  35. package/dist/{guards-D-h9R_sV.d.ts → guards-RCnH6re9.d.ts} +1 -1
  36. package/dist/{guards-B8qDgSaT.d.cts → guards-u-dAAtl8.d.cts} +1 -1
  37. package/dist/{http-DwboM6pK.js → http-CAWf6TAJ.js} +2 -2
  38. package/dist/http-CAWf6TAJ.js.map +1 -0
  39. package/dist/{http-Bm5lhVK4.cjs → http-Dv8py6wh.cjs} +2 -2
  40. package/dist/http-Dv8py6wh.cjs.map +1 -0
  41. package/dist/http.cjs +2 -2
  42. package/dist/http.d.cts +2 -2
  43. package/dist/http.d.ts +2 -2
  44. package/dist/http.js +2 -2
  45. package/dist/{index-eGkM4FE9.d.ts → index-2TMYDLjK.d.ts} +1 -1
  46. package/dist/index-6-ZZCX9W.d.ts +24 -0
  47. package/dist/index-B2nnOQjf.d.cts +24 -0
  48. package/dist/{index-Csf8xsCc.d.cts → index-BgFaJtnv.d.ts} +11 -5
  49. package/dist/index-Bj7a0aSM.d.cts +5 -0
  50. package/dist/{index-DKJdlX1l.d.cts → index-Bw2oMIM1.d.cts} +4 -4
  51. package/dist/{index-Bb1kqq8H.d.cts → index-C1za72gL.d.cts} +1 -1
  52. package/dist/index-CW-ztJjd.d.ts +5 -0
  53. package/dist/{index-CoRdlrVx.d.ts → index-DF7CbpYW.d.ts} +3 -3
  54. package/dist/{index-CwLhqYbA.d.cts → index-D_WLsIMP.d.cts} +2 -2
  55. package/dist/{index-Dp50LM3a.d.ts → index-DbAnYRRM.d.ts} +1 -1
  56. package/dist/{index-cpjUxIik.d.ts → index-DbQ-J072.d.cts} +11 -5
  57. package/dist/{index-CFH4ZC7q.d.ts → index-DfRcRYF2.d.ts} +1 -1
  58. package/dist/{index-DU_jYpBt.d.cts → index-DpnCCtXt.d.cts} +1 -1
  59. package/dist/{index-BSf-ETQP.d.ts → index-DzHcy3vy.d.ts} +2 -2
  60. package/dist/{index-W6yFx0sy.d.ts → index-UwSVys3m.d.ts} +4 -4
  61. package/dist/{index-BVuX3-Th.d.cts → index-c9FD2S5f.d.cts} +3 -3
  62. package/dist/{index-DYDha-3I.d.cts → index-sdprVPKQ.d.cts} +1 -1
  63. package/dist/index.cjs +16 -16
  64. package/dist/index.d.cts +17 -17
  65. package/dist/index.d.ts +17 -17
  66. package/dist/index.js +16 -16
  67. package/dist/{json-DURdtz9A.cjs → json-CCWMgzJZ.cjs} +2 -2
  68. package/dist/{json-DURdtz9A.cjs.map → json-CCWMgzJZ.cjs.map} +1 -1
  69. package/dist/{json-DH7_lcWm.js → json-DyDtIZTj.js} +2 -2
  70. package/dist/{json-DH7_lcWm.js.map → json-DyDtIZTj.js.map} +1 -1
  71. package/dist/json.cjs +1 -1
  72. package/dist/json.d.cts +1 -1
  73. package/dist/json.d.ts +1 -1
  74. package/dist/json.js +1 -1
  75. package/dist/{macro-4N8vHE-2.js → macro-9WouvtZe.js} +2 -2
  76. package/dist/{macro-4N8vHE-2.js.map → macro-9WouvtZe.js.map} +1 -1
  77. package/dist/{macro-V_cNODx2.cjs → macro-BEwfGNu1.cjs} +2 -2
  78. package/dist/{macro-V_cNODx2.cjs.map → macro-BEwfGNu1.cjs.map} +1 -1
  79. package/dist/macro.cjs +1 -1
  80. package/dist/macro.d.cts +1 -1
  81. package/dist/macro.d.ts +1 -1
  82. package/dist/macro.js +1 -1
  83. package/dist/{mediaType-D8uIO8sG.cjs → mediaType-BbIfudh0.cjs} +1 -1
  84. package/dist/{mediaType-D8uIO8sG.cjs.map → mediaType-BbIfudh0.cjs.map} +1 -1
  85. package/dist/{mediaType-CRjggmoG.js → mediaType-DXQCNYdM.js} +1 -1
  86. package/dist/{mediaType-CRjggmoG.js.map → mediaType-DXQCNYdM.js.map} +1 -1
  87. package/dist/mediaType.cjs +1 -1
  88. package/dist/mediaType.d.cts +1 -1
  89. package/dist/mediaType.d.ts +1 -1
  90. package/dist/mediaType.js +1 -1
  91. package/dist/{node-Djh-mZB2.js → node-DtuO3zr8.js} +4 -4
  92. package/dist/{node-Djh-mZB2.js.map → node-DtuO3zr8.js.map} +1 -1
  93. package/dist/{node-DjcETnc8.cjs → node-vTrAIz3e.cjs} +4 -4
  94. package/dist/{node-DjcETnc8.cjs.map → node-vTrAIz3e.cjs.map} +1 -1
  95. package/dist/node.cjs +4 -4
  96. package/dist/node.d.cts +3 -3
  97. package/dist/node.d.ts +3 -3
  98. package/dist/node.js +4 -4
  99. package/dist/{nodeText-DVVDZQjF.js → nodeText-BSYvDZOH.js} +2 -2
  100. package/dist/{nodeText-DVVDZQjF.js.map → nodeText-BSYvDZOH.js.map} +1 -1
  101. package/dist/{nodeText-DRb_rVd1.cjs → nodeText-CZ7wgxu9.cjs} +2 -2
  102. package/dist/{nodeText-DRb_rVd1.cjs.map → nodeText-CZ7wgxu9.cjs.map} +1 -1
  103. package/dist/{nodes-CWMa9xhW.js → nodes-ClL1C158.js} +5 -5
  104. package/dist/nodes-ClL1C158.js.map +1 -0
  105. package/dist/{nodes-BB60Bq2H.cjs → nodes-DEQjVliP.cjs} +5 -5
  106. package/dist/nodes-DEQjVliP.cjs.map +1 -0
  107. package/dist/{operation-X7chCdL2.d.cts → operation-AFw8tzIN.d.cts} +22 -6
  108. package/dist/{operation-BgRyVS7z.d.ts → operation-Cu4XSaJQ.d.ts} +22 -6
  109. package/dist/{optionality-D-zqzVMH.cjs → optionality-C-qULYxo.cjs} +1 -1
  110. package/dist/{optionality-D-zqzVMH.cjs.map → optionality-C-qULYxo.cjs.map} +1 -1
  111. package/dist/{optionality-DISn8ytP.js → optionality-FkRredTC.js} +1 -1
  112. package/dist/{optionality-DISn8ytP.js.map → optionality-FkRredTC.js.map} +1 -1
  113. package/dist/{promise-RpnEev9D.js → promise-B3YkZ4C8.js} +1 -1
  114. package/dist/{promise-RpnEev9D.js.map → promise-B3YkZ4C8.js.map} +1 -1
  115. package/dist/{promise-BOdlgT0N.cjs → promise-DScaykew.cjs} +1 -1
  116. package/dist/{promise-BOdlgT0N.cjs.map → promise-DScaykew.cjs.map} +1 -1
  117. package/dist/{ref-P0ZLT1Bg.cjs → ref-Bh5Xo8T7.cjs} +4 -4
  118. package/dist/{ref-P0ZLT1Bg.cjs.map → ref-Bh5Xo8T7.cjs.map} +1 -1
  119. package/dist/{ref-Bu7PoHar.js → ref-DPqeS8K1.js} +4 -4
  120. package/dist/{ref-Bu7PoHar.js.map → ref-DPqeS8K1.js.map} +1 -1
  121. package/dist/ref.cjs +2 -2
  122. package/dist/ref.d.cts +1 -1
  123. package/dist/ref.d.ts +1 -1
  124. package/dist/ref.js +2 -2
  125. package/dist/{refs-YCV3CznS.js → refs-Bgf8_9Ui.js} +2 -2
  126. package/dist/{refs-YCV3CznS.js.map → refs-Bgf8_9Ui.js.map} +1 -1
  127. package/dist/{refs-CYHpRlQo.cjs → refs-rmr2LFV1.cjs} +2 -2
  128. package/dist/{refs-CYHpRlQo.cjs.map → refs-rmr2LFV1.cjs.map} +1 -1
  129. package/dist/{schema-DloctnMm.js → schema-4UcdIPQ2.js} +7 -7
  130. package/dist/{schema-DloctnMm.js.map → schema-4UcdIPQ2.js.map} +1 -1
  131. package/dist/{schema-BIErWqgc.cjs → schema-DuCY4lCG.cjs} +7 -7
  132. package/dist/{schema-BIErWqgc.cjs.map → schema-DuCY4lCG.cjs.map} +1 -1
  133. package/dist/{schema-hxMlgCrV.cjs → schema-gSjYgaCl.cjs} +2 -2
  134. package/dist/schema-gSjYgaCl.cjs.map +1 -0
  135. package/dist/{schema-2ZAQk7qE.js → schema-tH14gE6i.js} +2 -2
  136. package/dist/schema-tH14gE6i.js.map +1 -0
  137. package/dist/schema.cjs +5 -5
  138. package/dist/schema.d.cts +4 -4
  139. package/dist/schema.d.ts +4 -4
  140. package/dist/schema.js +5 -5
  141. package/dist/{visitor-DTrzvA3R.cjs → visitor-Bh1CBAOz.cjs} +4 -5
  142. package/dist/{visitor-DTrzvA3R.cjs.map → visitor-Bh1CBAOz.cjs.map} +1 -1
  143. package/dist/{visitor-1TSWTMe1.d.ts → visitor-CpmsR8o5.d.ts} +2 -2
  144. package/dist/{visitor-CUbaaX8R.d.cts → visitor-DnBK2MNl.d.cts} +2 -2
  145. package/dist/{visitor-NoQSUQTu.js → visitor-XA0W3OVv.js} +4 -5
  146. package/dist/{visitor-NoQSUQTu.js.map → visitor-XA0W3OVv.js.map} +1 -1
  147. package/package.json +1 -1
  148. package/dist/file-Cg0T6cgz.cjs +0 -319
  149. package/dist/file-Cg0T6cgz.cjs.map +0 -1
  150. package/dist/file-CnuL8oUj.js +0 -283
  151. package/dist/file-CnuL8oUj.js.map +0 -1
  152. package/dist/file-CvlMAp_d.js.map +0 -1
  153. package/dist/file-Dd50jPkH.cjs.map +0 -1
  154. package/dist/http-Bm5lhVK4.cjs.map +0 -1
  155. package/dist/http-DwboM6pK.js.map +0 -1
  156. package/dist/index-BWd95onW.d.cts +0 -5
  157. package/dist/index-BwnMIoLl.d.ts +0 -24
  158. package/dist/index-DSVef1pp.d.cts +0 -24
  159. package/dist/index-DaHsMJ_S.d.ts +0 -5
  160. package/dist/nodes-BB60Bq2H.cjs.map +0 -1
  161. package/dist/nodes-CWMa9xhW.js.map +0 -1
  162. package/dist/schema-2ZAQk7qE.js.map +0 -1
  163. package/dist/schema-hxMlgCrV.cjs.map +0 -1
  164. /package/dist/{base-IpYuh3ZP.d.cts → base-LhsPvVY1.d.ts} +0 -0
  165. /package/dist/{base-IpYuh3ZP.d.ts → base-UFBZi-FO.d.cts} +0 -0
  166. /package/dist/{index-Cc2K3OzU.d.cts → index-C-nsgwuD.d.ts} +0 -0
  167. /package/dist/{index-Cc2K3OzU.d.ts → index-DR9ahJ-x.d.cts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nodes-DEQjVliP.cjs","names":["nodeFactory","nodeKinds","nodeFactory","nodeKinds","nodeKinds","nodeFactory","nodeKinds","nodeKinds","applyOptionality","nodeKinds","applyOptionality","nodeKinds","nodeKinds"],"sources":["../src/nodes/code.ts","../src/nodes/content.ts","../src/nodes/input.ts","../src/nodes/requestBody.ts","../src/nodes/operation.ts","../src/nodes/parameter.ts","../src/nodes/property.ts","../src/nodes/response.ts","../src/nodes/index.ts"],"sourcesContent":["import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\n\n/**\n * JSDoc documentation metadata attached to code declarations.\n */\nexport type JSDocNode = {\n /**\n * JSDoc comment lines. `undefined` entries are filtered out during rendering.\n *\n * @example\n * ```ts\n * ['@description A pet resource', '@deprecated']\n * ```\n */\n comments?: Array<string | undefined>\n}\n\n/**\n * AST node representing a TypeScript `const` declaration.\n *\n * Mirrors the props of the `Const` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createConst({ name: 'pet', export: true, asConst: true })\n * // export const pet = ... as const\n * ```\n */\nexport type ConstNode = BaseNode & {\n kind: 'Const'\n /**\n * Name of the constant declaration.\n */\n name: string\n /**\n * Whether the declaration should be exported.\n */\n export?: boolean | null\n /**\n * Explicit type annotation.\n *\n * @example Type reference\n * `'Pet'`\n */\n type?: string | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Whether to append `as const` to the declaration.\n */\n asConst?: boolean | null\n /**\n * Child nodes representing the value of the constant (children of the `Const` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript `type` alias declaration.\n *\n * Mirrors the props of the `Type` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createType({ name: 'Pet', export: true })\n * // export type Pet = ...\n * ```\n */\nexport type TypeNode = BaseNode & {\n kind: 'Type'\n /**\n * Name of the type alias.\n */\n name: string\n /**\n * Whether the declaration should be exported.\n */\n export?: boolean | null\n /**\n * How the declaration is written.\n * - `'type'` declares `type Name = …`\n * - `'interface'` declares `interface Name { … }`, so the body must be an object type\n *\n * @default 'type'\n */\n syntax?: 'type' | 'interface' | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Child nodes representing the type body (children of the `Type` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript `function` declaration.\n *\n * Mirrors the props of the `Function` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createFunction({ name: 'getPet', export: true, async: true, returnType: 'Pet' })\n * // export async function getPet(): Promise<Pet> { ... }\n * ```\n */\nexport type FunctionNode = BaseNode & {\n kind: 'Function'\n /**\n * Name of the function.\n */\n name: string\n /**\n * Whether the function is a default export.\n */\n default?: boolean | null\n /**\n * Function parameter list as a pre-rendered string, written verbatim between the parentheses.\n *\n * @example\n * `'id: string, config: Config = {}'`\n */\n params?: string | null\n /**\n * Whether the function should be exported.\n */\n export?: boolean | null\n /**\n * Whether the function is async. When `true`, the return type is wrapped in `Promise<>`.\n */\n async?: boolean | null\n /**\n * TypeScript generic type parameters.\n *\n * @example Constrained generics\n * `['T', 'U extends string']`\n */\n generics?: string | Array<string> | null\n /**\n * Return type annotation.\n *\n * @example Type reference\n * `'Pet'`\n */\n returnType?: string | null\n /**\n * JSDoc documentation metadata.\n */\n JSDoc?: JSDocNode | null\n /**\n * Child nodes representing the function body (children of the `Function` component).\n * Each entry is a {@link CodeNode}. Use {@link TextNode} for raw string content.\n */\n nodes?: Array<CodeNode>\n}\n\n/**\n * AST node representing a TypeScript arrow function (`const name = () => { ... }`).\n *\n * Mirrors the props of the `Function.Arrow` component from `@kubb/renderer-jsx`.\n * The `children` prop of the component is represented as `nodes`.\n *\n * @example\n * ```ts\n * createArrowFunction({ name: 'getPet', export: true, singleLine: true })\n * // export const getPet = () => ...\n * ```\n */\nexport type ArrowFunctionNode = Omit<FunctionNode, 'kind'> & {\n kind: 'ArrowFunction'\n /**\n * Render the arrow function body as a single-line expression.\n */\n singleLine?: boolean | null\n}\n\n/**\n * AST node representing a raw text/string fragment in the source output.\n *\n * Used instead of bare `string` values so that all entries in `nodes` arrays\n * are typed `CodeNode` objects rather than a mixed `CodeNode | string` union.\n *\n * @example\n * ```ts\n * createText('return fetch(id)')\n * // { kind: 'Text', value: 'return fetch(id)' }\n * ```\n */\nexport type TextNode = BaseNode & {\n kind: 'Text'\n /**\n * The raw string content.\n */\n value: string\n}\n\n/**\n * AST node representing a blank line in the source output.\n *\n * Corresponds to `<br/>` in JSX components. `printNodes` turns a `Break` between two\n * statements into one blank line. Consecutive breaks, and breaks at the start or end of\n * the list, are folded away, so a `Break` never produces more than one blank line.\n *\n * @example\n * ```ts\n * createBreak()\n * // { kind: 'Break' }\n * ```\n */\nexport type BreakNode = BaseNode & {\n kind: 'Break'\n}\n\n/**\n * AST node representing a raw JSX fragment in the source output.\n *\n * Mirrors the `Jsx` component from `@kubb/renderer-jsx`. Embeds raw JSX/TSX markup\n * (including fragments `<>…</>`) directly in generated code.\n *\n * @example\n * ```ts\n * createJsx('<>\\n <a href={href}>Open</a>\\n</>')\n * // { kind: 'Jsx', value: '<>\\n <a href={href}>Open</a>\\n</>' }\n * ```\n */\nexport type JsxNode = BaseNode & {\n kind: 'Jsx'\n /**\n * The raw JSX string content.\n */\n value: string\n}\n\n/**\n * Union of all code-generation AST nodes.\n *\n * These nodes mirror the JSX components from `@kubb/renderer-jsx` and are used as\n * structured children in {@link SourceNode.nodes}.\n */\nexport type CodeNode = ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode\n\n/**\n * Creates a `ConstNode` representing a TypeScript `const` declaration.\n *\n * @example Exported constant with type and `as const`\n * ```ts\n * createConst({ name: 'pets', export: true, type: 'Pet[]', asConst: true })\n * // export const pets: Pet[] = ... as const\n * ```\n */\nexport const createConst = nodeFactory<ConstNode>(nodeKinds.const)\n\n/**\n * Creates a `TypeNode` representing a TypeScript `type` alias declaration.\n *\n * @example\n * ```ts\n * createType({ name: 'Pet', export: true })\n * // export type Pet = ...\n * ```\n */\nexport const createType = nodeFactory<TypeNode>(nodeKinds.type)\n\n/**\n * Creates a `FunctionNode` representing a TypeScript `function` declaration.\n *\n * @example\n * ```ts\n * createFunction({ name: 'fetchPet', export: true, async: true, returnType: 'Pet' })\n * // export async function fetchPet(): Promise<Pet> { ... }\n * ```\n */\nexport const createFunction = nodeFactory<FunctionNode>(nodeKinds.function)\n\n/**\n * Creates an `ArrowFunctionNode` representing a TypeScript arrow function.\n *\n * @example\n * ```ts\n * createArrowFunction({ name: 'double', export: true, params: 'n: number', singleLine: true })\n * // export const double = (n: number) => ...\n * ```\n */\nexport const createArrowFunction = nodeFactory<ArrowFunctionNode>(nodeKinds.arrowFunction)\n\n/**\n * Creates a {@link TextNode} representing a raw string fragment in the source output.\n *\n * @example\n * ```ts\n * createText('return fetch(id)')\n * // { kind: 'Text', value: 'return fetch(id)' }\n * ```\n */\nexport function createText(value: string): TextNode {\n return { kind: nodeKinds.text, value }\n}\n\n/**\n * Creates a {@link BreakNode} representing a line break in the source output.\n *\n * @example\n * ```ts\n * createBreak()\n * // { kind: 'Break' }\n * ```\n */\nexport function createBreak(): BreakNode {\n return { kind: nodeKinds.break }\n}\n\n/**\n * Creates a {@link JsxNode} representing a raw JSX fragment in the source output.\n *\n * @example\n * ```ts\n * createJsx('<>\\n <a href={href}>Open</a>\\n</>')\n * // { kind: 'Jsx', value: '<>\\n <a href={href}>Open</a>\\n</>' }\n * ```\n */\nexport function createJsx(value: string): JsxNode {\n return { kind: nodeKinds.jsx, value }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\nimport type { ParameterStyle } from './parameter.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * How one body property is serialized, from the `encoding` entry of its media type.\n */\nexport type EncodingNode = {\n /**\n * Content type of the part, for example `'application/json'` for a multipart property.\n */\n contentType?: string\n /**\n * Serialization style of the property.\n */\n style?: ParameterStyle\n /**\n * Whether array and object values expand into separate values.\n */\n explode?: boolean\n /**\n * Whether reserved characters are sent as-is instead of percent-encoded.\n */\n allowReserved?: boolean\n encoding?: Record<string, EncodingNode>\n prefixEncoding?: Array<EncodingNode>\n itemEncoding?: EncodingNode\n}\n\nexport type ExampleNode = {\n name?: string\n summary?: string\n description?: string\n value?: unknown\n serializedValue?: string\n}\n\n/**\n * AST node representing one content-type entry of a request body or response.\n *\n * There is one entry per content type declared in the spec (e.g. `application/json`,\n * `multipart/form-data`), and each entry holds its own body schema.\n *\n * @example\n * ```ts\n * const content: ContentNode = {\n * kind: 'Content',\n * contentType: 'application/json',\n * schema: createSchema({ type: 'string' }),\n * }\n * ```\n */\nexport type ContentNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Content'\n /**\n * The content type for this entry (e.g. `'application/json'`), or `''` for a response without a body.\n */\n contentType: string\n /**\n * Body schema for this content type. For a stream it is the same node as `stream.schema`.\n */\n schema?: SchemaNode\n /**\n * Set when the content is a stream of items (an event stream, JSON Lines, a channel of messages) instead of one body.\n */\n stream?: {\n /**\n * Schema of one item, such as one event of `text/event-stream` or one line of JSON Lines.\n */\n schema?: SchemaNode\n /**\n * What `schema` describes for an event stream.\n * - `'event'` the parsed event with its `event`, `data`, `id` and `retry` fields\n * - `'data'` only the `data` payload, which the client wraps in its own event type\n */\n shape?: 'event' | 'data'\n }\n /**\n * Property keys to exclude from the generated type via `Omit<Type, Keys>`.\n * Set when a referenced schema has `readOnly`/`writeOnly` fields that should be omitted.\n */\n keysToOmit?: Array<string> | null\n /**\n * Serialization settings per body property that sets at least one field in the spec's `encoding`.\n */\n encoding?: Record<string, EncodingNode>\n examples?: Array<ExampleNode>\n /**\n * Serialization of the first parts by position, for a body sent as an array of parts such as `multipart/mixed`.\n */\n prefixEncoding?: Array<EncodingNode>\n /**\n * Serialization of every part after `prefixEncoding`, for a body sent as an array of parts such as `multipart/mixed`.\n */\n itemEncoding?: EncodingNode\n /** Vendor extensions (`x-*` keys) from the source media type, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Creates a `ContentNode` for a single request-body or response content type.\n */\nexport const createContent = nodeFactory<ContentNode>(nodeKinds.content)\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport type { OperationNode } from './operation.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * A variable declared by a server URL template.\n */\nexport type InputServerVariable = {\n default?: string\n enum?: Array<string>\n description?: string\n}\n\n/**\n * A server from the source document, with `{variable}` placeholders filled from their defaults.\n */\nexport type InputServer = {\n url: string\n name?: string\n description?: string\n /**\n * Variables of the source URL template, copied as-is. `url` already has their defaults filled in, so\n * this tells a templated server apart from a literal one. Absent when the server declares none.\n */\n variables?: Record<string, InputServerVariable>\n}\n\nexport type ExternalDocs = { url: string; description?: string }\n\nexport type InputTag = {\n name: string\n summary?: string\n description?: string\n /**\n * Name of the tag this tag nests under. `group: { type: 'tag' }` places its files in the parent's folder.\n */\n parent?: string\n kind?: string\n externalDocs?: ExternalDocs\n}\n\nexport type OAuthFlow = {\n authorizationUrl?: string\n deviceAuthorizationUrl?: string\n tokenUrl?: string\n refreshUrl?: string\n scopes?: Record<string, string>\n}\n\n/**\n * How a client sends a credential, in the same shape as the `Auth` object the generated clients pass to `auth`.\n */\nexport type AuthCredential =\n | { type: 'http'; scheme: 'bearer' | 'basic' | (string & {}); bearerFormat?: string }\n | { type: 'apiKey'; in: 'header' | 'query' | 'cookie'; name: string }\n | { type: 'oauth2'; flows: Record<string, OAuthFlow>; metadataUrl?: string }\n | { type: 'openIdConnect'; url?: string }\n | { type: 'mutualTLS' }\n\n/**\n * One way to authenticate, keyed by `name`, which operations refer to in `auth`.\n */\nexport type AuthScheme = {\n name: string\n description?: string\n deprecated?: boolean\n credential: AuthCredential\n}\n\n/**\n * One way to meet an operation's auth. Every scheme in it applies together. `scopes` are the OAuth2 or OpenID\n * Connect scopes the call needs. An empty list means the call may be sent without credentials.\n */\nexport type AuthRequirement = Array<{ scheme: string; scopes?: Array<string> }>\n\n/**\n * Metadata for an API document, populated by the adapter and available to every generator.\n * Every field is a plain JSON value.\n *\n * @example\n * ```ts\n * const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2' }\n * ```\n */\nexport type InputMeta = {\n /**\n * API title from `info.title` in the source document.\n */\n title?: string\n /**\n * API description from `info.description` in the source document.\n */\n description?: string\n /**\n * API version string from `info.version` in the source document.\n */\n version?: string\n summary?: string\n termsOfService?: string\n contact?: { name?: string; url?: string; email?: string }\n license?: { name: string; identifier?: string; url?: string }\n externalDocs?: ExternalDocs\n /**\n * Resolved base URL from the first matching server entry in the source document.\n */\n baseURL?: string | null\n servers?: Array<InputServer>\n tags?: Array<InputTag>\n auth?: Array<AuthScheme>\n /**\n * Vendor extensions (`x-*` keys) from the document root, copied as-is. Absent when the root has none.\n */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Input AST node that contains all schemas and operations for one API document.\n * Produced by the adapter and consumed by all Kubb plugins.\n *\n * @example\n * ```ts\n * const input: InputNode = {\n * kind: 'Input',\n * schemas: [],\n * operations: [],\n * meta: {},\n * }\n * ```\n */\nexport type InputNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Input'\n /**\n * All schema nodes in the document.\n */\n schemas: Array<SchemaNode>\n /**\n * All operation nodes in the document.\n */\n operations: Array<OperationNode>\n /**\n * Document metadata populated by the adapter.\n */\n meta: InputMeta\n}\n\n/**\n * Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` to an empty\n * object. Every call allocates fresh defaults so no two inputs share them.\n *\n * @example\n * ```ts\n * const input = createInput()\n * // { kind: 'Input', schemas: [], operations: [] }\n * ```\n */\nexport function createInput(overrides: Partial<Omit<InputNode, 'kind'>> = {}): InputNode {\n return { schemas: [], operations: [], meta: {}, ...overrides, kind: nodeKinds.input }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { type BaseNode, nodeFactory } from './base.ts'\nimport type { ContentNode } from './content.ts'\n\n/**\n * AST node representing an operation request body.\n *\n * Body schemas live exclusively inside the `content` array (one entry per content type),\n * mirroring {@link ResponseNode}.\n *\n * @example\n * ```ts\n * const requestBody: RequestBodyNode = {\n * kind: 'RequestBody',\n * required: true,\n * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],\n * }\n * ```\n */\nexport type RequestBodyNode = BaseNode & {\n kind: 'RequestBody'\n /**\n * Request body description carried over from the spec.\n */\n description?: string\n /**\n * Whether the request body is required (`requestBody.required: true` in the spec).\n * When `false` or absent, the generated `data` parameter should be optional.\n */\n required?: boolean\n /**\n * Content type entries for this request body.\n *\n * When the adapter `contentType` option is set, this array contains exactly one entry for\n * that content type. Otherwise it contains one entry per content type declared in the spec,\n * so plugins can generate code for every variant (for example, separate hooks for\n * `application/json` and `multipart/form-data`).\n */\n content?: Array<ContentNode>\n /** Vendor extensions (`x-*` keys) from the source request body, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * Creates a `RequestBodyNode`.\n */\nexport const createRequestBody = nodeFactory<RequestBodyNode>(nodeKinds.requestBody)\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport type { AuthRequirement, ExternalDocs, InputServer } from './input.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport { createRequestBody, type RequestBodyNode } from './requestBody.ts'\nimport type { ResponseNode } from './response.ts'\n\n/**\n * HTTP method an operation responds to. `QUERY` is the safe, idempotent method with a request body\n * from RFC 10008, declared with the `query` field of an OpenAPI 3.2 path item. Any other name is a\n * method the source declares outside this fixed set, in the capitalization it is sent with.\n */\nexport type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'HEAD' | 'OPTIONS' | 'TRACE' | 'QUERY' | (string & {})\n\n/**\n * Fields shared by every operation, regardless of transport.\n */\ntype OperationNodeBase = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Operation'\n /**\n * Stable identifier for the operation.\n */\n operationId: string\n /**\n * Group labels for the operation.\n */\n tags: Array<string>\n /**\n * Short one-line operation summary.\n */\n summary?: string\n /**\n * Full operation description.\n */\n description?: string\n /**\n * Marks the operation as deprecated.\n */\n deprecated?: boolean\n externalDocs?: ExternalDocs\n /**\n * Query, path, header, and cookie parameters for the operation.\n */\n parameters: Array<ParameterNode>\n /**\n * Request body for the operation.\n */\n requestBody?: RequestBodyNode\n /**\n * Operation responses.\n */\n responses: Array<ResponseNode>\n /**\n * Vendor extensions (`x-*` keys) from the source operation, copied as-is. Absent when the source has none.\n */\n extensions?: Record<string, unknown>\n /** The operation's own `servers`, else its path item's, such as an upload host. Absent when neither declares any. */\n servers?: Array<InputServer>\n /**\n * Ways to authenticate, from the operation or else the document. Any one entry is enough. `[]` means no auth.\n */\n auth?: Array<AuthRequirement>\n}\n\n/**\n * Operation served over HTTP. `method` and `path` are guaranteed.\n *\n * @example\n * ```ts\n * const operation: HttpOperationNode = {\n * kind: 'Operation',\n * operationId: 'listPets',\n * protocol: 'http',\n * method: 'GET',\n * path: '/pets',\n * tags: [],\n * parameters: [],\n * responses: [],\n * }\n * ```\n */\nexport type HttpOperationNode = OperationNodeBase & {\n /**\n * Transport the operation belongs to.\n */\n protocol?: 'http'\n /**\n * HTTP method like `'GET'`.\n */\n method: HttpMethod\n /**\n * Path string, for example `/pets/{petId}`, with `{param}` notation preserved.\n */\n path: string\n}\n\n/**\n * Operation for a non-HTTP transport. HTTP-only fields are forbidden.\n */\nexport type GenericOperationNode = OperationNodeBase & {\n protocol?: never\n method?: never\n path?: never\n}\n\n/**\n * AST node representing one API operation.\n *\n * Discriminated on `protocol`: an {@link HttpOperationNode} (`protocol: 'http'`) guarantees\n * `method` and `path`, while a {@link GenericOperationNode} omits them. Narrow with\n * `ast.http.isOperation(node)` or `node.protocol === 'http'` before reading `method`/`path`.\n */\nexport type OperationNode = HttpOperationNode | GenericOperationNode\n\ntype OperationInput = {\n operationId: string\n method?: HttpOperationNode['method']\n path?: HttpOperationNode['path']\n requestBody?: Omit<RequestBodyNode, 'kind'>\n [key: string]: unknown\n}\n\n/**\n * Creates an `OperationNode` with default empty arrays for `tags`, `parameters`, and `responses`.\n * HTTP operations (those carrying both `method` and `path`) are tagged with `protocol: 'http'`,\n * and the request body is normalized into a `RequestBodyNode`.\n *\n * @example\n * ```ts\n * const operation = createOperation({ operationId: 'getPetById', method: 'GET', path: '/pet/{petId}' })\n * // tags, parameters, and responses are []\n * ```\n */\nexport function createOperation(\n props: Pick<HttpOperationNode, 'operationId' | 'method' | 'path'> &\n Partial<Omit<HttpOperationNode, 'kind' | 'operationId' | 'method' | 'path' | 'requestBody'>> & {\n requestBody?: Omit<RequestBodyNode, 'kind'>\n },\n): HttpOperationNode\nexport function createOperation(\n props: Pick<GenericOperationNode, 'operationId'> &\n Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {\n requestBody?: Omit<RequestBodyNode, 'kind'>\n },\n): GenericOperationNode\nexport function createOperation(props: OperationInput): OperationNode {\n const { requestBody, ...rest } = props\n const isHttp = rest.method !== undefined && rest.path !== undefined\n\n const node = {\n tags: [],\n parameters: [],\n responses: [],\n ...rest,\n kind: nodeKinds.operation,\n ...(isHttp ? { protocol: 'http' as const } : {}),\n requestBody: requestBody ? createRequestBody(requestBody) : undefined,\n }\n\n return node as OperationNode\n}\n","import { nodeKinds } from '../constants.ts'\nimport { applyOptionality } from '../optionality.ts'\nimport type { BaseNode } from './base.ts'\nimport type { EncodingNode, ExampleNode } from './content.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * Where a parameter is sent. `querystring` carries the whole query string as one value, serialized per `contentType`.\n */\nexport type ParameterLocation = 'path' | 'query' | 'header' | 'cookie' | 'querystring'\n\n/**\n * Parameter serialization style, controlling how a parameter value is rendered into the request.\n */\nexport type ParameterStyle = 'matrix' | 'label' | 'form' | 'simple' | 'spaceDelimited' | 'pipeDelimited' | 'deepObject' | 'cookie'\n\n/**\n * AST node representing one operation parameter.\n *\n * @example\n * ```ts\n * const param: ParameterNode = {\n * kind: 'Parameter',\n * name: 'petId',\n * in: 'path',\n * schema: createSchema({ type: 'string' }),\n * required: true,\n * }\n * ```\n */\nexport type ParameterNode = BaseNode & {\n kind: 'Parameter'\n /**\n * Parameter name.\n */\n name: string\n /**\n * Parameter location (`path`, `query`, `header`, `cookie`, or `querystring`).\n */\n in: ParameterLocation\n /**\n * Parameter schema.\n */\n schema: SchemaNode\n /**\n * Whether the parameter is required.\n */\n required: boolean\n /**\n * Serialization style. Absent when the source omits it, leaving consumers to apply the\n * per-location default.\n */\n style?: ParameterStyle\n /**\n * Whether array and object values expand into separate values. Absent when the source omits it,\n * leaving consumers to apply the default for the style.\n */\n explode?: boolean\n /**\n * Whether reserved characters (RFC 3986 `:/?#[]@!$&'()*+,;=`) are sent as-is instead of\n * percent-encoded. Absent when the source omits it.\n */\n allowReserved?: boolean\n /**\n * Media type of a parameter described with `content` instead of `schema`, for example\n * `application/json` when the value is sent as a JSON-encoded string. Absent for `schema` parameters.\n */\n contentType?: string\n /**\n * Serialization settings per property of a `content` parameter, from the `encoding` of its media type. An OpenAPI 3.2\n * `querystring` parameter sent as `application/x-www-form-urlencoded` uses it to set `style` and `explode` per field.\n */\n encoding?: Record<string, EncodingNode>\n examples?: Array<ExampleNode>\n deprecated?: boolean\n allowEmptyValue?: boolean\n /** Vendor extensions (`x-*` keys) from the source parameter, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\ntype UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>\n\n/**\n * Creates a `ParameterNode`. `required` defaults to `false`, and the schema's\n * `optional`/`nullish` flags are derived from it.\n *\n * @example\n * ```ts\n * const param = createParameter({\n * name: 'petId',\n * in: 'path',\n * required: true,\n * schema: createSchema({ type: 'string' }),\n * })\n * ```\n */\nexport function createParameter(input: UserParameterNode): ParameterNode {\n const required = input.required ?? false\n\n return { ...input, required, schema: applyOptionality(input.schema, required), kind: nodeKinds.parameter }\n}\n","import { nodeKinds } from '../constants.ts'\nimport { applyOptionality } from '../optionality.ts'\nimport type { BaseNode } from './base.ts'\nimport type { SchemaNode } from './schema.ts'\n\n/**\n * AST node representing one named object property.\n *\n * @example\n * ```ts\n * const property: PropertyNode = {\n * kind: 'Property',\n * name: 'id',\n * schema: createSchema({ type: 'integer' }),\n * required: true,\n * }\n * ```\n */\nexport type PropertyNode = BaseNode & {\n kind: 'Property'\n /**\n * Property key.\n */\n name: string\n /**\n * Property schema.\n */\n schema: SchemaNode\n /**\n * Whether the property is required.\n */\n required: boolean\n}\n\n/**\n * Loosely-typed property accepted by `createProperty`, with `required` optional.\n */\ntype UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<PropertyNode, 'kind' | 'name' | 'schema'>>\n\n/**\n * Creates a `PropertyNode`. `required` defaults to `false`, and the schema's\n * `optional`/`nullish` flags are derived from it.\n *\n * @example\n * ```ts\n * const property = createProperty({\n * name: 'status',\n * required: true,\n * schema: createSchema({ type: 'string', nullable: true }),\n * })\n * // required=true, no optional/nullish\n * ```\n */\nexport function createProperty(input: UserPropertyNode): PropertyNode {\n const required = input.required ?? false\n\n return { ...input, required, schema: applyOptionality(input.schema, required), kind: nodeKinds.property }\n}\n","import { nodeKinds } from '../constants.ts'\nimport type { BaseNode } from './base.ts'\nimport { type ContentNode, createContent } from './content.ts'\nimport type { InputServer } from './input.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport type { SchemaNode } from './schema.ts'\n\ntype Digit = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9\n\n/**\n * Response status code literal used by operations.\n *\n * Includes three-digit HTTP status code strings, ranges such as `\"2xx\"`, and `\"default\"` for catch-all responses.\n *\n * @example\n * ```ts\n * const status: StatusCode = '200'\n * const fallback: StatusCode = 'default'\n * ```\n */\nexport type StatusCode = `${1 | 2 | 3 | 4 | 5}${Digit}${Digit}` | `${1 | 2 | 3 | 4 | 5}xx` | 'default'\n\n/**\n * AST node representing one operation response variant.\n *\n * Mirrors {@link OperationNode.requestBody}: the response body schemas live exclusively inside\n * the `content` array (one entry per content type), so the same schema is never duplicated at the\n * node root and inside `content`.\n *\n * @example\n * ```ts\n * const response: ResponseNode = {\n * kind: 'Response',\n * statusCode: '200',\n * content: [{ kind: 'Content', contentType: 'application/json', schema: createSchema({ type: 'string' }) }],\n * }\n * ```\n */\nexport type ResponseNode = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Response'\n /**\n * HTTP status code or `'default'` for a fallback response.\n */\n statusCode: StatusCode\n summary?: string\n /**\n * Optional response description.\n */\n description?: string\n /**\n * All available content type entries for this response.\n *\n * For a response that declares content, the array holds exactly one entry for the adapter\n * `contentType` option when it is set. Otherwise it holds one entry per content type declared in\n * the spec, so that plugins can generate a union of response types (e.g. `application/json` and\n * `application/xml`). A body-less response always keeps a single entry whose `contentType` is `''`\n * and whose `schema` is the empty/`void` placeholder, even when the option is set.\n *\n * @example\n * ```ts\n * // spec response declares both application/json and application/xml\n * response.content[0].contentType // 'application/json'\n * response.content[1].contentType // 'application/xml'\n * ```\n */\n content?: Array<ContentNode>\n /**\n * Response headers, as `in: 'header'` parameters. `Content-Type` is left out.\n */\n headers?: Array<ParameterNode>\n links?: Record<string, ResponseLink>\n /** Vendor extensions (`x-*` keys) from the source response, copied as-is. */\n extensions?: Record<string, unknown>\n}\n\n/**\n * A link to another operation. `parameters` and `requestBody` hold runtime expressions such as `$response.body#/id`.\n */\nexport type ResponseLink = {\n operationId?: string\n operationRef?: string\n parameters?: Record<string, unknown>\n requestBody?: unknown\n description?: string\n server?: InputServer\n}\n\ntype ResponseInput = Pick<ResponseNode, 'statusCode'> &\n Partial<Omit<ResponseNode, 'kind' | 'statusCode' | 'content'>> & {\n content?: Array<ContentNode>\n schema?: SchemaNode\n mediaType?: string | null\n keysToOmit?: Array<string> | null\n }\n\n/**\n * Creates a `ResponseNode`. A single legacy `schema` (with optional `mediaType`/`keysToOmit`)\n * is normalized into one `content` entry.\n *\n * @example\n * ```ts\n * const response = createResponse({\n * statusCode: '200',\n * content: [createContent({ contentType: 'application/json', schema: createSchema({ type: 'object', properties: [] }) })],\n * })\n * ```\n */\nexport function createResponse(props: ResponseInput): ResponseNode {\n const { schema, mediaType, keysToOmit, content, ...rest } = props\n const entries = content ?? (schema ? [createContent({ contentType: mediaType ?? 'application/json', schema, keysToOmit: keysToOmit ?? null })] : undefined)\n\n return { ...rest, content: entries, kind: nodeKinds.response }\n}\n","import type { ArrowFunctionNode, BreakNode, ConstNode, FunctionNode, JsxNode, TextNode, TypeNode } from './code.ts'\nimport type { ContentNode } from './content.ts'\nimport type { ExportNode, FileNode, ImportNode, SourceNode } from './file.ts'\nimport type { InputNode } from './input.ts'\nimport type { OperationNode } from './operation.ts'\nimport type { ParameterNode } from './parameter.ts'\nimport type { PropertyNode } from './property.ts'\nimport type { RequestBodyNode } from './requestBody.ts'\nimport type { ResponseNode } from './response.ts'\nimport type { SchemaNode } from './schema.ts'\n\nexport { createArrowFunction, createBreak, createConst, createFunction, createJsx, createText, createType } from './code.ts'\nexport { createContent } from './content.ts'\nexport { createExport, createFile, createImport, createSource } from './file.ts'\nexport type { ExportInput, ImportInput, ModuleName, Space, UserFileNode } from './file.ts'\nexport { createInput } from './input.ts'\nexport { createOperation } from './operation.ts'\nexport { createParameter } from './parameter.ts'\nexport { createProperty } from './property.ts'\nexport { createRequestBody } from './requestBody.ts'\nexport { createResponse } from './response.ts'\nexport { createSchema } from './schema.ts'\n\n/**\n * Union of all AST node types.\n *\n * This lets TypeScript narrow types in `switch (node.kind)` blocks.\n *\n * @example\n * ```ts\n * function getKind(node: Node): string {\n * switch (node.kind) {\n * case nodeKinds.input:\n * return 'input'\n * default:\n * return 'other'\n * }\n * }\n * ```\n */\nexport type Node =\n | InputNode\n | OperationNode\n | SchemaNode\n | PropertyNode\n | ParameterNode\n | ResponseNode\n | RequestBodyNode\n | ContentNode\n | FileNode\n | ImportNode\n | ExportNode\n | SourceNode\n | ConstNode\n | TypeNode\n | FunctionNode\n | ArrowFunctionNode\n | TextNode\n | BreakNode\n | JsxNode\n"],"mappings":";;;;;;;;;;;;;;;AAmQA,MAAa,cAAcA,aAAAA,YAAuBC,kBAAAA,UAAU,KAAK;;;;;;;;;;AAWjE,MAAa,aAAaD,aAAAA,YAAsBC,kBAAAA,UAAU,IAAI;;;;;;;;;;AAW9D,MAAa,iBAAiBD,aAAAA,YAA0BC,kBAAAA,UAAU,QAAQ;;;;;;;;;;AAW1E,MAAa,sBAAsBD,aAAAA,YAA+BC,kBAAAA,UAAU,aAAa;;;;;;;;;;AAWzF,SAAgB,WAAW,OAAyB;CAClD,OAAO;EAAE,MAAMA,kBAAAA,UAAU;EAAM;CAAM;AACvC;;;;;;;;;;AAWA,SAAgB,cAAyB;CACvC,OAAO,EAAE,MAAMA,kBAAAA,UAAU,MAAM;AACjC;;;;;;;;;;AAWA,SAAgB,UAAU,OAAwB;CAChD,OAAO;EAAE,MAAMA,kBAAAA,UAAU;EAAK;CAAM;AACtC;;;;;ACjOA,MAAa,gBAAgBC,aAAAA,YAAyBC,kBAAAA,UAAU,OAAO;;;;;;;;;;;;ACqDvE,SAAgB,YAAY,YAA8C,CAAC,GAAc;CACvF,OAAO;EAAE,SAAS,CAAC;EAAG,YAAY,CAAC;EAAG,MAAM,CAAC;EAAG,GAAG;EAAW,MAAMC,kBAAAA,UAAU;CAAM;AACtF;;;;;ACnHA,MAAa,oBAAoBC,aAAAA,YAA6BC,kBAAAA,UAAU,WAAW;;ACsGnF,SAAgB,gBAAgB,OAAsC;CACpE,MAAM,EAAE,aAAa,GAAG,SAAS;CACjC,MAAM,SAAS,KAAK,WAAW,KAAA,KAAa,KAAK,SAAS,KAAA;CAY1D,OAAO;EATL,MAAM,CAAC;EACP,YAAY,CAAC;EACb,WAAW,CAAC;EACZ,GAAG;EACH,MAAMC,kBAAAA,UAAU;EAChB,GAAI,SAAS,EAAE,UAAU,OAAgB,IAAI,CAAC;EAC9C,aAAa,cAAc,kBAAkB,WAAW,IAAI,KAAA;CAGpD;AACZ;;;;;;;;;;;;;;;;ACnEA,SAAgB,gBAAgB,OAAyC;CACvE,MAAM,WAAW,MAAM,YAAY;CAEnC,OAAO;EAAE,GAAG;EAAO;EAAU,QAAQC,oBAAAA,iBAAiB,MAAM,QAAQ,QAAQ;EAAG,MAAMC,kBAAAA,UAAU;CAAU;AAC3G;;;;;;;;;;;;;;;;AC/CA,SAAgB,eAAe,OAAuC;CACpE,MAAM,WAAW,MAAM,YAAY;CAEnC,OAAO;EAAE,GAAG;EAAO;EAAU,QAAQC,oBAAAA,iBAAiB,MAAM,QAAQ,QAAQ;EAAG,MAAMC,kBAAAA,UAAU;CAAS;AAC1G;;;;;;;;;;;;;;ACqDA,SAAgB,eAAe,OAAoC;CACjE,MAAM,EAAE,QAAQ,WAAW,YAAY,SAAS,GAAG,SAAS;CAC5D,MAAM,UAAU,YAAY,SAAS,CAAC,cAAc;EAAE,aAAa,aAAa;EAAoB;EAAQ,YAAY,cAAc;CAAK,CAAC,CAAC,IAAI,KAAA;CAEjJ,OAAO;EAAE,GAAG;EAAM,SAAS;EAAS,MAAMC,kBAAAA,UAAU;CAAS;AAC/D"}
@@ -1,4 +1,4 @@
1
- import { n as DistributiveOmit, t as BaseNode } from "./base-IpYuh3ZP.cjs";
1
+ import { n as DistributiveOmit, t as BaseNode } from "./base-UFBZi-FO.cjs";
2
2
  /**
3
3
  * AST node representing one named object property.
4
4
  *
@@ -55,7 +55,7 @@ type PrimitiveSchemaType = 'string' | 'number' | 'integer' | 'bigint' | 'boolean
55
55
  */
56
56
  type SchemaType = keyof SchemaNodeByType;
57
57
  /**
58
- * Scalar schema types without extra object/array/ref structure or constraints.
58
+ * Scalar schema types without extra object/array/ref structure or constraints. `blob` stays for compatibility, but a blob node is a `BlobSchemaNode`.
59
59
  */
60
60
  type ScalarSchemaType = 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'blob' | 'ipv4' | 'ipv6';
61
61
  /**
@@ -123,6 +123,8 @@ type SchemaNodeBase = BaseNode & {
123
123
  */
124
124
  format?: string;
125
125
  externalDocs?: ExternalDocs;
126
+ /** Vendor extensions (`x-*` keys) from the source schema, copied as-is. */
127
+ extensions?: Record<string, unknown>;
126
128
  /**
127
129
  * `if`/`then`/`else`, `dependentRequired` and `dependentSchemas`. A required `unknown` property in `if` means "key is present".
128
130
  * Visitors do not walk it.
@@ -544,7 +546,13 @@ type ScalarSchemaNode = SchemaNodeBase & {
544
546
  /**
545
547
  * Schema type discriminator.
546
548
  */
547
- type: ScalarSchemaType;
549
+ type: Exclude<ScalarSchemaType, 'blob'>;
550
+ };
551
+ /** Binary data schema node, such as a `format: binary` string. */
552
+ type BlobSchemaNode = SchemaNodeBase & {
553
+ type: 'blob';
554
+ /** The media type and encoding of the bytes, from `contentMediaType` and `contentEncoding`. */
555
+ content?: StringSchemaNode['content'];
548
556
  };
549
557
  /**
550
558
  * URL schema node.
@@ -626,12 +634,12 @@ type SchemaNodeByType = {
626
634
  url: UrlSchemaNode;
627
635
  ipv4: ScalarSchemaNode;
628
636
  ipv6: ScalarSchemaNode;
629
- blob: ScalarSchemaNode;
637
+ blob: BlobSchemaNode;
630
638
  };
631
639
  /**
632
640
  * Union of all schema node types.
633
641
  */
634
- type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | NotSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | ScalarSchemaNode;
642
+ type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | NotSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | ScalarSchemaNode | BlobSchemaNode;
635
643
  type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & {
636
644
  properties?: Array<PropertyNode>;
637
645
  primitive?: 'object';
@@ -921,6 +929,8 @@ type ContentNode = BaseNode & {
921
929
  * Serialization of every part after `prefixEncoding`, for a body sent as an array of parts such as `multipart/mixed`.
922
930
  */
923
931
  itemEncoding?: EncodingNode;
932
+ /** Vendor extensions (`x-*` keys) from the source media type, copied as-is. */
933
+ extensions?: Record<string, unknown>;
924
934
  };
925
935
  /**
926
936
  * Creates a `ContentNode` for a single request-body or response content type.
@@ -994,6 +1004,8 @@ type ParameterNode = BaseNode & {
994
1004
  examples?: Array<ExampleNode>;
995
1005
  deprecated?: boolean;
996
1006
  allowEmptyValue?: boolean;
1007
+ /** Vendor extensions (`x-*` keys) from the source parameter, copied as-is. */
1008
+ extensions?: Record<string, unknown>;
997
1009
  };
998
1010
  type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>;
999
1011
  /**
@@ -1046,6 +1058,8 @@ type RequestBodyNode = BaseNode & {
1046
1058
  * `application/json` and `multipart/form-data`).
1047
1059
  */
1048
1060
  content?: Array<ContentNode>;
1061
+ /** Vendor extensions (`x-*` keys) from the source request body, copied as-is. */
1062
+ extensions?: Record<string, unknown>;
1049
1063
  };
1050
1064
  /**
1051
1065
  * Creates a `RequestBodyNode`.
@@ -1116,6 +1130,8 @@ type ResponseNode = BaseNode & {
1116
1130
  */
1117
1131
  headers?: Array<ParameterNode>;
1118
1132
  links?: Record<string, ResponseLink>;
1133
+ /** Vendor extensions (`x-*` keys) from the source response, copied as-is. */
1134
+ extensions?: Record<string, unknown>;
1119
1135
  };
1120
1136
  /**
1121
1137
  * A link to another operation. `parameters` and `requestBody` hold runtime expressions such as `$response.body#/id`.
@@ -1269,4 +1285,4 @@ declare function createOperation(props: Pick<HttpOperationNode, 'operationId' |
1269
1285
  declare function createOperation(props: Pick<GenericOperationNode, 'operationId'> & Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {
1270
1286
  requestBody?: Omit<RequestBodyNode, 'kind'>;
1271
1287
  }): GenericOperationNode;
1272
- export { ArraySchemaNode as A, ScalarSchemaNode as B, ExternalDocs as C, InputTag as D, InputServer as E, NotSchemaNode as F, StringSchemaNode as G, SchemaNode as H, NumberSchemaNode as I, UrlSchemaNode as J, TimeSchemaNode as K, ObjectSchemaNode as L, DatetimeSchemaNode as M, EnumSchemaNode as N, OAuthFlow as O, IntersectionSchemaNode as P, PrimitiveSchemaType as R, AuthScheme as S, InputNode as T, SchemaNodeByType as U, ScalarSchemaType as V, SchemaType as W, PropertyNode as X, createSchema as Y, createProperty as Z, EncodingNode as _, createOperation as a, AuthCredential as b, StatusCode as c, createRequestBody as d, ParameterLocation as f, ContentNode as g, createParameter as h, OperationNode as i, DateSchemaNode as j, createInput as k, createResponse as l, ParameterStyle as m, HttpMethod as n, ResponseLink as o, ParameterNode as p, UnionSchemaNode as q, HttpOperationNode as r, ResponseNode as s, GenericOperationNode as t, RequestBodyNode as u, ExampleNode as v, InputMeta as w, AuthRequirement as x, createContent as y, RefSchemaNode as z };
1288
+ export { ArraySchemaNode as A, RefSchemaNode as B, ExternalDocs as C, InputTag as D, InputServer as E, IntersectionSchemaNode as F, SchemaType as G, ScalarSchemaType as H, NotSchemaNode as I, UnionSchemaNode as J, StringSchemaNode as K, NumberSchemaNode as L, DateSchemaNode as M, DatetimeSchemaNode as N, OAuthFlow as O, EnumSchemaNode as P, createProperty as Q, ObjectSchemaNode as R, AuthScheme as S, InputNode as T, SchemaNode as U, ScalarSchemaNode as V, SchemaNodeByType as W, createSchema as X, UrlSchemaNode as Y, PropertyNode as Z, EncodingNode as _, createOperation as a, AuthCredential as b, StatusCode as c, createRequestBody as d, ParameterLocation as f, ContentNode as g, createParameter as h, OperationNode as i, BlobSchemaNode as j, createInput as k, createResponse as l, ParameterStyle as m, HttpMethod as n, ResponseLink as o, ParameterNode as p, TimeSchemaNode as q, HttpOperationNode as r, ResponseNode as s, GenericOperationNode as t, RequestBodyNode as u, ExampleNode as v, InputMeta as w, AuthRequirement as x, createContent as y, PrimitiveSchemaType as z };
@@ -1,4 +1,4 @@
1
- import { n as DistributiveOmit, t as BaseNode } from "./base-IpYuh3ZP.js";
1
+ import { n as DistributiveOmit, t as BaseNode } from "./base-LhsPvVY1.js";
2
2
  /**
3
3
  * AST node representing one named object property.
4
4
  *
@@ -55,7 +55,7 @@ type PrimitiveSchemaType = 'string' | 'number' | 'integer' | 'bigint' | 'boolean
55
55
  */
56
56
  type SchemaType = keyof SchemaNodeByType;
57
57
  /**
58
- * Scalar schema types without extra object/array/ref structure or constraints.
58
+ * Scalar schema types without extra object/array/ref structure or constraints. `blob` stays for compatibility, but a blob node is a `BlobSchemaNode`.
59
59
  */
60
60
  type ScalarSchemaType = 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'blob' | 'ipv4' | 'ipv6';
61
61
  /**
@@ -123,6 +123,8 @@ type SchemaNodeBase = BaseNode & {
123
123
  */
124
124
  format?: string;
125
125
  externalDocs?: ExternalDocs;
126
+ /** Vendor extensions (`x-*` keys) from the source schema, copied as-is. */
127
+ extensions?: Record<string, unknown>;
126
128
  /**
127
129
  * `if`/`then`/`else`, `dependentRequired` and `dependentSchemas`. A required `unknown` property in `if` means "key is present".
128
130
  * Visitors do not walk it.
@@ -544,7 +546,13 @@ type ScalarSchemaNode = SchemaNodeBase & {
544
546
  /**
545
547
  * Schema type discriminator.
546
548
  */
547
- type: ScalarSchemaType;
549
+ type: Exclude<ScalarSchemaType, 'blob'>;
550
+ };
551
+ /** Binary data schema node, such as a `format: binary` string. */
552
+ type BlobSchemaNode = SchemaNodeBase & {
553
+ type: 'blob';
554
+ /** The media type and encoding of the bytes, from `contentMediaType` and `contentEncoding`. */
555
+ content?: StringSchemaNode['content'];
548
556
  };
549
557
  /**
550
558
  * URL schema node.
@@ -626,12 +634,12 @@ type SchemaNodeByType = {
626
634
  url: UrlSchemaNode;
627
635
  ipv4: ScalarSchemaNode;
628
636
  ipv6: ScalarSchemaNode;
629
- blob: ScalarSchemaNode;
637
+ blob: BlobSchemaNode;
630
638
  };
631
639
  /**
632
640
  * Union of all schema node types.
633
641
  */
634
- type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | NotSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | ScalarSchemaNode;
642
+ type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | NotSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | ScalarSchemaNode | BlobSchemaNode;
635
643
  type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & {
636
644
  properties?: Array<PropertyNode>;
637
645
  primitive?: 'object';
@@ -921,6 +929,8 @@ type ContentNode = BaseNode & {
921
929
  * Serialization of every part after `prefixEncoding`, for a body sent as an array of parts such as `multipart/mixed`.
922
930
  */
923
931
  itemEncoding?: EncodingNode;
932
+ /** Vendor extensions (`x-*` keys) from the source media type, copied as-is. */
933
+ extensions?: Record<string, unknown>;
924
934
  };
925
935
  /**
926
936
  * Creates a `ContentNode` for a single request-body or response content type.
@@ -994,6 +1004,8 @@ type ParameterNode = BaseNode & {
994
1004
  examples?: Array<ExampleNode>;
995
1005
  deprecated?: boolean;
996
1006
  allowEmptyValue?: boolean;
1007
+ /** Vendor extensions (`x-*` keys) from the source parameter, copied as-is. */
1008
+ extensions?: Record<string, unknown>;
997
1009
  };
998
1010
  type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>;
999
1011
  /**
@@ -1046,6 +1058,8 @@ type RequestBodyNode = BaseNode & {
1046
1058
  * `application/json` and `multipart/form-data`).
1047
1059
  */
1048
1060
  content?: Array<ContentNode>;
1061
+ /** Vendor extensions (`x-*` keys) from the source request body, copied as-is. */
1062
+ extensions?: Record<string, unknown>;
1049
1063
  };
1050
1064
  /**
1051
1065
  * Creates a `RequestBodyNode`.
@@ -1116,6 +1130,8 @@ type ResponseNode = BaseNode & {
1116
1130
  */
1117
1131
  headers?: Array<ParameterNode>;
1118
1132
  links?: Record<string, ResponseLink>;
1133
+ /** Vendor extensions (`x-*` keys) from the source response, copied as-is. */
1134
+ extensions?: Record<string, unknown>;
1119
1135
  };
1120
1136
  /**
1121
1137
  * A link to another operation. `parameters` and `requestBody` hold runtime expressions such as `$response.body#/id`.
@@ -1269,4 +1285,4 @@ declare function createOperation(props: Pick<HttpOperationNode, 'operationId' |
1269
1285
  declare function createOperation(props: Pick<GenericOperationNode, 'operationId'> & Partial<Omit<GenericOperationNode, 'kind' | 'operationId' | 'requestBody'>> & {
1270
1286
  requestBody?: Omit<RequestBodyNode, 'kind'>;
1271
1287
  }): GenericOperationNode;
1272
- export { ArraySchemaNode as A, ScalarSchemaNode as B, ExternalDocs as C, InputTag as D, InputServer as E, NotSchemaNode as F, StringSchemaNode as G, SchemaNode as H, NumberSchemaNode as I, UrlSchemaNode as J, TimeSchemaNode as K, ObjectSchemaNode as L, DatetimeSchemaNode as M, EnumSchemaNode as N, OAuthFlow as O, IntersectionSchemaNode as P, PrimitiveSchemaType as R, AuthScheme as S, InputNode as T, SchemaNodeByType as U, ScalarSchemaType as V, SchemaType as W, PropertyNode as X, createSchema as Y, createProperty as Z, EncodingNode as _, createOperation as a, AuthCredential as b, StatusCode as c, createRequestBody as d, ParameterLocation as f, ContentNode as g, createParameter as h, OperationNode as i, DateSchemaNode as j, createInput as k, createResponse as l, ParameterStyle as m, HttpMethod as n, ResponseLink as o, ParameterNode as p, UnionSchemaNode as q, HttpOperationNode as r, ResponseNode as s, GenericOperationNode as t, RequestBodyNode as u, ExampleNode as v, InputMeta as w, AuthRequirement as x, createContent as y, RefSchemaNode as z };
1288
+ export { ArraySchemaNode as A, RefSchemaNode as B, ExternalDocs as C, InputTag as D, InputServer as E, IntersectionSchemaNode as F, SchemaType as G, ScalarSchemaType as H, NotSchemaNode as I, UnionSchemaNode as J, StringSchemaNode as K, NumberSchemaNode as L, DateSchemaNode as M, DatetimeSchemaNode as N, OAuthFlow as O, EnumSchemaNode as P, createProperty as Q, ObjectSchemaNode as R, AuthScheme as S, InputNode as T, SchemaNode as U, ScalarSchemaNode as V, SchemaNodeByType as W, createSchema as X, UrlSchemaNode as Y, PropertyNode as Z, EncodingNode as _, createOperation as a, AuthCredential as b, StatusCode as c, createRequestBody as d, ParameterLocation as f, ContentNode as g, createParameter as h, OperationNode as i, BlobSchemaNode as j, createInput as k, createResponse as l, ParameterStyle as m, HttpMethod as n, ResponseLink as o, ParameterNode as p, TimeSchemaNode as q, HttpOperationNode as r, ResponseNode as s, GenericOperationNode as t, RequestBodyNode as u, ExampleNode as v, InputMeta as w, AuthRequirement as x, createContent as y, PrimitiveSchemaType as z };
@@ -19,4 +19,4 @@ Object.defineProperty(exports, "applyOptionality", {
19
19
  }
20
20
  });
21
21
 
22
- //# sourceMappingURL=optionality-D-zqzVMH.cjs.map
22
+ //# sourceMappingURL=optionality-C-qULYxo.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"optionality-D-zqzVMH.cjs","names":[],"sources":["../src/optionality.ts"],"sourcesContent":["import type { SchemaNode } from './nodes/schema.ts'\n\n/**\n * Generic JSON Schema optionality: a non-required field is optional, and a\n * non-required nullable field is nullish.\n */\nexport function applyOptionality(schema: SchemaNode, required: boolean): SchemaNode {\n const nullable = schema.nullable ?? false\n\n return {\n ...schema,\n optional: !required && !nullable ? true : undefined,\n nullish: !required && nullable ? true : undefined,\n }\n}\n"],"mappings":";;;;;;AAMA,SAAgB,iBAAiB,QAAoB,UAA+B;CAClF,MAAM,WAAW,OAAO,YAAY;CAEpC,OAAO;EACL,GAAG;EACH,UAAU,CAAC,YAAY,CAAC,WAAW,OAAO,KAAA;EAC1C,SAAS,CAAC,YAAY,WAAW,OAAO,KAAA;CAC1C;AACF"}
1
+ {"version":3,"file":"optionality-C-qULYxo.cjs","names":[],"sources":["../src/optionality.ts"],"sourcesContent":["import type { SchemaNode } from './nodes/schema.ts'\n\n/**\n * Generic JSON Schema optionality: a non-required field is optional, and a\n * non-required nullable field is nullish.\n */\nexport function applyOptionality(schema: SchemaNode, required: boolean): SchemaNode {\n const nullable = schema.nullable ?? false\n\n return {\n ...schema,\n optional: !required && !nullable ? true : undefined,\n nullish: !required && nullable ? true : undefined,\n }\n}\n"],"mappings":";;;;;;AAMA,SAAgB,iBAAiB,QAAoB,UAA+B;CAClF,MAAM,WAAW,OAAO,YAAY;CAEpC,OAAO;EACL,GAAG;EACH,UAAU,CAAC,YAAY,CAAC,WAAW,OAAO,KAAA;EAC1C,SAAS,CAAC,YAAY,WAAW,OAAO,KAAA;CAC1C;AACF"}
@@ -14,4 +14,4 @@ function applyOptionality(schema, required) {
14
14
  }
15
15
  export { applyOptionality as t };
16
16
 
17
- //# sourceMappingURL=optionality-DISn8ytP.js.map
17
+ //# sourceMappingURL=optionality-FkRredTC.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"optionality-DISn8ytP.js","names":[],"sources":["../src/optionality.ts"],"sourcesContent":["import type { SchemaNode } from './nodes/schema.ts'\n\n/**\n * Generic JSON Schema optionality: a non-required field is optional, and a\n * non-required nullable field is nullish.\n */\nexport function applyOptionality(schema: SchemaNode, required: boolean): SchemaNode {\n const nullable = schema.nullable ?? false\n\n return {\n ...schema,\n optional: !required && !nullable ? true : undefined,\n nullish: !required && nullable ? true : undefined,\n }\n}\n"],"mappings":";;;;;;AAMA,SAAgB,iBAAiB,QAAoB,UAA+B;CAClF,MAAM,WAAW,OAAO,YAAY;CAEpC,OAAO;EACL,GAAG;EACH,UAAU,CAAC,YAAY,CAAC,WAAW,OAAO,KAAA;EAC1C,SAAS,CAAC,YAAY,WAAW,OAAO,KAAA;CAC1C;AACF"}
1
+ {"version":3,"file":"optionality-FkRredTC.js","names":[],"sources":["../src/optionality.ts"],"sourcesContent":["import type { SchemaNode } from './nodes/schema.ts'\n\n/**\n * Generic JSON Schema optionality: a non-required field is optional, and a\n * non-required nullable field is nullish.\n */\nexport function applyOptionality(schema: SchemaNode, required: boolean): SchemaNode {\n const nullable = schema.nullable ?? false\n\n return {\n ...schema,\n optional: !required && !nullable ? true : undefined,\n nullish: !required && nullable ? true : undefined,\n }\n}\n"],"mappings":";;;;;;AAMA,SAAgB,iBAAiB,QAAoB,UAA+B;CAClF,MAAM,WAAW,OAAO,YAAY;CAEpC,OAAO;EACL,GAAG;EACH,UAAU,CAAC,YAAY,CAAC,WAAW,OAAO,KAAA;EAC1C,SAAS,CAAC,YAAY,WAAW,OAAO,KAAA;CAC1C;AACF"}
@@ -42,4 +42,4 @@ function createStore({ weak, max } = {}) {
42
42
  memo.create = createStore;
43
43
  export { memo as t };
44
44
 
45
- //# sourceMappingURL=promise-RpnEev9D.js.map
45
+ //# sourceMappingURL=promise-B3YkZ4C8.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"promise-RpnEev9D.js","names":[],"sources":["../../../internals/utils/src/promise.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n const entry = new Map<TKey, TValue>()\n if (max === undefined) return entry\n const set = (key: TKey, value: TValue) => {\n if (entry.size >= max) entry.clear()\n entry.set(key, value)\n }\n if (max !== 1) return { has: (key) => entry.has(key), get: (key) => entry.get(key), set }\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n const touch = (key: TKey) => {\n if (!entry.has(key)) return false\n set(key, entry.get(key) as TValue)\n return true\n }\n return { has: touch, get: (key) => (touch(key) ? entry.get(key) : undefined), set }\n}\n\nmemo.create = createStore\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,KAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,WAAW,KAAA,KAAa,MAAM,IAAI,GAAG,GAAG,OAAO;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,IAAI,KAAK,KAAK;CACpB,OAAO;AACT;AA2BA,SAAS,YAA0B,EAAE,MAAM,QAA0C,CAAC,GAAwB;CAC5G,IAAI,MAAM,uBAAO,IAAI,QAAyB;CAC9C,MAAM,wBAAQ,IAAI,IAAkB;CACpC,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,MAAM,OAAO,KAAW,UAAkB;EACxC,IAAI,MAAM,QAAQ,KAAK,MAAM,MAAM;EACnC,MAAM,IAAI,KAAK,KAAK;CACtB;CACA,IAAI,QAAQ,GAAG,OAAO;EAAE,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG;CAAI;CAGxF,MAAM,SAAS,QAAc;EAC3B,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,OAAO;EAC5B,IAAI,KAAK,MAAM,IAAI,GAAG,CAAW;EACjC,OAAO;CACT;CACA,OAAO;EAAE,KAAK;EAAO,MAAM,QAAS,MAAM,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,KAAA;EAAY;CAAI;AACpF;AAEA,KAAK,SAAS"}
1
+ {"version":3,"file":"promise-B3YkZ4C8.js","names":[],"sources":["../../../internals/utils/src/promise.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n const entry = new Map<TKey, TValue>()\n if (max === undefined) return entry\n const set = (key: TKey, value: TValue) => {\n if (entry.size >= max) entry.clear()\n entry.set(key, value)\n }\n if (max !== 1) return { has: (key) => entry.has(key), get: (key) => entry.get(key), set }\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n const touch = (key: TKey) => {\n if (!entry.has(key)) return false\n set(key, entry.get(key) as TValue)\n return true\n }\n return { has: touch, get: (key) => (touch(key) ? entry.get(key) : undefined), set }\n}\n\nmemo.create = createStore\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,KAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,WAAW,KAAA,KAAa,MAAM,IAAI,GAAG,GAAG,OAAO;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,IAAI,KAAK,KAAK;CACpB,OAAO;AACT;AA2BA,SAAS,YAA0B,EAAE,MAAM,QAA0C,CAAC,GAAwB;CAC5G,IAAI,MAAM,uBAAO,IAAI,QAAyB;CAC9C,MAAM,wBAAQ,IAAI,IAAkB;CACpC,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,MAAM,OAAO,KAAW,UAAkB;EACxC,IAAI,MAAM,QAAQ,KAAK,MAAM,MAAM;EACnC,MAAM,IAAI,KAAK,KAAK;CACtB;CACA,IAAI,QAAQ,GAAG,OAAO;EAAE,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG;CAAI;CAGxF,MAAM,SAAS,QAAc;EAC3B,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,OAAO;EAC5B,IAAI,KAAK,MAAM,IAAI,GAAG,CAAW;EACjC,OAAO;CACT;CACA,OAAO;EAAE,KAAK;EAAO,MAAM,QAAS,MAAM,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,KAAA;EAAY;CAAI;AACpF;AAEA,KAAK,SAAS"}
@@ -47,4 +47,4 @@ Object.defineProperty(exports, "memo", {
47
47
  }
48
48
  });
49
49
 
50
- //# sourceMappingURL=promise-BOdlgT0N.cjs.map
50
+ //# sourceMappingURL=promise-DScaykew.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"promise-BOdlgT0N.cjs","names":[],"sources":["../../../internals/utils/src/promise.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n const entry = new Map<TKey, TValue>()\n if (max === undefined) return entry\n const set = (key: TKey, value: TValue) => {\n if (entry.size >= max) entry.clear()\n entry.set(key, value)\n }\n if (max !== 1) return { has: (key) => entry.has(key), get: (key) => entry.get(key), set }\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n const touch = (key: TKey) => {\n if (!entry.has(key)) return false\n set(key, entry.get(key) as TValue)\n return true\n }\n return { has: touch, get: (key) => (touch(key) ? entry.get(key) : undefined), set }\n}\n\nmemo.create = createStore\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,KAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,WAAW,KAAA,KAAa,MAAM,IAAI,GAAG,GAAG,OAAO;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,IAAI,KAAK,KAAK;CACpB,OAAO;AACT;AA2BA,SAAS,YAA0B,EAAE,MAAM,QAA0C,CAAC,GAAwB;CAC5G,IAAI,MAAM,uBAAO,IAAI,QAAyB;CAC9C,MAAM,wBAAQ,IAAI,IAAkB;CACpC,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,MAAM,OAAO,KAAW,UAAkB;EACxC,IAAI,MAAM,QAAQ,KAAK,MAAM,MAAM;EACnC,MAAM,IAAI,KAAK,KAAK;CACtB;CACA,IAAI,QAAQ,GAAG,OAAO;EAAE,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG;CAAI;CAGxF,MAAM,SAAS,QAAc;EAC3B,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,OAAO;EAC5B,IAAI,KAAK,MAAM,IAAI,GAAG,CAAW;EACjC,OAAO;CACT;CACA,OAAO;EAAE,KAAK;EAAO,MAAM,QAAS,MAAM,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,KAAA;EAAY;CAAI;AACpF;AAEA,KAAK,SAAS"}
1
+ {"version":3,"file":"promise-DScaykew.cjs","names":[],"sources":["../../../internals/utils/src/promise.ts"],"sourcesContent":["/** A value that may already be resolved or still pending.\n *\n * @example\n * ```ts\n * function load(id: string): PossiblePromise<string> {\n * return cache.get(id) ?? fetchRemote(id)\n * }\n * ```\n */\nexport type PossiblePromise<T> = Promise<T> | T\n\ntype Store<TKey, TValue> = {\n has(key: TKey): boolean\n get(key: TKey): TValue | undefined\n set(key: TKey, value: TValue): unknown\n}\n\n/**\n * Returns the value cached under `key` in `store`, computing and storing it on the first call.\n * Pass a `WeakMap` for object keys, so an entry goes away with its key, or a `Map` for primitive\n * keys. A cached `null` or `undefined` counts as a hit, so `compute` runs once per key.\n *\n * @example\n * `const refs = memo(refCache, node, () => collectRefs(node))`\n */\nexport function memo<TKey, TValue>(store: Store<TKey, TValue>, key: TKey, compute: () => TValue): TValue {\n const cached = store.get(key)\n if (cached !== undefined || store.has(key)) return cached as TValue\n const value = compute()\n store.set(key, value)\n return value\n}\n\n/**\n * Creates a store for `memo`. With no options it is a `Map`. Each option changes one thing:\n *\n * - `weak` holds the keys weakly, in a `WeakMap`, so an entry goes away with its key.\n * - `max` bounds the store: it empties itself before the entry that would pass `max`, which keeps a\n * cache in a long-running process from growing without end. `max: 1` keeps only the last entry.\n *\n * @example\n * `const patterns = memo.create<string, RegExp>()`\n *\n * @example Freed with its key\n * `const refs = memo.create<SchemaNode, Array<string>>({ weak: true })`\n *\n * @example Bounded\n * `const names = memo.create<string, string>({ max: 100_000 })`\n *\n * @example Many values per key\n * ```ts\n * const filesByPlugin = memo.create<string, Array<string>>()\n * memo(filesByPlugin, 'plugin-ts', () => []).push('models.ts')\n * ```\n */\nfunction createStore<TKey, TValue>(options?: { weak?: false; max?: undefined }): Map<TKey, TValue>\nfunction createStore<TKey extends WeakKey, TValue>(options: { weak: true; max?: undefined }): WeakMap<TKey, TValue>\nfunction createStore<TKey, TValue>(options: { max: number; weak?: false }): Store<TKey, TValue>\nfunction createStore<TKey, TValue>({ weak, max }: { weak?: boolean; max?: number } = {}): Store<TKey, TValue> {\n if (weak) return new WeakMap<WeakKey, TValue>() as Store<TKey, TValue>\n const entry = new Map<TKey, TValue>()\n if (max === undefined) return entry\n const set = (key: TKey, value: TValue) => {\n if (entry.size >= max) entry.clear()\n entry.set(key, value)\n }\n if (max !== 1) return { has: (key) => entry.has(key), get: (key) => entry.get(key), set }\n // A key equal to the stored one but a different object, such as a copy of a string, replaces the\n // stored key, so the next lookup is an identity hit instead of a full comparison.\n const touch = (key: TKey) => {\n if (!entry.has(key)) return false\n set(key, entry.get(key) as TValue)\n return true\n }\n return { has: touch, get: (key) => (touch(key) ? entry.get(key) : undefined), set }\n}\n\nmemo.create = createStore\n\ntype ParallelOptions<TItem> = {\n /**\n * Items to work through, handed out in order.\n */\n items: ReadonlyArray<TItem>\n /**\n * How many items may be in flight at once.\n */\n limit: number\n /**\n * Runs once per item, with the item's position so a caller can report progress.\n */\n run(item: TItem, index: number): Promise<void>\n}\n\n/**\n * Runs `run` over every item with at most `limit` in flight. Workers share one iterator, so each\n * takes the next item the moment it frees up instead of waiting for a batch to drain.\n *\n * @example\n * ```ts\n * await inParallel({ items: files, limit: 50, run: (file) => storage.writeItem(file.path, file.source) })\n * ```\n */\nexport async function inParallel<TItem>({ items, limit, run }: ParallelOptions<TItem>): Promise<void> {\n const queue = items.entries()\n\n const worker = async (): Promise<void> => {\n for (const [index, item] of queue) await run(item, index)\n }\n\n await Promise.all(Array.from({ length: Math.min(limit, items.length) }, () => worker()))\n}\n"],"mappings":";;;;;;;;;;AAyBA,SAAgB,KAAmB,OAA4B,KAAW,SAA+B;CACvG,MAAM,SAAS,MAAM,IAAI,GAAG;CAC5B,IAAI,WAAW,KAAA,KAAa,MAAM,IAAI,GAAG,GAAG,OAAO;CACnD,MAAM,QAAQ,QAAQ;CACtB,MAAM,IAAI,KAAK,KAAK;CACpB,OAAO;AACT;AA2BA,SAAS,YAA0B,EAAE,MAAM,QAA0C,CAAC,GAAwB;CAC5G,IAAI,MAAM,uBAAO,IAAI,QAAyB;CAC9C,MAAM,wBAAQ,IAAI,IAAkB;CACpC,IAAI,QAAQ,KAAA,GAAW,OAAO;CAC9B,MAAM,OAAO,KAAW,UAAkB;EACxC,IAAI,MAAM,QAAQ,KAAK,MAAM,MAAM;EACnC,MAAM,IAAI,KAAK,KAAK;CACtB;CACA,IAAI,QAAQ,GAAG,OAAO;EAAE,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG,MAAM,QAAQ,MAAM,IAAI,GAAG;EAAG;CAAI;CAGxF,MAAM,SAAS,QAAc;EAC3B,IAAI,CAAC,MAAM,IAAI,GAAG,GAAG,OAAO;EAC5B,IAAI,KAAK,MAAM,IAAI,GAAG,CAAW;EACjC,OAAO;CACT;CACA,OAAO;EAAE,KAAK;EAAO,MAAM,QAAS,MAAM,GAAG,IAAI,MAAM,IAAI,GAAG,IAAI,KAAA;EAAY;CAAI;AACpF;AAEA,KAAK,SAAS"}
@@ -1,7 +1,7 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
2
- const require_refs = require("./refs-CYHpRlQo.cjs");
3
- const require_guards = require("./guards-COVJE6TU.cjs");
4
- const require_schema = require("./schema-hxMlgCrV.cjs");
2
+ const require_refs = require("./refs-rmr2LFV1.cjs");
3
+ const require_guards = require("./guards-4drgx10i.cjs");
4
+ const require_schema = require("./schema-gSjYgaCl.cjs");
5
5
  // src/ref/index.ts
6
6
  var ref_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
7
7
  getName: () => getName,
@@ -36,4 +36,4 @@ Object.defineProperty(exports, "ref_exports", {
36
36
  }
37
37
  });
38
38
 
39
- //# sourceMappingURL=ref-P0ZLT1Bg.cjs.map
39
+ //# sourceMappingURL=ref-Bh5Xo8T7.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-P0ZLT1Bg.cjs","names":["narrowSchema","createSchema","mergeRefWithSchema","refName","resolveRefName"],"sources":["../src/ref/index.ts"],"sourcesContent":["export { isBareRef as isAlias, resolveRef as getSchema } from '../utils/refs.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createSchema, type SchemaNode } from '../nodes/schema.ts'\nimport { mergeRefWithSchema, refName, resolveRefName } from '../utils/refs.ts'\n\n/** A resolved ref merged with its target schema, so usage-site fields such as `description` win. Other nodes come back unchanged. */\nexport function mergeSchema(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n return ref?.schema ? createSchema(mergeRefWithSchema(ref)) : node\n}\n\n/**\n * The name a ref points at. A `$ref` string gives its last segment: `'#/components/schemas/Pet'` gives `'Pet'`.\n * A ref node gives its `targetName` first, so pass the node, not `node.ref`, to respect a renamed target. Other nodes give `null`.\n */\nexport function getName(ref: string): string\nexport function getName(node: SchemaNode | null | undefined): string | null\nexport function getName(input: string | SchemaNode | null | undefined): string | null {\n return typeof input === 'string' ? refName(input) : resolveRefName(input)\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAgB,YAAY,MAA8B;CACxD,MAAM,MAAMA,eAAAA,aAAa,MAAM,KAAK;CACpC,OAAO,KAAK,SAASC,eAAAA,aAAaC,aAAAA,mBAAmB,GAAG,CAAC,IAAI;AAC/D;AAQA,SAAgB,QAAQ,OAA8D;CACpF,OAAO,OAAO,UAAU,WAAWC,aAAAA,QAAQ,KAAK,IAAIC,aAAAA,eAAe,KAAK;AAC1E"}
1
+ {"version":3,"file":"ref-Bh5Xo8T7.cjs","names":["narrowSchema","createSchema","mergeRefWithSchema","refName","resolveRefName"],"sources":["../src/ref/index.ts"],"sourcesContent":["export { isBareRef as isAlias, resolveRef as getSchema } from '../utils/refs.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createSchema, type SchemaNode } from '../nodes/schema.ts'\nimport { mergeRefWithSchema, refName, resolveRefName } from '../utils/refs.ts'\n\n/** A resolved ref merged with its target schema, so usage-site fields such as `description` win. Other nodes come back unchanged. */\nexport function mergeSchema(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n return ref?.schema ? createSchema(mergeRefWithSchema(ref)) : node\n}\n\n/**\n * The name a ref points at. A `$ref` string gives its last segment: `'#/components/schemas/Pet'` gives `'Pet'`.\n * A ref node gives its `targetName` first, so pass the node, not `node.ref`, to respect a renamed target. Other nodes give `null`.\n */\nexport function getName(ref: string): string\nexport function getName(node: SchemaNode | null | undefined): string | null\nexport function getName(input: string | SchemaNode | null | undefined): string | null {\n return typeof input === 'string' ? refName(input) : resolveRefName(input)\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAgB,YAAY,MAA8B;CACxD,MAAM,MAAMA,eAAAA,aAAa,MAAM,KAAK;CACpC,OAAO,KAAK,SAASC,eAAAA,aAAaC,aAAAA,mBAAmB,GAAG,CAAC,IAAI;AAC/D;AAQA,SAAgB,QAAQ,OAA8D;CACpF,OAAO,OAAO,UAAU,WAAWC,aAAAA,QAAQ,KAAK,IAAIC,aAAAA,eAAe,KAAK;AAC1E"}
@@ -1,7 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BYyVTPww.js";
2
- import { a as resolveRefName, i as resolveRef, n as mergeRefWithSchema, r as refName, t as isBareRef } from "./refs-YCV3CznS.js";
3
- import { n as narrowSchema } from "./guards-DlJkKsT1.js";
4
- import { t as createSchema } from "./schema-2ZAQk7qE.js";
2
+ import { a as resolveRefName, i as resolveRef, n as mergeRefWithSchema, r as refName, t as isBareRef } from "./refs-Bgf8_9Ui.js";
3
+ import { n as narrowSchema } from "./guards-DKw4uwc5.js";
4
+ import { t as createSchema } from "./schema-tH14gE6i.js";
5
5
  // src/ref/index.ts
6
6
  var ref_exports = /* @__PURE__ */ __exportAll({
7
7
  getName: () => getName,
@@ -19,4 +19,4 @@ function getName(input) {
19
19
  }
20
20
  export { mergeSchema as n, ref_exports as r, getName as t };
21
21
 
22
- //# sourceMappingURL=ref-Bu7PoHar.js.map
22
+ //# sourceMappingURL=ref-DPqeS8K1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ref-Bu7PoHar.js","names":[],"sources":["../src/ref/index.ts"],"sourcesContent":["export { isBareRef as isAlias, resolveRef as getSchema } from '../utils/refs.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createSchema, type SchemaNode } from '../nodes/schema.ts'\nimport { mergeRefWithSchema, refName, resolveRefName } from '../utils/refs.ts'\n\n/** A resolved ref merged with its target schema, so usage-site fields such as `description` win. Other nodes come back unchanged. */\nexport function mergeSchema(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n return ref?.schema ? createSchema(mergeRefWithSchema(ref)) : node\n}\n\n/**\n * The name a ref points at. A `$ref` string gives its last segment: `'#/components/schemas/Pet'` gives `'Pet'`.\n * A ref node gives its `targetName` first, so pass the node, not `node.ref`, to respect a renamed target. Other nodes give `null`.\n */\nexport function getName(ref: string): string\nexport function getName(node: SchemaNode | null | undefined): string | null\nexport function getName(input: string | SchemaNode | null | undefined): string | null {\n return typeof input === 'string' ? refName(input) : resolveRefName(input)\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAgB,YAAY,MAA8B;CACxD,MAAM,MAAM,aAAa,MAAM,KAAK;CACpC,OAAO,KAAK,SAAS,aAAa,mBAAmB,GAAG,CAAC,IAAI;AAC/D;AAQA,SAAgB,QAAQ,OAA8D;CACpF,OAAO,OAAO,UAAU,WAAW,QAAQ,KAAK,IAAI,eAAe,KAAK;AAC1E"}
1
+ {"version":3,"file":"ref-DPqeS8K1.js","names":[],"sources":["../src/ref/index.ts"],"sourcesContent":["export { isBareRef as isAlias, resolveRef as getSchema } from '../utils/refs.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createSchema, type SchemaNode } from '../nodes/schema.ts'\nimport { mergeRefWithSchema, refName, resolveRefName } from '../utils/refs.ts'\n\n/** A resolved ref merged with its target schema, so usage-site fields such as `description` win. Other nodes come back unchanged. */\nexport function mergeSchema(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n return ref?.schema ? createSchema(mergeRefWithSchema(ref)) : node\n}\n\n/**\n * The name a ref points at. A `$ref` string gives its last segment: `'#/components/schemas/Pet'` gives `'Pet'`.\n * A ref node gives its `targetName` first, so pass the node, not `node.ref`, to respect a renamed target. Other nodes give `null`.\n */\nexport function getName(ref: string): string\nexport function getName(node: SchemaNode | null | undefined): string | null\nexport function getName(input: string | SchemaNode | null | undefined): string | null {\n return typeof input === 'string' ? refName(input) : resolveRefName(input)\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAgB,YAAY,MAA8B;CACxD,MAAM,MAAM,aAAa,MAAM,KAAK;CACpC,OAAO,KAAK,SAAS,aAAa,mBAAmB,GAAG,CAAC,IAAI;AAC/D;AAQA,SAAgB,QAAQ,OAA8D;CACpF,OAAO,OAAO,UAAU,WAAW,QAAQ,KAAK,IAAI,eAAe,KAAK;AAC1E"}
package/dist/ref.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_refs = require("./refs-CYHpRlQo.cjs");
3
- const require_ref = require("./ref-P0ZLT1Bg.cjs");
2
+ const require_refs = require("./refs-rmr2LFV1.cjs");
3
+ const require_ref = require("./ref-Bh5Xo8T7.cjs");
4
4
  exports.getName = require_ref.getName;
5
5
  exports.getSchema = require_refs.resolveRef;
6
6
  exports.isAlias = require_refs.isBareRef;
package/dist/ref.d.cts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as isBareRef, o as resolveRef, r as mergeSchema, t as getName } from "./index-DU_jYpBt.cjs";
1
+ import { i as isBareRef, o as resolveRef, r as mergeSchema, t as getName } from "./index-DpnCCtXt.cjs";
2
2
  export { getName, resolveRef as getSchema, isBareRef as isAlias, mergeSchema };
package/dist/ref.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { i as isBareRef, o as resolveRef, r as mergeSchema, t as getName } from "./index-CFH4ZC7q.js";
1
+ import { i as isBareRef, o as resolveRef, r as mergeSchema, t as getName } from "./index-DfRcRYF2.js";
2
2
  export { getName, resolveRef as getSchema, isBareRef as isAlias, mergeSchema };
package/dist/ref.js CHANGED
@@ -1,3 +1,3 @@
1
- import { i as resolveRef, t as isBareRef } from "./refs-YCV3CznS.js";
2
- import { n as mergeSchema, t as getName } from "./ref-Bu7PoHar.js";
1
+ import { i as resolveRef, t as isBareRef } from "./refs-Bgf8_9Ui.js";
2
+ import { n as mergeSchema, t as getName } from "./ref-DPqeS8K1.js";
3
3
  export { getName, resolveRef as getSchema, isBareRef as isAlias, mergeSchema };
@@ -1,5 +1,5 @@
1
1
  import "./rolldown-runtime-BYyVTPww.js";
2
- import { t as memo } from "./promise-RpnEev9D.js";
2
+ import { t as memo } from "./promise-B3YkZ4C8.js";
3
3
  // src/utils/refs.ts
4
4
  /**
5
5
  * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.
@@ -99,4 +99,4 @@ function isBareRef(node, keysToOmit) {
99
99
  }
100
100
  export { resolveRefName as a, resolveRef as i, mergeRefWithSchema as n, refName as r, isBareRef as t };
101
101
 
102
- //# sourceMappingURL=refs-YCV3CznS.js.map
102
+ //# sourceMappingURL=refs-Bgf8_9Ui.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"refs-YCV3CznS.js","names":[],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport type { RefSchemaNode, SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.\n * The segment is decoded like the pointer resolver does: percent-escapes first, then `~1` and `~0`\n * (RFC 6901), so `a~1b~0c` names the component `a/b~c`.\n */\nexport function refName(ref: string): string {\n return memo(refNames, ref, () => {\n const segment = ref.split('/').at(-1) ?? ref\n let decoded = segment\n\n try {\n decoded = decodeURIComponent(segment)\n } catch {\n // A stray `%` is not a valid escape, so the segment is already the literal name.\n }\n\n return decoded.replaceAll('~1', '/').replaceAll('~0', '~')\n })\n}\n\n// Every plugin resolves the same refs on every visit; the limit only bounds a long-running host.\nconst refNames = memo.create<string, string>({ max: 100_000 })\n\n/**\n * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when\n * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`,\n * then `name`, then the 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 *\n * @example Collision-renamed target\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'`\n */\nexport function resolveRefName(node: SchemaNode | null | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.targetName) return node.targetName\n if (node.ref) return refName(node.ref)\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Follows a resolved ref chain to its target schema. Returns an unresolved or cyclic ref as is.\n *\n * @example\n * ```ts\n * const target = resolveRef(refSchema)\n * ```\n */\nexport function resolveRef(node: SchemaNode): SchemaNode {\n if (node.type !== 'ref' || !node.schema) return node\n\n const seen = new WeakSet<SchemaNode>()\n let current: SchemaNode = node\n while (current.type === 'ref' && current.schema) {\n if (seen.has(current)) return current\n seen.add(current)\n current = current.schema\n }\n return current\n}\n\n/** Fields of a ref node that describe the ref itself, so they never override the resolved schema. */\nconst REF_OWN_KEYS: ReadonlySet<string> = new Set(['kind', 'type', 'name', 'ref', 'schema'])\n\n/**\n * Merges a ref node with its resolved schema, giving the fields set at the usage site precedence.\n *\n * Every field on the ref except `kind`, `type`, `name`, `ref`, and `schema` overrides the same field\n * of the resolved `schema` (for example `description`, `nullable`, `readOnly`, `deprecated`). Fields\n * left `undefined` on the ref do not shadow the resolved schema. A ref without a resolved `schema`\n * is returned as is.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A pet', schema: petSchema })\n * mergeRefWithSchema(ref) // petSchema's fields with description 'A pet'\n * ```\n */\nexport function mergeRefWithSchema(node: RefSchemaNode): SchemaNode {\n if (!node.schema) return node\n\n const merged: Record<string, unknown> = { ...node.schema }\n for (const key of Object.keys(node)) {\n const value = (node as Record<string, unknown>)[key]\n if (value !== undefined && !REF_OWN_KEYS.has(key)) merged[key] = value\n }\n\n return merged as SchemaNode\n}\n\n/**\n * Returns `true` when a schema is a bare ref without modifiers, metadata, or omit keys.\n *\n * Modifiers inherited from the resolved schema are included in the check because a ref emits the\n * referenced schema variable with those modifiers already applied.\n */\nexport function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean {\n if (!node || node.type !== 'ref') return false\n\n const meta = mergeRefWithSchema(node)\n\n return !meta.nullable && !meta.optional && !meta.nullish && meta.default === undefined && !meta.description && !meta.examples?.length && !keysToOmit?.length\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,QAAQ,KAAqB;CAC3C,OAAO,KAAK,UAAU,WAAW;EAC/B,MAAM,UAAU,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;EACzC,IAAI,UAAU;EAEd,IAAI;GACF,UAAU,mBAAmB,OAAO;EACtC,QAAQ,CAER;EAEA,OAAO,QAAQ,WAAW,MAAM,GAAG,CAAC,CAAC,WAAW,MAAM,GAAG;CAC3D,CAAC;AACH;AAGA,MAAM,WAAW,KAAK,OAAuB,EAAE,KAAK,IAAQ,CAAC;;;;;;;;;;;;;;AAe7D,SAAgB,eAAe,MAAoD;CACjF,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,YAAY,OAAO,KAAK;CACjC,IAAI,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;CAErC,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;AAUA,SAAgB,WAAW,MAA8B;CACvD,IAAI,KAAK,SAAS,SAAS,CAAC,KAAK,QAAQ,OAAO;CAEhD,MAAM,uBAAO,IAAI,QAAoB;CACrC,IAAI,UAAsB;CAC1B,OAAO,QAAQ,SAAS,SAAS,QAAQ,QAAQ;EAC/C,IAAI,KAAK,IAAI,OAAO,GAAG,OAAO;EAC9B,KAAK,IAAI,OAAO;EAChB,UAAU,QAAQ;CACpB;CACA,OAAO;AACT;;AAGA,MAAM,+BAAoC,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAQ;CAAO;AAAQ,CAAC;;;;;;;;;;;;;;;AAgB3F,SAAgB,mBAAmB,MAAiC;CAClE,IAAI,CAAC,KAAK,QAAQ,OAAO;CAEzB,MAAM,SAAkC,EAAE,GAAG,KAAK,OAAO;CACzD,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG;EACnC,MAAM,QAAS,KAAiC;EAChD,IAAI,UAAU,KAAA,KAAa,CAAC,aAAa,IAAI,GAAG,GAAG,OAAO,OAAO;CACnE;CAEA,OAAO;AACT;;;;;;;AAQA,SAAgB,UAAU,MAAqC,YAA4C;CACzG,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CAEzC,MAAM,OAAO,mBAAmB,IAAI;CAEpC,OAAO,CAAC,KAAK,YAAY,CAAC,KAAK,YAAY,CAAC,KAAK,WAAW,KAAK,YAAY,KAAA,KAAa,CAAC,KAAK,eAAe,CAAC,KAAK,UAAU,UAAU,CAAC,YAAY;AACxJ"}
1
+ {"version":3,"file":"refs-Bgf8_9Ui.js","names":[],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport type { RefSchemaNode, SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.\n * The segment is decoded like the pointer resolver does: percent-escapes first, then `~1` and `~0`\n * (RFC 6901), so `a~1b~0c` names the component `a/b~c`.\n */\nexport function refName(ref: string): string {\n return memo(refNames, ref, () => {\n const segment = ref.split('/').at(-1) ?? ref\n let decoded = segment\n\n try {\n decoded = decodeURIComponent(segment)\n } catch {\n // A stray `%` is not a valid escape, so the segment is already the literal name.\n }\n\n return decoded.replaceAll('~1', '/').replaceAll('~0', '~')\n })\n}\n\n// Every plugin resolves the same refs on every visit; the limit only bounds a long-running host.\nconst refNames = memo.create<string, string>({ max: 100_000 })\n\n/**\n * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when\n * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`,\n * then `name`, then the 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 *\n * @example Collision-renamed target\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'`\n */\nexport function resolveRefName(node: SchemaNode | null | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.targetName) return node.targetName\n if (node.ref) return refName(node.ref)\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Follows a resolved ref chain to its target schema. Returns an unresolved or cyclic ref as is.\n *\n * @example\n * ```ts\n * const target = resolveRef(refSchema)\n * ```\n */\nexport function resolveRef(node: SchemaNode): SchemaNode {\n if (node.type !== 'ref' || !node.schema) return node\n\n const seen = new WeakSet<SchemaNode>()\n let current: SchemaNode = node\n while (current.type === 'ref' && current.schema) {\n if (seen.has(current)) return current\n seen.add(current)\n current = current.schema\n }\n return current\n}\n\n/** Fields of a ref node that describe the ref itself, so they never override the resolved schema. */\nconst REF_OWN_KEYS: ReadonlySet<string> = new Set(['kind', 'type', 'name', 'ref', 'schema'])\n\n/**\n * Merges a ref node with its resolved schema, giving the fields set at the usage site precedence.\n *\n * Every field on the ref except `kind`, `type`, `name`, `ref`, and `schema` overrides the same field\n * of the resolved `schema` (for example `description`, `nullable`, `readOnly`, `deprecated`). Fields\n * left `undefined` on the ref do not shadow the resolved schema. A ref without a resolved `schema`\n * is returned as is.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A pet', schema: petSchema })\n * mergeRefWithSchema(ref) // petSchema's fields with description 'A pet'\n * ```\n */\nexport function mergeRefWithSchema(node: RefSchemaNode): SchemaNode {\n if (!node.schema) return node\n\n const merged: Record<string, unknown> = { ...node.schema }\n for (const key of Object.keys(node)) {\n const value = (node as Record<string, unknown>)[key]\n if (value !== undefined && !REF_OWN_KEYS.has(key)) merged[key] = value\n }\n\n return merged as SchemaNode\n}\n\n/**\n * Returns `true` when a schema is a bare ref without modifiers, metadata, or omit keys.\n *\n * Modifiers inherited from the resolved schema are included in the check because a ref emits the\n * referenced schema variable with those modifiers already applied.\n */\nexport function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean {\n if (!node || node.type !== 'ref') return false\n\n const meta = mergeRefWithSchema(node)\n\n return !meta.nullable && !meta.optional && !meta.nullish && meta.default === undefined && !meta.description && !meta.examples?.length && !keysToOmit?.length\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,QAAQ,KAAqB;CAC3C,OAAO,KAAK,UAAU,WAAW;EAC/B,MAAM,UAAU,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;EACzC,IAAI,UAAU;EAEd,IAAI;GACF,UAAU,mBAAmB,OAAO;EACtC,QAAQ,CAER;EAEA,OAAO,QAAQ,WAAW,MAAM,GAAG,CAAC,CAAC,WAAW,MAAM,GAAG;CAC3D,CAAC;AACH;AAGA,MAAM,WAAW,KAAK,OAAuB,EAAE,KAAK,IAAQ,CAAC;;;;;;;;;;;;;;AAe7D,SAAgB,eAAe,MAAoD;CACjF,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,YAAY,OAAO,KAAK;CACjC,IAAI,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;CAErC,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;AAUA,SAAgB,WAAW,MAA8B;CACvD,IAAI,KAAK,SAAS,SAAS,CAAC,KAAK,QAAQ,OAAO;CAEhD,MAAM,uBAAO,IAAI,QAAoB;CACrC,IAAI,UAAsB;CAC1B,OAAO,QAAQ,SAAS,SAAS,QAAQ,QAAQ;EAC/C,IAAI,KAAK,IAAI,OAAO,GAAG,OAAO;EAC9B,KAAK,IAAI,OAAO;EAChB,UAAU,QAAQ;CACpB;CACA,OAAO;AACT;;AAGA,MAAM,+BAAoC,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAQ;CAAO;AAAQ,CAAC;;;;;;;;;;;;;;;AAgB3F,SAAgB,mBAAmB,MAAiC;CAClE,IAAI,CAAC,KAAK,QAAQ,OAAO;CAEzB,MAAM,SAAkC,EAAE,GAAG,KAAK,OAAO;CACzD,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG;EACnC,MAAM,QAAS,KAAiC;EAChD,IAAI,UAAU,KAAA,KAAa,CAAC,aAAa,IAAI,GAAG,GAAG,OAAO,OAAO;CACnE;CAEA,OAAO;AACT;;;;;;;AAQA,SAAgB,UAAU,MAAqC,YAA4C;CACzG,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CAEzC,MAAM,OAAO,mBAAmB,IAAI;CAEpC,OAAO,CAAC,KAAK,YAAY,CAAC,KAAK,YAAY,CAAC,KAAK,WAAW,KAAK,YAAY,KAAA,KAAa,CAAC,KAAK,eAAe,CAAC,KAAK,UAAU,UAAU,CAAC,YAAY;AACxJ"}
@@ -1,5 +1,5 @@
1
1
  require("./rolldown-runtime-BV8xUvPy.cjs");
2
- const require_promise = require("./promise-BOdlgT0N.cjs");
2
+ const require_promise = require("./promise-DScaykew.cjs");
3
3
  // src/utils/refs.ts
4
4
  /**
5
5
  * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.
@@ -128,4 +128,4 @@ Object.defineProperty(exports, "resolveRefName", {
128
128
  }
129
129
  });
130
130
 
131
- //# sourceMappingURL=refs-CYHpRlQo.cjs.map
131
+ //# sourceMappingURL=refs-rmr2LFV1.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"refs-CYHpRlQo.cjs","names":["memo"],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport type { RefSchemaNode, SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.\n * The segment is decoded like the pointer resolver does: percent-escapes first, then `~1` and `~0`\n * (RFC 6901), so `a~1b~0c` names the component `a/b~c`.\n */\nexport function refName(ref: string): string {\n return memo(refNames, ref, () => {\n const segment = ref.split('/').at(-1) ?? ref\n let decoded = segment\n\n try {\n decoded = decodeURIComponent(segment)\n } catch {\n // A stray `%` is not a valid escape, so the segment is already the literal name.\n }\n\n return decoded.replaceAll('~1', '/').replaceAll('~0', '~')\n })\n}\n\n// Every plugin resolves the same refs on every visit; the limit only bounds a long-running host.\nconst refNames = memo.create<string, string>({ max: 100_000 })\n\n/**\n * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when\n * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`,\n * then `name`, then the 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 *\n * @example Collision-renamed target\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'`\n */\nexport function resolveRefName(node: SchemaNode | null | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.targetName) return node.targetName\n if (node.ref) return refName(node.ref)\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Follows a resolved ref chain to its target schema. Returns an unresolved or cyclic ref as is.\n *\n * @example\n * ```ts\n * const target = resolveRef(refSchema)\n * ```\n */\nexport function resolveRef(node: SchemaNode): SchemaNode {\n if (node.type !== 'ref' || !node.schema) return node\n\n const seen = new WeakSet<SchemaNode>()\n let current: SchemaNode = node\n while (current.type === 'ref' && current.schema) {\n if (seen.has(current)) return current\n seen.add(current)\n current = current.schema\n }\n return current\n}\n\n/** Fields of a ref node that describe the ref itself, so they never override the resolved schema. */\nconst REF_OWN_KEYS: ReadonlySet<string> = new Set(['kind', 'type', 'name', 'ref', 'schema'])\n\n/**\n * Merges a ref node with its resolved schema, giving the fields set at the usage site precedence.\n *\n * Every field on the ref except `kind`, `type`, `name`, `ref`, and `schema` overrides the same field\n * of the resolved `schema` (for example `description`, `nullable`, `readOnly`, `deprecated`). Fields\n * left `undefined` on the ref do not shadow the resolved schema. A ref without a resolved `schema`\n * is returned as is.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A pet', schema: petSchema })\n * mergeRefWithSchema(ref) // petSchema's fields with description 'A pet'\n * ```\n */\nexport function mergeRefWithSchema(node: RefSchemaNode): SchemaNode {\n if (!node.schema) return node\n\n const merged: Record<string, unknown> = { ...node.schema }\n for (const key of Object.keys(node)) {\n const value = (node as Record<string, unknown>)[key]\n if (value !== undefined && !REF_OWN_KEYS.has(key)) merged[key] = value\n }\n\n return merged as SchemaNode\n}\n\n/**\n * Returns `true` when a schema is a bare ref without modifiers, metadata, or omit keys.\n *\n * Modifiers inherited from the resolved schema are included in the check because a ref emits the\n * referenced schema variable with those modifiers already applied.\n */\nexport function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean {\n if (!node || node.type !== 'ref') return false\n\n const meta = mergeRefWithSchema(node)\n\n return !meta.nullable && !meta.optional && !meta.nullish && meta.default === undefined && !meta.description && !meta.examples?.length && !keysToOmit?.length\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,QAAQ,KAAqB;CAC3C,OAAOA,gBAAAA,KAAK,UAAU,WAAW;EAC/B,MAAM,UAAU,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;EACzC,IAAI,UAAU;EAEd,IAAI;GACF,UAAU,mBAAmB,OAAO;EACtC,QAAQ,CAER;EAEA,OAAO,QAAQ,WAAW,MAAM,GAAG,CAAC,CAAC,WAAW,MAAM,GAAG;CAC3D,CAAC;AACH;AAGA,MAAM,WAAWA,gBAAAA,KAAK,OAAuB,EAAE,KAAK,IAAQ,CAAC;;;;;;;;;;;;;;AAe7D,SAAgB,eAAe,MAAoD;CACjF,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,YAAY,OAAO,KAAK;CACjC,IAAI,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;CAErC,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;AAUA,SAAgB,WAAW,MAA8B;CACvD,IAAI,KAAK,SAAS,SAAS,CAAC,KAAK,QAAQ,OAAO;CAEhD,MAAM,uBAAO,IAAI,QAAoB;CACrC,IAAI,UAAsB;CAC1B,OAAO,QAAQ,SAAS,SAAS,QAAQ,QAAQ;EAC/C,IAAI,KAAK,IAAI,OAAO,GAAG,OAAO;EAC9B,KAAK,IAAI,OAAO;EAChB,UAAU,QAAQ;CACpB;CACA,OAAO;AACT;;AAGA,MAAM,+BAAoC,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAQ;CAAO;AAAQ,CAAC;;;;;;;;;;;;;;;AAgB3F,SAAgB,mBAAmB,MAAiC;CAClE,IAAI,CAAC,KAAK,QAAQ,OAAO;CAEzB,MAAM,SAAkC,EAAE,GAAG,KAAK,OAAO;CACzD,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG;EACnC,MAAM,QAAS,KAAiC;EAChD,IAAI,UAAU,KAAA,KAAa,CAAC,aAAa,IAAI,GAAG,GAAG,OAAO,OAAO;CACnE;CAEA,OAAO;AACT;;;;;;;AAQA,SAAgB,UAAU,MAAqC,YAA4C;CACzG,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CAEzC,MAAM,OAAO,mBAAmB,IAAI;CAEpC,OAAO,CAAC,KAAK,YAAY,CAAC,KAAK,YAAY,CAAC,KAAK,WAAW,KAAK,YAAY,KAAA,KAAa,CAAC,KAAK,eAAe,CAAC,KAAK,UAAU,UAAU,CAAC,YAAY;AACxJ"}
1
+ {"version":3,"file":"refs-rmr2LFV1.cjs","names":["memo"],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { memo } from '@internals/utils'\nimport type { RefSchemaNode, SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Returns the last segment of a `$ref` pointer, for example `'Pet'` for `#/components/schemas/Pet`.\n * The segment is decoded like the pointer resolver does: percent-escapes first, then `~1` and `~0`\n * (RFC 6901), so `a~1b~0c` names the component `a/b~c`.\n */\nexport function refName(ref: string): string {\n return memo(refNames, ref, () => {\n const segment = ref.split('/').at(-1) ?? ref\n let decoded = segment\n\n try {\n decoded = decodeURIComponent(segment)\n } catch {\n // A stray `%` is not a valid escape, so the segment is already the literal name.\n }\n\n return decoded.replaceAll('~1', '/').replaceAll('~0', '~')\n })\n}\n\n// Every plugin resolves the same refs on every visit; the limit only bounds a long-running host.\nconst refNames = memo.create<string, string>({ max: 100_000 })\n\n/**\n * Resolves the emitted name of the schema a ref node points at. Prefers `targetName` (set when\n * the referenced schema was renamed, e.g. to break a collision), then the last segment of `ref`,\n * then `name`, then the 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 *\n * @example Collision-renamed target\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'`\n */\nexport function resolveRefName(node: SchemaNode | null | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.targetName) return node.targetName\n if (node.ref) return refName(node.ref)\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Follows a resolved ref chain to its target schema. Returns an unresolved or cyclic ref as is.\n *\n * @example\n * ```ts\n * const target = resolveRef(refSchema)\n * ```\n */\nexport function resolveRef(node: SchemaNode): SchemaNode {\n if (node.type !== 'ref' || !node.schema) return node\n\n const seen = new WeakSet<SchemaNode>()\n let current: SchemaNode = node\n while (current.type === 'ref' && current.schema) {\n if (seen.has(current)) return current\n seen.add(current)\n current = current.schema\n }\n return current\n}\n\n/** Fields of a ref node that describe the ref itself, so they never override the resolved schema. */\nconst REF_OWN_KEYS: ReadonlySet<string> = new Set(['kind', 'type', 'name', 'ref', 'schema'])\n\n/**\n * Merges a ref node with its resolved schema, giving the fields set at the usage site precedence.\n *\n * Every field on the ref except `kind`, `type`, `name`, `ref`, and `schema` overrides the same field\n * of the resolved `schema` (for example `description`, `nullable`, `readOnly`, `deprecated`). Fields\n * left `undefined` on the ref do not shadow the resolved schema. A ref without a resolved `schema`\n * is returned as is.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A pet', schema: petSchema })\n * mergeRefWithSchema(ref) // petSchema's fields with description 'A pet'\n * ```\n */\nexport function mergeRefWithSchema(node: RefSchemaNode): SchemaNode {\n if (!node.schema) return node\n\n const merged: Record<string, unknown> = { ...node.schema }\n for (const key of Object.keys(node)) {\n const value = (node as Record<string, unknown>)[key]\n if (value !== undefined && !REF_OWN_KEYS.has(key)) merged[key] = value\n }\n\n return merged as SchemaNode\n}\n\n/**\n * Returns `true` when a schema is a bare ref without modifiers, metadata, or omit keys.\n *\n * Modifiers inherited from the resolved schema are included in the check because a ref emits the\n * referenced schema variable with those modifiers already applied.\n */\nexport function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean {\n if (!node || node.type !== 'ref') return false\n\n const meta = mergeRefWithSchema(node)\n\n return !meta.nullable && !meta.optional && !meta.nullish && meta.default === undefined && !meta.description && !meta.examples?.length && !keysToOmit?.length\n}\n"],"mappings":";;;;;;;;AAQA,SAAgB,QAAQ,KAAqB;CAC3C,OAAOA,gBAAAA,KAAK,UAAU,WAAW;EAC/B,MAAM,UAAU,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;EACzC,IAAI,UAAU;EAEd,IAAI;GACF,UAAU,mBAAmB,OAAO;EACtC,QAAQ,CAER;EAEA,OAAO,QAAQ,WAAW,MAAM,GAAG,CAAC,CAAC,WAAW,MAAM,GAAG;CAC3D,CAAC;AACH;AAGA,MAAM,WAAWA,gBAAAA,KAAK,OAAuB,EAAE,KAAK,IAAQ,CAAC;;;;;;;;;;;;;;AAe7D,SAAgB,eAAe,MAAoD;CACjF,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,YAAY,OAAO,KAAK;CACjC,IAAI,KAAK,KAAK,OAAO,QAAQ,KAAK,GAAG;CAErC,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;AAUA,SAAgB,WAAW,MAA8B;CACvD,IAAI,KAAK,SAAS,SAAS,CAAC,KAAK,QAAQ,OAAO;CAEhD,MAAM,uBAAO,IAAI,QAAoB;CACrC,IAAI,UAAsB;CAC1B,OAAO,QAAQ,SAAS,SAAS,QAAQ,QAAQ;EAC/C,IAAI,KAAK,IAAI,OAAO,GAAG,OAAO;EAC9B,KAAK,IAAI,OAAO;EAChB,UAAU,QAAQ;CACpB;CACA,OAAO;AACT;;AAGA,MAAM,+BAAoC,IAAI,IAAI;CAAC;CAAQ;CAAQ;CAAQ;CAAO;AAAQ,CAAC;;;;;;;;;;;;;;;AAgB3F,SAAgB,mBAAmB,MAAiC;CAClE,IAAI,CAAC,KAAK,QAAQ,OAAO;CAEzB,MAAM,SAAkC,EAAE,GAAG,KAAK,OAAO;CACzD,KAAK,MAAM,OAAO,OAAO,KAAK,IAAI,GAAG;EACnC,MAAM,QAAS,KAAiC;EAChD,IAAI,UAAU,KAAA,KAAa,CAAC,aAAa,IAAI,GAAG,GAAG,OAAO,OAAO;CACnE;CAEA,OAAO;AACT;;;;;;;AAQA,SAAgB,UAAU,MAAqC,YAA4C;CACzG,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CAEzC,MAAM,OAAO,mBAAmB,IAAI;CAEpC,OAAO,CAAC,KAAK,YAAY,CAAC,KAAK,YAAY,CAAC,KAAK,WAAW,KAAK,YAAY,KAAA,KAAa,CAAC,KAAK,eAAe,CAAC,KAAK,UAAU,UAAU,CAAC,YAAY;AACxJ"}
@@ -1,10 +1,10 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-BYyVTPww.js";
2
- import { t as applyOptionality } from "./optionality-DISn8ytP.js";
3
- import { n as schemaTypes } from "./constants-Ckeonm-D.js";
4
- import { n as narrowSchema } from "./guards-DlJkKsT1.js";
5
- import { n as findSchema, o as getEmbeddedJson } from "./visitor-NoQSUQTu.js";
6
- import { n as mergeSchema } from "./ref-Bu7PoHar.js";
7
- import { t as memo } from "./promise-RpnEev9D.js";
2
+ import { t as applyOptionality } from "./optionality-FkRredTC.js";
3
+ import { n as schemaTypes } from "./constants-BTTus9ee.js";
4
+ import { n as narrowSchema } from "./guards-DKw4uwc5.js";
5
+ import { n as findSchema, o as getEmbeddedJson } from "./visitor-XA0W3OVv.js";
6
+ import { n as mergeSchema } from "./ref-DPqeS8K1.js";
7
+ import { t as memo } from "./promise-B3YkZ4C8.js";
8
8
  // src/schema/is.ts
9
9
  const plainStringTypes = /* @__PURE__ */ new Set([
10
10
  "string",
@@ -176,4 +176,4 @@ function isString(node) {
176
176
  }
177
177
  export { resolveSchemaProperties as a, inferDiscriminatorPropertyName as i, schema_exports as n, is as o, getSchemaLiteralValues as r, isString as t };
178
178
 
179
- //# sourceMappingURL=schema-DloctnMm.js.map
179
+ //# sourceMappingURL=schema-4UcdIPQ2.js.map