openapi-typesafe 1.0.0-rc.2 → 1.0.0-rc.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 (514) hide show
  1. package/CHANGELOG.md +1831 -0
  2. package/dist/adapters/node-deprecations/node-deprecations.cjs +14 -0
  3. package/dist/adapters/node-deprecations/node-deprecations.cjs.map +1 -0
  4. package/dist/adapters/node-deprecations/node-deprecations.mjs +12 -0
  5. package/dist/adapters/node-deprecations/node-deprecations.mjs.map +1 -0
  6. package/dist/adapters/node-file-system/file-claims.cjs +105 -0
  7. package/dist/adapters/node-file-system/file-claims.cjs.map +1 -0
  8. package/dist/adapters/node-file-system/file-claims.mjs +95 -0
  9. package/dist/adapters/node-file-system/file-claims.mjs.map +1 -0
  10. package/dist/adapters/node-file-system/file-identity.cjs +82 -0
  11. package/dist/adapters/node-file-system/file-identity.cjs.map +1 -0
  12. package/dist/adapters/node-file-system/file-identity.mjs +74 -0
  13. package/dist/adapters/node-file-system/file-identity.mjs.map +1 -0
  14. package/dist/adapters/node-file-system/node-file-system.cjs +90 -14
  15. package/dist/adapters/node-file-system/node-file-system.cjs.map +1 -1
  16. package/dist/adapters/node-file-system/node-file-system.mjs +90 -14
  17. package/dist/adapters/node-file-system/node-file-system.mjs.map +1 -1
  18. package/dist/adapters/redocly-loader/bundled-mapping-copies.cjs +75 -0
  19. package/dist/adapters/redocly-loader/bundled-mapping-copies.cjs.map +1 -0
  20. package/dist/adapters/redocly-loader/bundled-mapping-copies.mjs +72 -0
  21. package/dist/adapters/redocly-loader/bundled-mapping-copies.mjs.map +1 -0
  22. package/dist/adapters/redocly-loader/bundled-ref-repair.cjs +1 -1
  23. package/dist/adapters/redocly-loader/bundled-ref-repair.cjs.map +1 -1
  24. package/dist/adapters/redocly-loader/bundled-ref-repair.mjs +2 -2
  25. package/dist/adapters/redocly-loader/bundled-ref-repair.mjs.map +1 -1
  26. package/dist/adapters/redocly-loader/loaded-documents.cjs +28 -0
  27. package/dist/adapters/redocly-loader/loaded-documents.cjs.map +1 -0
  28. package/dist/adapters/redocly-loader/loaded-documents.mjs +21 -0
  29. package/dist/adapters/redocly-loader/loaded-documents.mjs.map +1 -0
  30. package/dist/adapters/redocly-loader/redocly-schema-loader.cjs +14 -15
  31. package/dist/adapters/redocly-loader/redocly-schema-loader.cjs.map +1 -1
  32. package/dist/adapters/redocly-loader/redocly-schema-loader.mjs +12 -13
  33. package/dist/adapters/redocly-loader/redocly-schema-loader.mjs.map +1 -1
  34. package/dist/adapters/redocly-loader/ref-access.cjs +31 -3
  35. package/dist/adapters/redocly-loader/ref-access.cjs.map +1 -1
  36. package/dist/adapters/redocly-loader/ref-access.mjs +31 -3
  37. package/dist/adapters/redocly-loader/ref-access.mjs.map +1 -1
  38. package/dist/adapters/redocly-loader/ref-holders.cjs +2 -2
  39. package/dist/adapters/redocly-loader/ref-holders.cjs.map +1 -1
  40. package/dist/adapters/redocly-loader/ref-holders.mjs +3 -3
  41. package/dist/adapters/redocly-loader/ref-holders.mjs.map +1 -1
  42. package/dist/adapters/redocly-loader/remote-body-limit.cjs +50 -0
  43. package/dist/adapters/redocly-loader/remote-body-limit.cjs.map +1 -0
  44. package/dist/adapters/redocly-loader/remote-body-limit.mjs +48 -0
  45. package/dist/adapters/redocly-loader/remote-body-limit.mjs.map +1 -0
  46. package/dist/adapters/redocly-loader/remote-fetch.cjs +35 -6
  47. package/dist/adapters/redocly-loader/remote-fetch.cjs.map +1 -1
  48. package/dist/adapters/redocly-loader/remote-fetch.mjs +35 -6
  49. package/dist/adapters/redocly-loader/remote-fetch.mjs.map +1 -1
  50. package/dist/adapters/redocly-loader/remote-node-limit.cjs +47 -0
  51. package/dist/adapters/redocly-loader/remote-node-limit.cjs.map +1 -0
  52. package/dist/adapters/redocly-loader/remote-node-limit.mjs +44 -0
  53. package/dist/adapters/redocly-loader/remote-node-limit.mjs.map +1 -0
  54. package/dist/adapters/redocly-loader/schema-load-errors.cjs +32 -8
  55. package/dist/adapters/redocly-loader/schema-load-errors.cjs.map +1 -1
  56. package/dist/adapters/redocly-loader/schema-load-errors.mjs +32 -9
  57. package/dist/adapters/redocly-loader/schema-load-errors.mjs.map +1 -1
  58. package/dist/adapters/redocly-loader/schema-source.cjs +11 -7
  59. package/dist/adapters/redocly-loader/schema-source.cjs.map +1 -1
  60. package/dist/adapters/redocly-loader/schema-source.mjs +12 -8
  61. package/dist/adapters/redocly-loader/schema-source.mjs.map +1 -1
  62. package/dist/adapters/redocly-loader/unsupported-keys.cjs +3 -5
  63. package/dist/adapters/redocly-loader/unsupported-keys.cjs.map +1 -1
  64. package/dist/adapters/redocly-loader/unsupported-keys.mjs +3 -5
  65. package/dist/adapters/redocly-loader/unsupported-keys.mjs.map +1 -1
  66. package/dist/adapters/terminal-logger/terminal-logger.cjs +6 -4
  67. package/dist/adapters/terminal-logger/terminal-logger.cjs.map +1 -1
  68. package/dist/adapters/terminal-logger/terminal-logger.mjs +6 -4
  69. package/dist/adapters/terminal-logger/terminal-logger.mjs.map +1 -1
  70. package/dist/api/default-ports.cjs +19 -2
  71. package/dist/api/default-ports.cjs.map +1 -1
  72. package/dist/api/default-ports.mjs +19 -3
  73. package/dist/api/default-ports.mjs.map +1 -1
  74. package/dist/api/discriminator-conflict-warnings.cjs +1 -1
  75. package/dist/api/discriminator-conflict-warnings.cjs.map +1 -1
  76. package/dist/api/discriminator-conflict-warnings.mjs +2 -2
  77. package/dist/api/discriminator-conflict-warnings.mjs.map +1 -1
  78. package/dist/api/discriminator-enum-parent.cjs +2 -2
  79. package/dist/api/discriminator-enum-parent.cjs.map +1 -1
  80. package/dist/api/discriminator-enum-parent.mjs +3 -3
  81. package/dist/api/discriminator-enum-parent.mjs.map +1 -1
  82. package/dist/api/discriminator-other-owners.cjs +5 -3
  83. package/dist/api/discriminator-other-owners.cjs.map +1 -1
  84. package/dist/api/discriminator-other-owners.mjs +5 -3
  85. package/dist/api/discriminator-other-owners.mjs.map +1 -1
  86. package/dist/api/discriminator-patch.cjs +8 -4
  87. package/dist/api/discriminator-patch.cjs.map +1 -1
  88. package/dist/api/discriminator-patch.mjs +9 -5
  89. package/dist/api/discriminator-patch.mjs.map +1 -1
  90. package/dist/api/discriminator-scan.cjs +17 -10
  91. package/dist/api/discriminator-scan.cjs.map +1 -1
  92. package/dist/api/discriminator-scan.mjs +18 -11
  93. package/dist/api/discriminator-scan.mjs.map +1 -1
  94. package/dist/api/document-run.cjs +4 -3
  95. package/dist/api/document-run.cjs.map +1 -1
  96. package/dist/api/document-run.mjs +4 -3
  97. package/dist/api/document-run.mjs.map +1 -1
  98. package/dist/api/legacy-callback-warning.cjs +7 -4
  99. package/dist/api/legacy-callback-warning.cjs.map +1 -1
  100. package/dist/api/legacy-callback-warning.mjs +8 -5
  101. package/dist/api/legacy-callback-warning.mjs.map +1 -1
  102. package/dist/api/legacy-utils.cjs.map +1 -1
  103. package/dist/api/legacy-utils.mjs.map +1 -1
  104. package/dist/api/openapi-ts.cjs +9 -5
  105. package/dist/api/openapi-ts.cjs.map +1 -1
  106. package/dist/api/openapi-ts.mjs +10 -7
  107. package/dist/api/openapi-ts.mjs.map +1 -1
  108. package/dist/api/schema-callbacks.cjs +36 -12
  109. package/dist/api/schema-callbacks.cjs.map +1 -1
  110. package/dist/api/schema-callbacks.mjs +36 -12
  111. package/dist/api/schema-callbacks.mjs.map +1 -1
  112. package/dist/api/string-to-ast.cjs +7 -9
  113. package/dist/api/string-to-ast.cjs.map +1 -1
  114. package/dist/api/string-to-ast.mjs +8 -9
  115. package/dist/api/string-to-ast.mjs.map +1 -1
  116. package/dist/api/transform-context.cjs +7 -3
  117. package/dist/api/transform-context.cjs.map +1 -1
  118. package/dist/api/transform-context.mjs +7 -3
  119. package/dist/api/transform-context.mjs.map +1 -1
  120. package/dist/api/transform-schema.cjs +42 -12
  121. package/dist/api/transform-schema.cjs.map +1 -1
  122. package/dist/api/transform-schema.mjs +44 -14
  123. package/dist/api/transform-schema.mjs.map +1 -1
  124. package/dist/application/print/text-writer.cjs +10 -3
  125. package/dist/application/print/text-writer.cjs.map +1 -1
  126. package/dist/application/print/text-writer.mjs +10 -3
  127. package/dist/application/print/text-writer.mjs.map +1 -1
  128. package/dist/application/stack-overflow.cjs +2 -1
  129. package/dist/application/stack-overflow.cjs.map +1 -1
  130. package/dist/application/stack-overflow.mjs +2 -1
  131. package/dist/application/stack-overflow.mjs.map +1 -1
  132. package/dist/application/transform/document/components.cjs +2 -2
  133. package/dist/application/transform/document/components.cjs.map +1 -1
  134. package/dist/application/transform/document/components.mjs +4 -4
  135. package/dist/application/transform/document/components.mjs.map +1 -1
  136. package/dist/application/transform/document/declared-type-names.cjs +23 -0
  137. package/dist/application/transform/document/declared-type-names.cjs.map +1 -0
  138. package/dist/application/transform/document/declared-type-names.mjs +20 -0
  139. package/dist/application/transform/document/declared-type-names.mjs.map +1 -0
  140. package/dist/application/transform/document/defs-root.cjs +1 -1
  141. package/dist/application/transform/document/defs-root.cjs.map +1 -1
  142. package/dist/application/transform/document/defs-root.mjs +2 -2
  143. package/dist/application/transform/document/defs-root.mjs.map +1 -1
  144. package/dist/application/transform/document/document.cjs +4 -1
  145. package/dist/application/transform/document/document.cjs.map +1 -1
  146. package/dist/application/transform/document/document.mjs +3 -2
  147. package/dist/application/transform/document/document.mjs.map +1 -1
  148. package/dist/application/transform/document/enum-names-given-back.cjs +62 -0
  149. package/dist/application/transform/document/enum-names-given-back.cjs.map +1 -0
  150. package/dist/application/transform/document/enum-names-given-back.mjs +58 -0
  151. package/dist/application/transform/document/enum-names-given-back.mjs.map +1 -0
  152. package/dist/application/transform/document/global-type-references.cjs +1 -0
  153. package/dist/application/transform/document/global-type-references.cjs.map +1 -1
  154. package/dist/application/transform/document/global-type-references.mjs +1 -1
  155. package/dist/application/transform/document/global-type-references.mjs.map +1 -1
  156. package/dist/application/transform/document/media-type.cjs +2 -2
  157. package/dist/application/transform/document/media-type.cjs.map +1 -1
  158. package/dist/application/transform/document/media-type.mjs +3 -3
  159. package/dist/application/transform/document/media-type.mjs.map +1 -1
  160. package/dist/application/transform/document/operation-keys-written.cjs +26 -0
  161. package/dist/application/transform/document/operation-keys-written.cjs.map +1 -0
  162. package/dist/application/transform/document/operation-keys-written.mjs +24 -0
  163. package/dist/application/transform/document/operation-keys-written.mjs.map +1 -0
  164. package/dist/application/transform/document/operation.cjs +1 -1
  165. package/dist/application/transform/document/operation.cjs.map +1 -1
  166. package/dist/application/transform/document/operation.mjs +2 -2
  167. package/dist/application/transform/document/operation.mjs.map +1 -1
  168. package/dist/application/transform/document/parameter-entries.cjs +34 -0
  169. package/dist/application/transform/document/parameter-entries.cjs.map +1 -0
  170. package/dist/application/transform/document/parameter-entries.mjs +30 -0
  171. package/dist/application/transform/document/parameter-entries.mjs.map +1 -0
  172. package/dist/application/transform/document/parameter.cjs +12 -4
  173. package/dist/application/transform/document/parameter.cjs.map +1 -1
  174. package/dist/application/transform/document/parameter.mjs +13 -5
  175. package/dist/application/transform/document/parameter.mjs.map +1 -1
  176. package/dist/application/transform/document/parameters.cjs +7 -30
  177. package/dist/application/transform/document/parameters.cjs.map +1 -1
  178. package/dist/application/transform/document/parameters.mjs +8 -31
  179. package/dist/application/transform/document/parameters.mjs.map +1 -1
  180. package/dist/application/transform/document/path-item.cjs +11 -14
  181. package/dist/application/transform/document/path-item.cjs.map +1 -1
  182. package/dist/application/transform/document/path-item.mjs +12 -16
  183. package/dist/application/transform/document/path-item.mjs.map +1 -1
  184. package/dist/application/transform/document/paths-enum.cjs +1 -0
  185. package/dist/application/transform/document/paths-enum.cjs.map +1 -1
  186. package/dist/application/transform/document/paths-enum.mjs +1 -1
  187. package/dist/application/transform/document/paths-enum.mjs.map +1 -1
  188. package/dist/application/transform/document/paths.cjs +6 -2
  189. package/dist/application/transform/document/paths.cjs.map +1 -1
  190. package/dist/application/transform/document/paths.mjs +8 -4
  191. package/dist/application/transform/document/paths.mjs.map +1 -1
  192. package/dist/application/transform/document/referenced-parameter.cjs +80 -0
  193. package/dist/application/transform/document/referenced-parameter.cjs.map +1 -0
  194. package/dist/application/transform/document/referenced-parameter.mjs +78 -0
  195. package/dist/application/transform/document/referenced-parameter.mjs.map +1 -0
  196. package/dist/application/transform/document/request-body.cjs +1 -1
  197. package/dist/application/transform/document/request-body.cjs.map +1 -1
  198. package/dist/application/transform/document/request-body.mjs +2 -2
  199. package/dist/application/transform/document/request-body.mjs.map +1 -1
  200. package/dist/application/transform/document/response.cjs +2 -2
  201. package/dist/application/transform/document/response.cjs.map +1 -1
  202. package/dist/application/transform/document/response.mjs +3 -3
  203. package/dist/application/transform/document/response.mjs.map +1 -1
  204. package/dist/application/transform/document/responses.cjs +1 -1
  205. package/dist/application/transform/document/responses.cjs.map +1 -1
  206. package/dist/application/transform/document/responses.mjs +2 -2
  207. package/dist/application/transform/document/responses.mjs.map +1 -1
  208. package/dist/application/transform/document/root-type-aliases.cjs +8 -23
  209. package/dist/application/transform/document/root-type-aliases.cjs.map +1 -1
  210. package/dist/application/transform/document/root-type-aliases.mjs +8 -24
  211. package/dist/application/transform/document/root-type-aliases.mjs.map +1 -1
  212. package/dist/application/transform/document/type-resolution.cjs +3 -1
  213. package/dist/application/transform/document/type-resolution.cjs.map +1 -1
  214. package/dist/application/transform/document/type-resolution.mjs +3 -1
  215. package/dist/application/transform/document/type-resolution.mjs.map +1 -1
  216. package/dist/application/transform/document/webhooks.cjs +1 -1
  217. package/dist/application/transform/document/webhooks.cjs.map +1 -1
  218. package/dist/application/transform/document/webhooks.mjs +2 -2
  219. package/dist/application/transform/document/webhooks.mjs.map +1 -1
  220. package/dist/application/transform/footer/document-footer.cjs +10 -2
  221. package/dist/application/transform/footer/document-footer.cjs.map +1 -1
  222. package/dist/application/transform/footer/document-footer.mjs +10 -2
  223. package/dist/application/transform/footer/document-footer.mjs.map +1 -1
  224. package/dist/application/transform/footer/enum-name-claims.cjs +48 -0
  225. package/dist/application/transform/footer/enum-name-claims.cjs.map +1 -0
  226. package/dist/application/transform/footer/enum-name-claims.mjs +46 -0
  227. package/dist/application/transform/footer/enum-name-claims.mjs.map +1 -0
  228. package/dist/application/transform/footer/operation-keys.cjs +23 -0
  229. package/dist/application/transform/footer/operation-keys.cjs.map +1 -0
  230. package/dist/application/transform/footer/operation-keys.mjs +21 -0
  231. package/dist/application/transform/footer/operation-keys.mjs.map +1 -0
  232. package/dist/application/transform/footer/type-evaluation.cjs +4 -4
  233. package/dist/application/transform/footer/type-evaluation.cjs.map +1 -1
  234. package/dist/application/transform/footer/type-evaluation.mjs +4 -4
  235. package/dist/application/transform/footer/type-evaluation.mjs.map +1 -1
  236. package/dist/application/transform/helper-types.cjs +1 -1
  237. package/dist/application/transform/helper-types.cjs.map +1 -1
  238. package/dist/application/transform/helper-types.mjs +1 -1
  239. package/dist/application/transform/helper-types.mjs.map +1 -1
  240. package/dist/application/transform/numbered-names.cjs +9 -0
  241. package/dist/application/transform/numbered-names.cjs.map +1 -1
  242. package/dist/application/transform/numbered-names.mjs +9 -1
  243. package/dist/application/transform/numbered-names.mjs.map +1 -1
  244. package/dist/application/transform/ref-pointer/generated-location.cjs +1 -1
  245. package/dist/application/transform/ref-pointer/generated-location.cjs.map +1 -1
  246. package/dist/application/transform/ref-pointer/generated-location.mjs +2 -2
  247. package/dist/application/transform/ref-pointer/generated-location.mjs.map +1 -1
  248. package/dist/application/transform/ref-pointer/pointer-type.cjs +1 -1
  249. package/dist/application/transform/ref-pointer/pointer-type.cjs.map +1 -1
  250. package/dist/application/transform/ref-pointer/pointer-type.mjs +2 -2
  251. package/dist/application/transform/ref-pointer/pointer-type.mjs.map +1 -1
  252. package/dist/application/transform/ref-type.cjs +2 -1
  253. package/dist/application/transform/ref-type.cjs.map +1 -1
  254. package/dist/application/transform/ref-type.mjs +2 -1
  255. package/dist/application/transform/ref-type.mjs.map +1 -1
  256. package/dist/application/transform/schema/access-flags.cjs +1 -1
  257. package/dist/application/transform/schema/access-flags.cjs.map +1 -1
  258. package/dist/application/transform/schema/access-flags.mjs +2 -2
  259. package/dist/application/transform/schema/access-flags.mjs.map +1 -1
  260. package/dist/application/transform/schema/array-type.cjs +2 -2
  261. package/dist/application/transform/schema/array-type.cjs.map +1 -1
  262. package/dist/application/transform/schema/array-type.mjs +3 -3
  263. package/dist/application/transform/schema/array-type.mjs.map +1 -1
  264. package/dist/application/transform/schema/composition-type.cjs +4 -4
  265. package/dist/application/transform/schema/composition-type.cjs.map +1 -1
  266. package/dist/application/transform/schema/composition-type.mjs +6 -6
  267. package/dist/application/transform/schema/composition-type.mjs.map +1 -1
  268. package/dist/application/transform/schema/enum-rule.cjs +4 -6
  269. package/dist/application/transform/schema/enum-rule.cjs.map +1 -1
  270. package/dist/application/transform/schema/enum-rule.mjs +6 -8
  271. package/dist/application/transform/schema/enum-rule.mjs.map +1 -1
  272. package/dist/application/transform/schema/object-type.cjs +3 -3
  273. package/dist/application/transform/schema/object-type.cjs.map +1 -1
  274. package/dist/application/transform/schema/object-type.mjs +4 -4
  275. package/dist/application/transform/schema/object-type.mjs.map +1 -1
  276. package/dist/application/transform/schema/presence-members.cjs +1 -1
  277. package/dist/application/transform/schema/presence-members.cjs.map +1 -1
  278. package/dist/application/transform/schema/presence-members.mjs +2 -2
  279. package/dist/application/transform/schema/presence-members.mjs.map +1 -1
  280. package/dist/application/transform/schema/ref-siblings.cjs +47 -0
  281. package/dist/application/transform/schema/ref-siblings.cjs.map +1 -0
  282. package/dist/application/transform/schema/ref-siblings.mjs +45 -0
  283. package/dist/application/transform/schema/ref-siblings.mjs.map +1 -0
  284. package/dist/application/transform/schema/required-variants.cjs +2 -2
  285. package/dist/application/transform/schema/required-variants.cjs.map +1 -1
  286. package/dist/application/transform/schema/required-variants.mjs +3 -3
  287. package/dist/application/transform/schema/required-variants.mjs.map +1 -1
  288. package/dist/application/transform/schema/schema-transform.cjs +4 -2
  289. package/dist/application/transform/schema/schema-transform.cjs.map +1 -1
  290. package/dist/application/transform/schema/schema-transform.mjs +4 -2
  291. package/dist/application/transform/schema/schema-transform.mjs.map +1 -1
  292. package/dist/application/transform/schema/unevaluated-properties.cjs +1 -1
  293. package/dist/application/transform/schema/unevaluated-properties.cjs.map +1 -1
  294. package/dist/application/transform/schema/unevaluated-properties.mjs +2 -2
  295. package/dist/application/transform/schema/unevaluated-properties.mjs.map +1 -1
  296. package/dist/application/transform/schema-comment.cjs +6 -2
  297. package/dist/application/transform/schema-comment.cjs.map +1 -1
  298. package/dist/application/transform/schema-comment.mjs +7 -3
  299. package/dist/application/transform/schema-comment.mjs.map +1 -1
  300. package/dist/cli/api-settings.cjs +62 -6
  301. package/dist/cli/api-settings.cjs.map +1 -1
  302. package/dist/cli/api-settings.mjs +60 -7
  303. package/dist/cli/api-settings.mjs.map +1 -1
  304. package/dist/cli/api-writes.cjs +72 -0
  305. package/dist/cli/api-writes.cjs.map +1 -0
  306. package/dist/cli/api-writes.mjs +69 -0
  307. package/dist/cli/api-writes.mjs.map +1 -0
  308. package/dist/cli/cli-errors.cjs +12 -1
  309. package/dist/cli/cli-errors.cjs.map +1 -1
  310. package/dist/cli/cli-errors.mjs +12 -1
  311. package/dist/cli/cli-errors.mjs.map +1 -1
  312. package/dist/cli/cli-output.cjs +106 -1
  313. package/dist/cli/cli-output.cjs.map +1 -1
  314. package/dist/cli/cli-output.mjs +99 -2
  315. package/dist/cli/cli-output.mjs.map +1 -1
  316. package/dist/cli/main.cjs +5 -1
  317. package/dist/cli/main.cjs.map +1 -1
  318. package/dist/cli/main.mjs +6 -2
  319. package/dist/cli/main.mjs.map +1 -1
  320. package/dist/cli/redocly-apis.cjs +82 -36
  321. package/dist/cli/redocly-apis.cjs.map +1 -1
  322. package/dist/cli/redocly-apis.mjs +85 -39
  323. package/dist/cli/redocly-apis.mjs.map +1 -1
  324. package/dist/cli/run-cli.cjs +13 -7
  325. package/dist/cli/run-cli.cjs.map +1 -1
  326. package/dist/cli/run-cli.mjs +14 -8
  327. package/dist/cli/run-cli.mjs.map +1 -1
  328. package/dist/domain/append-all.cjs +10 -0
  329. package/dist/domain/append-all.cjs.map +1 -0
  330. package/dist/domain/append-all.mjs +8 -0
  331. package/dist/domain/append-all.mjs.map +1 -0
  332. package/dist/domain/cause-secrets.cjs +37 -0
  333. package/dist/domain/cause-secrets.cjs.map +1 -0
  334. package/dist/domain/cause-secrets.mjs +35 -0
  335. package/dist/domain/cause-secrets.mjs.map +1 -0
  336. package/dist/domain/deprecations.cjs +11 -0
  337. package/dist/domain/deprecations.cjs.map +1 -0
  338. package/dist/domain/deprecations.mjs +9 -0
  339. package/dist/domain/deprecations.mjs.map +1 -0
  340. package/dist/domain/errors.cjs +9 -3
  341. package/dist/domain/errors.cjs.map +1 -1
  342. package/dist/domain/errors.mjs +9 -3
  343. package/dist/domain/errors.mjs.map +1 -1
  344. package/dist/domain/ir/identifier-text.cjs.map +1 -1
  345. package/dist/domain/ir/identifier-text.mjs +1 -1
  346. package/dist/domain/ir/identifier-text.mjs.map +1 -1
  347. package/dist/domain/ir/ir-shape.cjs +187 -0
  348. package/dist/domain/ir/ir-shape.cjs.map +1 -0
  349. package/dist/domain/ir/ir-shape.mjs +184 -0
  350. package/dist/domain/ir/ir-shape.mjs.map +1 -0
  351. package/dist/domain/ir/newer-identifier-ranges.cjs +182 -29
  352. package/dist/domain/ir/newer-identifier-ranges.cjs.map +1 -1
  353. package/dist/domain/ir/newer-identifier-ranges.mjs +182 -29
  354. package/dist/domain/ir/newer-identifier-ranges.mjs.map +1 -1
  355. package/dist/domain/openapi/alias-expansion.cjs +3 -1
  356. package/dist/domain/openapi/alias-expansion.cjs.map +1 -1
  357. package/dist/domain/openapi/alias-expansion.mjs +3 -1
  358. package/dist/domain/openapi/alias-expansion.mjs.map +1 -1
  359. package/dist/domain/openapi/discriminated-union.cjs +3 -3
  360. package/dist/domain/openapi/discriminated-union.cjs.map +1 -1
  361. package/dist/domain/openapi/discriminated-union.mjs +4 -4
  362. package/dist/domain/openapi/discriminated-union.mjs.map +1 -1
  363. package/dist/domain/openapi/discriminator-conflicts.cjs +10 -6
  364. package/dist/domain/openapi/discriminator-conflicts.cjs.map +1 -1
  365. package/dist/domain/openapi/discriminator-conflicts.mjs +11 -7
  366. package/dist/domain/openapi/discriminator-conflicts.mjs.map +1 -1
  367. package/dist/domain/openapi/json-pointer.cjs +43 -1
  368. package/dist/domain/openapi/json-pointer.cjs.map +1 -1
  369. package/dist/domain/openapi/json-pointer.mjs +40 -2
  370. package/dist/domain/openapi/json-pointer.mjs.map +1 -1
  371. package/dist/domain/openapi/schema-dialect.cjs +15 -0
  372. package/dist/domain/openapi/schema-dialect.cjs.map +1 -0
  373. package/dist/domain/openapi/schema-dialect.mjs +12 -0
  374. package/dist/domain/openapi/schema-dialect.mjs.map +1 -0
  375. package/dist/domain/openapi/unsupported-features.cjs +1 -1
  376. package/dist/domain/openapi/unsupported-features.cjs.map +1 -1
  377. package/dist/domain/openapi/unsupported-features.mjs +2 -2
  378. package/dist/domain/openapi/unsupported-features.mjs.map +1 -1
  379. package/dist/domain/output-fixes.cjs +25 -14
  380. package/dist/domain/output-fixes.cjs.map +1 -1
  381. package/dist/domain/output-fixes.mjs +25 -13
  382. package/dist/domain/output-fixes.mjs.map +1 -1
  383. package/dist/domain/url-secrets.cjs +48 -0
  384. package/dist/domain/url-secrets.cjs.map +1 -0
  385. package/dist/domain/url-secrets.mjs +45 -0
  386. package/dist/domain/url-secrets.mjs.map +1 -0
  387. package/dist/domain/warnings.cjs +0 -1
  388. package/dist/domain/warnings.cjs.map +1 -1
  389. package/dist/domain/warnings.mjs +0 -1
  390. package/dist/domain/warnings.mjs.map +1 -1
  391. package/dist/index.cjs +2 -3
  392. package/dist/index.cjs.map +1 -1
  393. package/dist/index.d.cts +57 -20
  394. package/dist/index.d.mts +57 -20
  395. package/dist/index.d.ts +57 -20
  396. package/dist/index.mjs +3 -2
  397. package/dist/index.mjs.map +1 -1
  398. package/package.json +5 -6
  399. package/src/adapters/node-deprecations/node-deprecations.ts +14 -0
  400. package/src/adapters/node-file-system/file-claims.ts +138 -0
  401. package/src/adapters/node-file-system/file-identity.ts +137 -0
  402. package/src/adapters/node-file-system/node-file-system.ts +145 -18
  403. package/src/adapters/redocly-loader/bundled-mapping-copies.ts +95 -0
  404. package/src/adapters/redocly-loader/bundled-ref-repair.ts +2 -2
  405. package/src/adapters/redocly-loader/loaded-documents.ts +46 -0
  406. package/src/adapters/redocly-loader/redocly-schema-loader.ts +18 -24
  407. package/src/adapters/redocly-loader/ref-access.ts +37 -3
  408. package/src/adapters/redocly-loader/ref-holders.ts +3 -3
  409. package/src/adapters/redocly-loader/remote-body-limit.ts +66 -0
  410. package/src/adapters/redocly-loader/remote-fetch.ts +74 -11
  411. package/src/adapters/redocly-loader/remote-node-limit.ts +62 -0
  412. package/src/adapters/redocly-loader/schema-load-errors.ts +52 -13
  413. package/src/adapters/redocly-loader/schema-source.ts +20 -8
  414. package/src/adapters/redocly-loader/unsupported-keys.ts +3 -7
  415. package/src/adapters/terminal-logger/terminal-logger.ts +10 -5
  416. package/src/api/default-ports.ts +40 -4
  417. package/src/api/discriminator-conflict-warnings.ts +2 -2
  418. package/src/api/discriminator-enum-parent.ts +3 -3
  419. package/src/api/discriminator-other-owners.ts +5 -3
  420. package/src/api/discriminator-patch.ts +9 -6
  421. package/src/api/discriminator-scan.ts +19 -11
  422. package/src/api/document-run.ts +9 -3
  423. package/src/api/legacy-callback-warning.ts +13 -6
  424. package/src/api/legacy-utils.ts +5 -1
  425. package/src/api/openapi-ts.ts +26 -7
  426. package/src/api/run-context.ts +6 -0
  427. package/src/api/schema-callbacks.ts +60 -17
  428. package/src/api/string-to-ast.ts +11 -15
  429. package/src/api/transform-context.ts +7 -3
  430. package/src/api/transform-schema.ts +67 -15
  431. package/src/application/ports/deprecation-reporter.ts +9 -0
  432. package/src/application/ports/file-system.ts +39 -0
  433. package/src/application/ports/schema-loader.ts +11 -1
  434. package/src/application/print/text-writer.ts +10 -3
  435. package/src/application/stack-overflow.ts +9 -5
  436. package/src/application/transform/document/components.ts +4 -4
  437. package/src/application/transform/document/declared-type-names.ts +36 -0
  438. package/src/application/transform/document/defs-root.ts +2 -2
  439. package/src/application/transform/document/document.ts +4 -3
  440. package/src/application/transform/document/enum-names-given-back.ts +91 -0
  441. package/src/application/transform/document/global-type-references.ts +1 -1
  442. package/src/application/transform/document/media-type.ts +4 -3
  443. package/src/application/transform/document/operation-keys-written.ts +27 -0
  444. package/src/application/transform/document/operation.ts +2 -2
  445. package/src/application/transform/document/parameter-entries.ts +70 -0
  446. package/src/application/transform/document/parameter.ts +21 -9
  447. package/src/application/transform/document/parameters.ts +13 -58
  448. package/src/application/transform/document/path-item.ts +13 -31
  449. package/src/application/transform/document/paths-enum.ts +1 -1
  450. package/src/application/transform/document/paths.ts +8 -4
  451. package/src/application/transform/document/referenced-parameter.ts +146 -0
  452. package/src/application/transform/document/request-body.ts +2 -2
  453. package/src/application/transform/document/response.ts +3 -3
  454. package/src/application/transform/document/responses.ts +2 -2
  455. package/src/application/transform/document/root-type-aliases.ts +17 -38
  456. package/src/application/transform/document/type-resolution.ts +2 -1
  457. package/src/application/transform/document/webhooks.ts +2 -2
  458. package/src/application/transform/footer/document-footer.ts +18 -1
  459. package/src/application/transform/footer/enum-name-claims.ts +62 -0
  460. package/src/application/transform/footer/operation-keys.ts +28 -0
  461. package/src/application/transform/footer/type-evaluation.ts +4 -4
  462. package/src/application/transform/helper-types.ts +6 -5
  463. package/src/application/transform/numbered-names.ts +15 -0
  464. package/src/application/transform/ref-pointer/generated-location.ts +2 -2
  465. package/src/application/transform/ref-pointer/pointer-type.ts +2 -4
  466. package/src/application/transform/ref-type.ts +2 -1
  467. package/src/application/transform/schema/access-flags.ts +2 -2
  468. package/src/application/transform/schema/array-type.ts +3 -5
  469. package/src/application/transform/schema/composition-type.ts +6 -6
  470. package/src/application/transform/schema/enum-rule.ts +10 -8
  471. package/src/application/transform/schema/object-type.ts +4 -4
  472. package/src/application/transform/schema/presence-members.ts +2 -2
  473. package/src/application/transform/schema/ref-siblings.ts +76 -0
  474. package/src/application/transform/schema/required-variants.ts +3 -3
  475. package/src/application/transform/schema/schema-context.ts +3 -0
  476. package/src/application/transform/schema/schema-transform.ts +4 -2
  477. package/src/application/transform/schema/unevaluated-properties.ts +2 -2
  478. package/src/application/transform/schema-comment.ts +7 -3
  479. package/src/application/transform/transform-context.ts +5 -0
  480. package/src/cli/api-settings.ts +82 -7
  481. package/src/cli/api-writes.ts +117 -0
  482. package/src/cli/cli-dependencies.ts +21 -4
  483. package/src/cli/cli-errors.ts +20 -1
  484. package/src/cli/cli-output.ts +186 -7
  485. package/src/cli/main.ts +6 -3
  486. package/src/cli/redocly-apis.ts +153 -48
  487. package/src/cli/run-cli.ts +37 -8
  488. package/src/domain/append-all.ts +10 -0
  489. package/src/domain/cause-secrets.ts +52 -0
  490. package/src/domain/deprecations.ts +15 -0
  491. package/src/domain/errors.ts +22 -7
  492. package/src/domain/ir/identifier-text.ts +6 -5
  493. package/src/domain/ir/ir-shape.ts +299 -0
  494. package/src/domain/ir/newer-identifier-ranges.ts +183 -30
  495. package/src/domain/openapi/alias-expansion.ts +4 -1
  496. package/src/domain/openapi/discriminated-union.ts +6 -4
  497. package/src/domain/openapi/discriminator-conflicts.ts +21 -7
  498. package/src/domain/openapi/document-object.ts +2 -0
  499. package/src/domain/openapi/json-pointer.ts +96 -7
  500. package/src/domain/openapi/schema-dialect.ts +22 -0
  501. package/src/domain/openapi/unsupported-features.ts +2 -2
  502. package/src/domain/output-fixes.ts +37 -18
  503. package/src/domain/url-secrets.ts +72 -0
  504. package/src/domain/warnings.ts +0 -1
  505. package/src/index.ts +2 -6
  506. package/src/types/generator-options.ts +1 -1
  507. package/dist/cli/main.d.cts +0 -2
  508. package/dist/cli/main.d.mts +0 -2
  509. package/dist/cli/main.d.ts +0 -2
  510. package/dist/domain/url-credentials.cjs +0 -10
  511. package/dist/domain/url-credentials.cjs.map +0 -1
  512. package/dist/domain/url-credentials.mjs +0 -8
  513. package/dist/domain/url-credentials.mjs.map +0 -1
  514. package/src/domain/url-credentials.ts +0 -18
@@ -0,0 +1,78 @@
1
+ import { irReference } from '../../../domain/ir/constructors.mjs';
2
+ import { ROOT_POINTER, parseRefPointer, appendPointer } from '../../../domain/openapi/json-pointer.mjs';
3
+ import { QUERYSTRING_LOCATION } from '../../../domain/openapi/parameter-object.mjs';
4
+ import { HTTP_METHODS, QUERY_METHOD, ADDITIONAL_OPERATIONS_KEY } from '../../../domain/openapi/path-item-object.mjs';
5
+ import { refType, indexBy } from '../ref-type.mjs';
6
+ import { parameterEntries, mergedParameters } from './parameter-entries.mjs';
7
+
8
+ const INDEX_RE = /^\d+$/;
9
+ const OPERATION_KEYS = /* @__PURE__ */ new Set([...HTTP_METHODS, QUERY_METHOD]);
10
+ function listPointerOf(ref) {
11
+ if (!ref.startsWith(`${ROOT_POINTER}/`)) {
12
+ return null;
13
+ }
14
+ const [root, ...segments] = parseRefPointer(ref);
15
+ const [list, position] = segments.slice(-2);
16
+ const isList = list === "parameters" && position !== void 0 && INDEX_RE.test(position);
17
+ return root !== void 0 && isList ? { root, owner: segments.slice(0, -2) } : null;
18
+ }
19
+ function pointerTo(root, segments) {
20
+ return appendPointer(ROOT_POINTER, [root, ...segments]);
21
+ }
22
+ function isPathItemAt(root, segments) {
23
+ const isNamedRoot = root === "paths" || root === "webhooks";
24
+ return isNamedRoot && segments.length === 1 || root === "components" && segments[0] === "pathItems" && segments.length === 2;
25
+ }
26
+ function pathItemOfOperation(root, owner) {
27
+ const method = owner.at(-1) ?? "";
28
+ if (OPERATION_KEYS.has(method) && isPathItemAt(root, owner.slice(0, -1))) {
29
+ return owner.slice(0, -1);
30
+ }
31
+ const isAdditional = owner.at(-2) === ADDITIONAL_OPERATIONS_KEY;
32
+ return isAdditional && isPathItemAt(root, owner.slice(0, -2)) ? owner.slice(0, -2) : null;
33
+ }
34
+ function documentNode(refs, root, segments) {
35
+ const node = refs.resolve(pointerTo(root, segments));
36
+ const isTypedHere = typeof node === "object" && node !== null && !("$ref" in node);
37
+ return isTypedHere ? node : null;
38
+ }
39
+ function typedParameters(pointer, refs) {
40
+ const { root, owner } = pointer;
41
+ if (isPathItemAt(root, owner)) {
42
+ return documentNode(refs, root, owner)?.parameters ?? null;
43
+ }
44
+ const pathItemSegments = pathItemOfOperation(root, owner);
45
+ const pathItem = pathItemSegments && documentNode(refs, root, pathItemSegments);
46
+ const operation = pathItem && documentNode(refs, root, owner);
47
+ return pathItem && operation ? mergedParameters(pathItem, operation, refs) : null;
48
+ }
49
+ function isLocationOptional(entries, location) {
50
+ return entries.filter((entry) => entry.resolved?.in === location).every((entry) => location !== "path" && !entry.resolved?.required);
51
+ }
52
+ function correctedType(listType, entries, parameter) {
53
+ if (parameter.in === QUERYSTRING_LOCATION) {
54
+ const isTyped = !entries.some((entry) => entry.resolved?.in === "query");
55
+ return isTyped ? indexBy(listType, "query") : null;
56
+ }
57
+ if (!isLocationOptional(entries, parameter.in)) {
58
+ return null;
59
+ }
60
+ const location = irReference("NonNullable", [indexBy(listType, parameter.in)]);
61
+ return indexBy(location, parameter.name);
62
+ }
63
+ function referencedParameterType(ref, resolved, context) {
64
+ if (resolved.$ref) {
65
+ return refType(ref, { parameter: null });
66
+ }
67
+ const original = refType(ref, { parameter: { in: resolved.in, name: resolved.name } });
68
+ const pointer = listPointerOf(ref);
69
+ const parameters = pointer && typedParameters(pointer, context.refs);
70
+ if (pointer === null || parameters === null) {
71
+ return original;
72
+ }
73
+ const listType = refType(pointerTo(pointer.root, [...pointer.owner, "parameters"]));
74
+ return correctedType(listType, parameterEntries(parameters, context), resolved) ?? original;
75
+ }
76
+
77
+ export { referencedParameterType };
78
+ //# sourceMappingURL=referenced-parameter.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"referenced-parameter.mjs","sources":["../../../../src/application/transform/document/referenced-parameter.ts"],"sourcesContent":["import { irReference } from \"../../../domain/ir/constructors.js\";\nimport type { IrType } from \"../../../domain/ir/nodes.js\";\nimport {\n appendPointer,\n parseRefPointer,\n ROOT_POINTER,\n} from \"../../../domain/openapi/json-pointer.js\";\nimport type { OperationObject } from \"../../../domain/openapi/operation-object.js\";\nimport {\n type ParameterObject,\n type ParameterOrReference,\n QUERYSTRING_LOCATION,\n} from \"../../../domain/openapi/parameter-object.js\";\nimport {\n ADDITIONAL_OPERATIONS_KEY,\n HTTP_METHODS,\n type PathItemObject,\n QUERY_METHOD,\n} from \"../../../domain/openapi/path-item-object.js\";\nimport { indexBy, refType } from \"../ref-type.js\";\nimport type { RefResolver } from \"../schema/schema-context.js\";\nimport type { TransformContext } from \"../transform-context.js\";\nimport { mergedParameters, type ParameterEntry, parameterEntries } from \"./parameter-entries.js\";\n\n/**\n * The type of a parameter `$ref`. The original indexed the parameter's location and name\n * (`refType`): `#/paths/~1a/get/parameters/0` gave\n * `paths[\"/a\"][\"get\"][\"parameters\"][\"query\"][\"q\"]`.\n * Where the generated type differs, that does not compile, and only there it changes:\n *\n * - A location whose parameters are all optional is an optional member (`query?:`), so indexing it\n * fails (TS2339); it is wrapped in `NonNullable` before the name is indexed.\n * - An OpenAPI 3.2 `in: querystring` parameter is the whole `query` member (ADR-020), not a member\n * `querystring`, so the pointer reads `[\"query\"]`.\n *\n * A `$ref` to a component parameter, or into a list the generator types elsewhere (a `$ref` path\n * item or operation, a callback), keeps the original type.\n */\n\nconst INDEX_RE = /^\\d+$/;\nconst OPERATION_KEYS: ReadonlySet<string> = new Set([...HTTP_METHODS, QUERY_METHOD]);\n\n/** A `parameters/N` pointer, split into its root and the segments of the list's owner. */\ninterface ParameterListPointer {\n readonly root: string;\n readonly owner: readonly string[];\n}\n\nfunction listPointerOf(ref: string): ParameterListPointer | null {\n if (!ref.startsWith(`${ROOT_POINTER}/`)) {\n return null;\n }\n const [root, ...segments] = parseRefPointer(ref);\n const [list, position] = segments.slice(-2);\n const isList = list === \"parameters\" && position !== undefined && INDEX_RE.test(position);\n return root !== undefined && isList ? { root, owner: segments.slice(0, -2) } : null;\n}\n\nfunction pointerTo(root: string, segments: readonly string[]): string {\n return appendPointer(ROOT_POINTER, [root, ...segments]);\n}\n\n/** Whether the segments name a path item that `pathItemType` types in place. */\nfunction isPathItemAt(root: string, segments: readonly string[]): boolean {\n const isNamedRoot = root === \"paths\" || root === \"webhooks\";\n return (\n (isNamedRoot && segments.length === 1) ||\n (root === \"components\" && segments[0] === \"pathItems\" && segments.length === 2)\n );\n}\n\n/** The segments of the path item that holds the operation at `owner`, or null. */\nfunction pathItemOfOperation(root: string, owner: readonly string[]): readonly string[] | null {\n const method = owner.at(-1) ?? \"\";\n if (OPERATION_KEYS.has(method) && isPathItemAt(root, owner.slice(0, -1))) {\n return owner.slice(0, -1);\n }\n const isAdditional = owner.at(-2) === ADDITIONAL_OPERATIONS_KEY;\n return isAdditional && isPathItemAt(root, owner.slice(0, -2)) ? owner.slice(0, -2) : null;\n}\n\nfunction documentNode<T>(refs: RefResolver, root: string, segments: readonly string[]): T | null {\n const node = refs.resolve(pointerTo(root, segments));\n const isTypedHere = typeof node === \"object\" && node !== null && !(\"$ref\" in node);\n return isTypedHere ? (node as T) : null;\n}\n\n/** The parameters the generator types at the list's owner; null where it types them elsewhere. */\nfunction typedParameters(\n pointer: ParameterListPointer,\n refs: RefResolver,\n): readonly ParameterOrReference[] | null {\n const { root, owner } = pointer;\n if (isPathItemAt(root, owner)) {\n return documentNode<PathItemObject>(refs, root, owner)?.parameters ?? null;\n }\n const pathItemSegments = pathItemOfOperation(root, owner);\n const pathItem = pathItemSegments && documentNode<PathItemObject>(refs, root, pathItemSegments);\n const operation = pathItem && documentNode<OperationObject>(refs, root, owner);\n return pathItem && operation ? mergedParameters(pathItem, operation, refs) : null;\n}\n\n/** A location member is optional when none of its parameters is required (`locationParts`). */\nfunction isLocationOptional(entries: readonly ParameterEntry[], location: string): boolean {\n return entries\n .filter((entry) => entry.resolved?.in === location)\n .every((entry) => location !== \"path\" && !entry.resolved?.required);\n}\n\n/** The corrected type, or null where the original type compiles or no correction applies. */\nfunction correctedType(\n listType: IrType,\n entries: readonly ParameterEntry[],\n parameter: ParameterObject,\n): IrType | null {\n if (parameter.in === QUERYSTRING_LOCATION) {\n // Next to `in: query` parameters it is not in the generated types (QUERYSTRING_NEXT_TO_QUERY).\n const isTyped = !entries.some((entry) => entry.resolved?.in === \"query\");\n return isTyped ? indexBy(listType, \"query\") : null;\n }\n if (!isLocationOptional(entries, parameter.in)) {\n return null;\n }\n const location = irReference(\"NonNullable\", [indexBy(listType, parameter.in)]);\n return indexBy(location, parameter.name);\n}\n\n/** The type of a parameter `$ref` whose target resolved to `resolved`; see the module comment. */\nexport function referencedParameterType(\n ref: string,\n resolved: ParameterObject,\n context: TransformContext,\n): IrType {\n // A `$ref` that resolves to another `$ref` is not a parameter object yet: index it as a path.\n if ((resolved as { $ref?: unknown }).$ref) {\n return refType(ref, { parameter: null });\n }\n const original = refType(ref, { parameter: { in: resolved.in, name: resolved.name } });\n const pointer = listPointerOf(ref);\n const parameters = pointer && typedParameters(pointer, context.refs);\n if (pointer === null || parameters === null) {\n return original;\n }\n const listType = refType(pointerTo(pointer.root, [...pointer.owner, \"parameters\"]));\n return correctedType(listType, parameterEntries(parameters, context), resolved) ?? original;\n}\n"],"names":[],"mappings":";;;;;;;AAuCA,MAAM,QAAA,GAAW,OAAA;AACjB,MAAM,iCAAsC,IAAI,GAAA,CAAI,CAAC,GAAG,YAAA,EAAc,YAAY,CAAC,CAAA;AAQnF,SAAS,cAAc,GAAA,EAA0C;AAC/D,EAAA,IAAI,CAAC,GAAA,CAAI,UAAA,CAAW,CAAA,EAAG,YAAY,GAAG,CAAA,EAAG;AACvC,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,MAAM,CAAC,IAAA,EAAM,GAAG,QAAQ,CAAA,GAAI,gBAAgB,GAAG,CAAA;AAC/C,EAAA,MAAM,CAAC,IAAA,EAAM,QAAQ,CAAA,GAAI,QAAA,CAAS,MAAM,EAAE,CAAA;AAC1C,EAAA,MAAM,SAAS,IAAA,KAAS,YAAA,IAAgB,aAAa,MAAA,IAAa,QAAA,CAAS,KAAK,Q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AAClF,EAAA,OAAO,cAAc,QAAA,EAAU,gBAAA,CAAiB,YAAY,OAAO,CAAA,EAAG,QAAQ,CAAA,IAAK,QAAA;AACrF;;"}
@@ -11,7 +11,7 @@ const ANY_MEDIA_TYPE = "*/*";
11
11
  function contentMembers(requestBody, location, context) {
12
12
  const entries = documentEntries.documentEntries(requestBody.content ?? {}, context.options);
13
13
  return entries.map(([contentType, entry]) => {
14
- const path = jsonPointer.createRef([location.path, "content", contentType]);
14
+ const path = jsonPointer.appendPointer(location.path, ["content", contentType]);
15
15
  const type = mediaType.contentEntryType(entry, { ...location, path }, context);
16
16
  return documentMember.documentMember(contentType, type, entry, { isReadonly: context.options.immutable });
17
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"request-body.cjs","sources":["../../../../src/application/transform/document/request-body.ts"],"sourcesContent":["import { irKeyword, irObject, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrMember, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport type { RequestBodyObject } from \"../../../domain/openapi/request-body-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { contentEntryType, itemContentMember } from \"./media-type.js\";\n\n/** Stands in for the media types of a body that defines none: `\"*\\/*\"?: never`. */\nconst ANY_MEDIA_TYPE = \"*/*\";\n\nfunction contentMembers(\n requestBody: RequestBodyObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrMember[] {\n const entries = documentEntries(requestBody.content ?? {}, context.options);\n return entries.map(([contentType, entry]) => {\n const path = createRef([location.path, \"content\", contentType]);\n const type = contentEntryType(entry, { ...location, path }, context);\n return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });\n });\n}\n\n/**\n * A request body (OpenAPI 3.2 §4.8.13): `{ content: { [mediaType]: T } }`, and `itemContent` when a\n * media type has an `itemSchema`.\n */\nexport function requestBodyType(\n requestBody: RequestBodyObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const members = contentMembers(requestBody, location, context);\n // The placeholder is never readonly, even with --immutable, as in the original.\n const placeholder = irProperty(toPropertyName(ANY_MEDIA_TYPE), irKeyword(\"never\"), {\n isOptional: true,\n });\n const content = irObject(members.length > 0 ? members : [placeholder]);\n const isReadonly = context.options.immutable;\n const itemContent = itemContentMember(requestBody.content ?? {}, location, context, {\n isReadonly,\n });\n return irObject([\n irProperty(toPropertyName(\"content\"), content, { isReadonly }),\n ...(itemContent ? [itemContent] : []),\n ]);\n}\n"],"names":["documentEntries","createRef","contentEntryType","documentMember","irProperty","toPropertyName","irKeyword","irObject","itemContentMember"],"mappings":";;;;;;;;;AAWA,MAAM,cAAA,GAAiB,KAAA;AAEvB,SAAS,cAAA,CACP,WAAA,EACA,QAAA,EACA,OAAA,EACY;AACZ,EAAA,MAAM,UAAUA,+BAAA,CAAgB,WAAA,CAAY,WAAW,EAAC,EAAG,QAAQ,OAAO,CAAA;AAC1E,EAAA,OAAO,QAAQ,GAAA,CAAI,CAAC,CAAC,WAAA,EAAa,KAAK,CAAA,KAAM;AAC3C,IAAA,MAAM,OAAOC,qBAAA,CAAU,CAAC,SAAS,IAAA,EAAM,SAAA,EAAW,WAAW,CAAC,CAAA;AAC9D,IAAA,MAAM,IAAA,GAAOC,2BAAiB,KAAA,EAAO,EAAE,GAAG,QAAA,EAAU,IAAA,IAAQ,OAAO,CAAA;AACnE,IAAA,OAAOC,6BAAA,CAAe,aAAa,IAAA,EAAM,KAAA,EAAO,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EAC3F,CAAC,CAAA;AACH;AAMO,SAAS,eAAA,CACd,WAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAU,cAAA,CAAe,WAAA,EAAa,QAAA,EAAU,OAAO,CAAA;AAE7D,EAAA,MAAM,cAAcC,uBAAA,CAAWC,2BAAA,CAAe,cAAc,CAAA,EAAGC,sBAAA,CAAU,OAAO,CAAA,EAAG;AAAA,IACjF,UAAA,EAAY;AAAA,GACb,CAAA;AACD,EAAA,MAAM,OAAA,GAAUC,sBAAS,OAAA,CAAQ,MAAA,GAAS,IAAI,OAAA,GAAU,CAAC,WAAW,CAAC,CAAA;AACrE,EAAA,MAAM,UAAA,GAAa,QAAQ,OAAA,CAAQ,SAAA;AACnC,EAAA,MAAM,cAAcC,2BAAA,CAAkB,WAAA,CAAY,WAAW,EAAC,EAAG,UAAU,OAAA,EAAS;AAAA,IAClF;AAAA,GACD,CAAA;AACD,EAAA,OAAOD,qBAAA,CAAS;AAAA,IACdH,wBAAWC,2BAAA,CAAe,SAAS,GAAG,OAAA,EAAS,EAAE,YAAY,CAAA;AAAA,IAC7D,GAAI,WAAA,GAAc,CAAC,WAAW,IAAI;AAAC,GACpC,CAAA;AACH;;"}
1
+ {"version":3,"file":"request-body.cjs","sources":["../../../../src/application/transform/document/request-body.ts"],"sourcesContent":["import { irKeyword, irObject, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrMember, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { appendPointer } from \"../../../domain/openapi/json-pointer.js\";\nimport type { RequestBodyObject } from \"../../../domain/openapi/request-body-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { contentEntryType, itemContentMember } from \"./media-type.js\";\n\n/** Stands in for the media types of a body that defines none: `\"*\\/*\"?: never`. */\nconst ANY_MEDIA_TYPE = \"*/*\";\n\nfunction contentMembers(\n requestBody: RequestBodyObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrMember[] {\n const entries = documentEntries(requestBody.content ?? {}, context.options);\n return entries.map(([contentType, entry]) => {\n const path = appendPointer(location.path, [\"content\", contentType]);\n const type = contentEntryType(entry, { ...location, path }, context);\n return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });\n });\n}\n\n/**\n * A request body (OpenAPI 3.2 §4.8.13): `{ content: { [mediaType]: T } }`, and `itemContent` when a\n * media type has an `itemSchema`.\n */\nexport function requestBodyType(\n requestBody: RequestBodyObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const members = contentMembers(requestBody, location, context);\n // The placeholder is never readonly, even with --immutable, as in the original.\n const placeholder = irProperty(toPropertyName(ANY_MEDIA_TYPE), irKeyword(\"never\"), {\n isOptional: true,\n });\n const content = irObject(members.length > 0 ? members : [placeholder]);\n const isReadonly = context.options.immutable;\n const itemContent = itemContentMember(requestBody.content ?? {}, location, context, {\n isReadonly,\n });\n return irObject([\n irProperty(toPropertyName(\"content\"), content, { isReadonly }),\n ...(itemContent ? [itemContent] : []),\n ]);\n}\n"],"names":["documentEntries","appendPointer","contentEntryType","documentMember","irProperty","toPropertyName","irKeyword","irObject","itemContentMember"],"mappings":";;;;;;;;;AAWA,MAAM,cAAA,GAAiB,KAAA;AAEvB,SAAS,cAAA,CACP,WAAA,EACA,QAAA,EACA,OAAA,EACY;AACZ,EAAA,MAAM,UAAUA,+BAAA,CAAgB,WAAA,CAAY,WAAW,EAAC,EAAG,QAAQ,OAAO,CAAA;AAC1E,EAAA,OAAO,QAAQ,GAAA,CAAI,CAAC,CAAC,WAAA,EAAa,KAAK,CAAA,KAAM;AAC3C,IAAA,MAAM,OAAOC,yBAAA,CAAc,QAAA,CAAS,MAAM,CAAC,SAAA,EAAW,WAAW,CAAC,CAAA;AAClE,IAAA,MAAM,IAAA,GAAOC,2BAAiB,KAAA,EAAO,EAAE,GAAG,QAAA,EAAU,IAAA,IAAQ,OAAO,CAAA;AACnE,IAAA,OAAOC,6BAAA,CAAe,aAAa,IAAA,EAAM,KAAA,EAAO,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EAC3F,CAAC,CAAA;AACH;AAMO,SAAS,eAAA,CACd,WAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAU,cAAA,CAAe,WAAA,EAAa,QAAA,EAAU,OAAO,CAAA;AAE7D,EAAA,MAAM,cAAcC,uBAAA,CAAWC,2BAAA,CAAe,cAAc,CAAA,EAAGC,sBAAA,CAAU,OAAO,CAAA,EAAG;AAAA,IACjF,UAAA,EAAY;AAAA,GACb,CAAA;AACD,EAAA,MAAM,OAAA,GAAUC,sBAAS,OAAA,CAAQ,MAAA,GAAS,IAAI,OAAA,GAAU,CAAC,WAAW,CAAC,CAAA;AACrE,EAAA,MAAM,UAAA,GAAa,QAAQ,OAAA,CAAQ,SAAA;AACnC,EAAA,MAAM,cAAcC,2BAAA,CAAkB,WAAA,CAAY,WAAW,EAAC,EAAG,UAAU,OAAA,EAAS;AAAA,IAClF;AAAA,GACD,CAAA;AACD,EAAA,OAAOD,qBAAA,CAAS;AAAA,IACdH,wBAAWC,2BAAA,CAAe,SAAS,GAAG,OAAA,EAAS,EAAE,YAAY,CAAA;AAAA,IAC7D,GAAI,WAAA,GAAc,CAAC,WAAW,IAAI;AAAC,GACpC,CAAA;AACH;;"}
@@ -1,6 +1,6 @@
1
1
  import { irProperty, irKeyword, irObject } from '../../../domain/ir/constructors.mjs';
2
2
  import { toPropertyName } from '../../../domain/ir/property-name.mjs';
3
- import { createRef } from '../../../domain/openapi/json-pointer.mjs';
3
+ import { appendPointer } from '../../../domain/openapi/json-pointer.mjs';
4
4
  import { documentEntries } from '../document-entries.mjs';
5
5
  import { documentMember } from './document-member.mjs';
6
6
  import { itemContentMember, contentEntryType } from './media-type.mjs';
@@ -9,7 +9,7 @@ const ANY_MEDIA_TYPE = "*/*";
9
9
  function contentMembers(requestBody, location, context) {
10
10
  const entries = documentEntries(requestBody.content ?? {}, context.options);
11
11
  return entries.map(([contentType, entry]) => {
12
- const path = createRef([location.path, "content", contentType]);
12
+ const path = appendPointer(location.path, ["content", contentType]);
13
13
  const type = contentEntryType(entry, { ...location, path }, context);
14
14
  return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });
15
15
  });
@@ -1 +1 @@
1
- {"version":3,"file":"request-body.mjs","sources":["../../../../src/application/transform/document/request-body.ts"],"sourcesContent":["import { irKeyword, irObject, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrMember, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport type { RequestBodyObject } from \"../../../domain/openapi/request-body-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { contentEntryType, itemContentMember } from \"./media-type.js\";\n\n/** Stands in for the media types of a body that defines none: `\"*\\/*\"?: never`. */\nconst ANY_MEDIA_TYPE = \"*/*\";\n\nfunction contentMembers(\n requestBody: RequestBodyObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrMember[] {\n const entries = documentEntries(requestBody.content ?? {}, context.options);\n return entries.map(([contentType, entry]) => {\n const path = createRef([location.path, \"content\", contentType]);\n const type = contentEntryType(entry, { ...location, path }, context);\n return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });\n });\n}\n\n/**\n * A request body (OpenAPI 3.2 §4.8.13): `{ content: { [mediaType]: T } }`, and `itemContent` when a\n * media type has an `itemSchema`.\n */\nexport function requestBodyType(\n requestBody: RequestBodyObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const members = contentMembers(requestBody, location, context);\n // The placeholder is never readonly, even with --immutable, as in the original.\n const placeholder = irProperty(toPropertyName(ANY_MEDIA_TYPE), irKeyword(\"never\"), {\n isOptional: true,\n });\n const content = irObject(members.length > 0 ? members : [placeholder]);\n const isReadonly = context.options.immutable;\n const itemContent = itemContentMember(requestBody.content ?? {}, location, context, {\n isRe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AA,IAClF;AAAA,GACD,CAAA;AACD,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,WAAW,cAAA,CAAe,SAAS,GAAG,OAAA,EAAS,EAAE,YAAY,CAAA;AAAA,IAC7D,GAAI,WAAA,GAAc,CAAC,WAAW,IAAI;AAAC,GACpC,CAAA;AACH;;"}
1
+ {"version":3,"file":"request-body.mjs","sources":["../../../../src/application/transform/document/request-body.ts"],"sourcesContent":["import { irKeyword, irObject, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrMember, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { appendPointer } from \"../../../domain/openapi/json-pointer.js\";\nimport type { RequestBodyObject } from \"../../../domain/openapi/request-body-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { contentEntryType, itemContentMember } from \"./media-type.js\";\n\n/** Stands in for the media types of a body that defines none: `\"*\\/*\"?: never`. */\nconst ANY_MEDIA_TYPE = \"*/*\";\n\nfunction contentMembers(\n requestBody: RequestBodyObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrMember[] {\n const entries = documentEntries(requestBody.content ?? {}, context.options);\n return entries.map(([contentType, entry]) => {\n const path = appendPointer(location.path, [\"content\", contentType]);\n const type = contentEntryType(entry, { ...location, path }, context);\n return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });\n });\n}\n\n/**\n * A request body (OpenAPI 3.2 §4.8.13): `{ content: { [mediaType]: T } }`, and `itemContent` when a\n * media type has an `itemSchema`.\n */\nexport function requestBodyType(\n requestBody: RequestBodyObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const members = contentMembers(requestBody, location, context);\n // The placeholder is never readonly, even with --immutable, as in the original.\n const placeholder = irProperty(toPropertyName(ANY_MEDIA_TYPE), irKeyword(\"never\"), {\n isOptional: true,\n });\n const content = irObject(members.length > 0 ? members : [placeholder]);\n const isReadonly = context.options.immutable;\n const itemContent = itemContentMember(requestBody.content ?? {}, location, context, {\n isReadonly,\n });\n return irObject([\n irProperty(toPropertyName(\"content\"), content, { isReadonly }),\n ...(itemContent ? [itemContent] : []),\n ]);\n}\n"],"names":[],"mappings":";;;;;;;AAWA,MAAM,cAAA,GAAiB,KAAA;AAEvB,SAAS,cAAA,CACP,WAAA,EACA,QAAA,EACA,OAAA,EACY;AACZ,EAAA,MAAM,UAAU,eAAA,CAAgB,WAAA,CAAY,WAAW,EAAC,EAAG,QAAQ,OAAO,CAAA;AAC1E,EAAA,OAAO,QAAQ,GAAA,CAAI,CAAC,CAAC,WAAA,EAAa,KAAK,CAAA,KAAM;AAC3C,IAAA,MAAM,OAAO,aAAA,CAAc,QAAA,CAAS,MAAM,CAAC,SAAA,EAAW,WAAW,CAAC,CAAA;AAClE,IAAA,MAAM,IAAA,GAAO,iBAAiB,KAAA,EAAO,EAAE,GAAG,QAAA,EAAU,IAAA,IAAQ,OAAO,CAAA;AACnE,IAAA,OAAO,cAAA,CAAe,aAAa,IAAA,EAAM,KAAA,EAAO,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EAC3F,CAAC,CAAA;AACH;AAMO,SAAS,eAAA,CACd,WAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAU,cAAA,CAAe,WAAA,EAAa,QAAA,EAAU,OAAO,CAAA;AAE7D,EAAA,MAAM,cAAc,UAAA,CAAW,cAAA,CAAe,cAAc,CAAA,EAAG,SAAA,CAAU,OAAO,CAAA,EAAG;AAAA,IACjF,UAAA,EAAY;AAAA,GACb,CAAA;AACD,EAAA,MAAM,OAAA,GAAU,SAAS,OAAA,CAAQ,MAAA,GAAS,IAAI,OAAA,GAAU,CAAC,WAAW,CAAC,CAAA;AACrE,EAAA,MAAM,UAAA,GAAa,QAAQ,OAAA,CAAQ,SAAA;AACnC,EAAA,MAAM,cAAc,iBAAA,CAAkB,WAAA,CAAY,WAAW,EAAC,EAAG,UAAU,OAAA,EAAS;AAAA,IAClF;AAAA,GACD,CAAA;AACD,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,WAAW,cAAA,CAAe,SAAS,GAAG,OAAA,EAAS,EAAE,YAAY,CAAA;AAAA,IAC7D,GAAI,WAAA,GAAc,CAAC,WAAW,IAAI;AAAC,GACpC,CAAA;AACH;;"}
@@ -15,7 +15,7 @@ function headerMember(name, header$1, location, context) {
15
15
  const isReference = "$ref" in header$1;
16
16
  const type = isReference ? refType.refType(header$1.$ref) : header.headerType(
17
17
  header$1,
18
- { ...location, path: jsonPointer.createRef([location.path, "headers", name]) },
18
+ { ...location, path: jsonPointer.appendPointer(location.path, ["headers", name]) },
19
19
  context
20
20
  );
21
21
  return documentMember.documentMember(name, type, header$1, {
@@ -37,7 +37,7 @@ function mediaTypeEntryType(entry, location, context) {
37
37
  function contentMember(response, location, context) {
38
38
  const entries = documentEntries.documentEntries(response.content ?? {}, context.options);
39
39
  const members = entries.map(([contentType, entry]) => {
40
- const path = jsonPointer.createRef([location.path, "content", contentType]);
40
+ const path = jsonPointer.appendPointer(location.path, ["content", contentType]);
41
41
  const type = mediaTypeEntryType(entry, { ...location, path }, context);
42
42
  return documentMember.documentMember(contentType, type, entry, { isReadonly: context.options.immutable });
43
43
  });
@@ -1 +1 @@
1
- {"version":3,"file":"response.cjs","sources":["../../../../src/application/transform/document/response.ts"],"sourcesContent":["import {\n irKeyword,\n irObject,\n irProperty,\n irStringIndexSignature,\n} from \"../../../domain/ir/constructors.js\";\nimport type { IrMember, IrPropertySignature, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport {\n isMediaTypeComponentRef,\n type MediaTypeObject,\n} from \"../../../domain/openapi/media-type-object.js\";\nimport type { ResponseObject } from \"../../../domain/openapi/response-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { UNKNOWN_TYPE } from \"../shared-types.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { headerType } from \"./header.js\";\nimport { contentEntryType, itemContentMember, mediaTypeType } from \"./media-type.js\";\n\ntype HeaderEntry = NonNullable<ResponseObject[\"headers\"]>[string];\n\nfunction headerMember(\n name: string,\n header: HeaderEntry,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n // A referenced header counts as required: the reference does not say otherwise.\n const isReference = \"$ref\" in header;\n const type = isReference\n ? refType(header.$ref)\n : headerType(\n header,\n { ...location, path: createRef([location.path, \"headers\", name]) },\n context,\n );\n return documentMember(name, type, header, {\n isReadonly: context.options.immutable,\n isOptional: !isReference && !header.required,\n });\n}\n\n/** The listed headers, then `[name: string]: unknown`, because servers may send others. */\nfunction headersMember(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n const entries = documentEntries(response.headers ?? {}, context.options);\n const members: IrMember[] = entries.map(([name, header]) =>\n headerMember(name, header, location, context),\n );\n members.push(irStringIndexSignature(\"name\", UNKNOWN_TYPE, context.options.immutable));\n return irProperty(toPropertyName(\"headers\"), irObject(members));\n}\n\n/**\n * One media type of a response. The original reads a `$ref` entry as a media type without a\n * schema, so it is `unknown`; a `$ref` to an OpenAPI 3.2 media type component is typed as it.\n */\nfunction mediaTypeEntryType(\n entry: NonNullable<ResponseObject[\"content\"]>[string],\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n return \"$ref\" in entry && isMediaTypeComponentRef(entry.$ref)\n ? contentEntryType(entry, location, context)\n : mediaTypeType(entry as MediaTypeObject, location, context);\n}\n\n/** `content` with one member per media type, or `content?: never` when there are none. */\nfunction contentMember(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n const entries = documentEntries(response.content ?? {}, context.options);\n const members = entries.map(([contentType, entry]) => {\n const path = createRef([location.path, \"content\", contentType]);\n const type = mediaTypeEntryType(entry, { ...location, path }, context);\n return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });\n });\n const name = toPropertyName(\"content\");\n return members.length > 0\n ? irProperty(name, irObject(members))\n : irProperty(name, irKeyword(\"never\"), { isOptional: true });\n}\n\n/**\n * A response (OpenAPI 3.2 §4.8.17): `{ headers: {…}; content: {…} }`, and `itemContent` when a\n * media type has an `itemSchema`. No member is readonly, even with --immutable, as in the original.\n */\nexport function responseType(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const itemContent = itemContentMember(response.content ?? {}, location, context, {\n isReadonly: false,\n });\n return irObject([\n headersMember(response, location, context),\n contentMember(response, location, context),\n ...(itemContent ? [itemContent] : []),\n ]);\n}\n"],"names":["header","refType","headerType","createRef","documentMember","documentEntries","irStringIndexSignature","UNKNOWN_TYPE","irProperty","toPropertyName","irObject","isMediaTypeComponentRef","contentEntryType","mediaTypeType","irKeyword","itemContentMember"],"mappings":";;;;;;;;;;;;;AAwBA,SAAS,YAAA,CACP,IAAA,EACAA,QAAA,EACA,QAAA,EACA,OAAA,EACqB;AAErB,EAAA,MAAM,cAAc,MAAA,IAAUA,QAAA;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAA,GACTC,eAAA,CAAQD,QAAA,CAAO,IAAI,CAAA,GACnBE,iBAAA;AAAA,IACEF,QAAA;AAAA,IACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAMG,qBAAA,CAAU,CAAC,QAAA,CAAS,IAAA,EAAM,SAAA,EAAW,IAAI,CAAC,CAAA,EAAE;AAAA,IACjE;AAAA,GACF;AACJ,EAAA,OAAOC,6BAAA,CAAe,IAAA,EAAM,IAAA,EAAMJ,QAAA,EAAQ;AAAA,IACxC,UAAA,EAAY,QAAQ,OAAA,CAAQ,SAAA;AAAA,IAC5B,UAAA,EAAY,CAAC,WAAA,IAAe,CAACA,QAAA,CA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IAAA,OAAOC,6BAAA,CAAe,aAAa,IAAA,EAAM,KAAA,EAAO,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EAC3F,CAAC,CAAA;AACD,EAAA,MAAM,IAAA,GAAOK,4BAAe,SAAS,CAAA;AACrC,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,GACpBD,uBAAA,CAAW,IAAA,EAAME,sBAAS,OAAO,CAAC,CAAA,GAClCF,uBAAA,CAAW,MAAMM,sBAAA,CAAU,OAAO,GAAG,EAAE,UAAA,EAAY,MAAM,CAAA;AAC/D;AAMO,SAAS,YAAA,CACd,QAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,cAAcC,2BAAA,CAAkB,QAAA,CAAS,WAAW,EAAC,EAAG,UAAU,OAAA,EAAS;AAAA,IAC/E,UAAA,EAAY;AAAA,GACb,CAAA;AACD,EAAA,OAAOL,qBAAA,CAAS;AAAA,IACd,aAAA,CAAc,QAAA,EAAU,QAAA,EAAU,OAAO,CAAA;AAAA,IACzC,aAAA,CAAc,QAAA,EAAU,QAAA,EAAU,OAAO,CAAA;AAAA,IACzC,GAAI,WAAA,GAAc,CAAC,WAAW,IAAI;AAAC,GACpC,CAAA;AACH;;"}
1
+ {"version":3,"file":"response.cjs","sources":["../../../../src/application/transform/document/response.ts"],"sourcesContent":["import {\n irKeyword,\n irObject,\n irProperty,\n irStringIndexSignature,\n} from \"../../../domain/ir/constructors.js\";\nimport type { IrMember, IrPropertySignature, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { appendPointer } from \"../../../domain/openapi/json-pointer.js\";\nimport {\n isMediaTypeComponentRef,\n type MediaTypeObject,\n} from \"../../../domain/openapi/media-type-object.js\";\nimport type { ResponseObject } from \"../../../domain/openapi/response-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { UNKNOWN_TYPE } from \"../shared-types.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { headerType } from \"./header.js\";\nimport { contentEntryType, itemContentMember, mediaTypeType } from \"./media-type.js\";\n\ntype HeaderEntry = NonNullable<ResponseObject[\"headers\"]>[string];\n\nfunction headerMember(\n name: string,\n header: HeaderEntry,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n // A referenced header counts as required: the reference does not say otherwise.\n const isReference = \"$ref\" in header;\n const type = isReference\n ? refType(header.$ref)\n : headerType(\n header,\n { ...location, path: appendPointer(location.path, [\"headers\", name]) },\n context,\n );\n return documentMember(name, type, header, {\n isReadonly: context.options.immutable,\n isOptional: !isReference && !header.required,\n });\n}\n\n/** The listed headers, then `[name: string]: unknown`, because servers may send others. */\nfunction headersMember(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n const entries = documentEntries(response.headers ?? {}, context.options);\n const members: IrMember[] = entries.map(([name, header]) =>\n headerMember(name, header, location, context),\n );\n members.push(irStringIndexSignature(\"name\", UNKNOWN_TYPE, context.options.immutable));\n return irProperty(toPropertyName(\"headers\"), irObject(members));\n}\n\n/**\n * One media type of a response. The original reads a `$ref` entry as a media type without a\n * schema, so it is `unknown`; a `$ref` to an OpenAPI 3.2 media type component is typed as it.\n */\nfunction mediaTypeEntryType(\n entry: NonNullable<ResponseObject[\"content\"]>[string],\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n return \"$ref\" in entry && isMediaTypeComponentRef(entry.$ref)\n ? contentEntryType(entry, location, context)\n : mediaTypeType(entry as MediaTypeObject, location, context);\n}\n\n/** `content` with one member per media type, or `content?: never` when there are none. */\nfunction contentMember(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n const entries = documentEntries(response.content ?? {}, context.options);\n const members = entries.map(([contentType, entry]) => {\n const path = appendPointer(location.path, [\"content\", contentType]);\n const type = mediaTypeEntryType(entry, { ...location, path }, context);\n return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });\n });\n const name = toPropertyName(\"content\");\n return members.length > 0\n ? irProperty(name, irObject(members))\n : irProperty(name, irKeyword(\"never\"), { isOptional: true });\n}\n\n/**\n * A response (OpenAPI 3.2 §4.8.17): `{ headers: {…}; content: {…} }`, and `itemContent` when a\n * media type has an `itemSchema`. No member is readonly, even with --immutable, as in the original.\n */\nexport function responseType(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const itemContent = itemContentMember(response.content ?? {}, location, context, {\n isReadonly: false,\n });\n return irObject([\n headersMember(response, location, context),\n contentMember(response, location, context),\n ...(itemContent ? [itemContent] : []),\n ]);\n}\n"],"names":["header","refType","headerType","appendPointer","documentMember","documentEntries","irStringIndexSignature","UNKNOWN_TYPE","irProperty","toPropertyName","irObject","isMediaTypeComponentRef","contentEntryType","mediaTypeType","irKeyword","itemContentMember"],"mappings":";;;;;;;;;;;;;AAwBA,SAAS,YAAA,CACP,IAAA,EACAA,QAAA,EACA,QAAA,EACA,OAAA,EACqB;AAErB,EAAA,MAAM,cAAc,MAAA,IAAUA,QAAA;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAA,GACTC,eAAA,CAAQD,QAAA,CAAO,IAAI,CAAA,GACnBE,iBAAA;AAAA,IACEF,QAAA;AAAA,IACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAMG,yBAAA,CAAc,QAAA,CAAS,IAAA,EAAM,CAAC,SAAA,EAAW,IAAI,CAAC,CAAA,EAAE;AAAA,IACrE;AAAA,GACF;AACJ,EAAA,OAAOC,6BAAA,CAAe,IAAA,EAAM,IAAA,EAAMJ,QAAA,EAAQ;AAAA,IACxC,UAAA,EAAY,QAAQ,OAAA,CAAQ,SAAA;AAAA,IAC5B,UAAA,EAAY,CAAC,WAAA,IAAe,CAACA,QAAA,CAAO;AAAA,GACrC,CAAA;AACH;AAGA,SAAS,aAAA,CACP,QAA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O,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EAC3F,CAAC,CAAA;AACD,EAAA,MAAM,IAAA,GAAOK,4BAAe,SAAS,CAAA;AACrC,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,GACpBD,uBAAA,CAAW,IAAA,EAAME,sBAAS,OAAO,CAAC,CAAA,GAClCF,uBAAA,CAAW,MAAMM,sBAAA,CAAU,OAAO,GAAG,EAAE,UAAA,EAAY,MAAM,CAAA;AAC/D;AAMO,SAAS,YAAA,CACd,QAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,cAAcC,2BAAA,CAAkB,QAAA,CAAS,WAAW,EAAC,EAAG,UAAU,OAAA,EAAS;AAAA,IAC/E,UAAA,EAAY;AAAA,GACb,CAAA;AACD,EAAA,OAAOL,qBAAA,CAAS;AAAA,IACd,aAAA,CAAc,QAAA,EAAU,QAAA,EAAU,OAAO,CAAA;AAAA,IACzC,aAAA,CAAc,QAAA,EAAU,QAAA,EAAU,OAAO,CAAA;AAAA,IACzC,GAAI,WAAA,GAAc,CAAC,WAAW,IAAI;AAAC,GACpC,CAAA;AACH;;"}
@@ -1,6 +1,6 @@
1
1
  import { irObject, irStringIndexSignature, irProperty, irKeyword } from '../../../domain/ir/constructors.mjs';
2
2
  import { toPropertyName } from '../../../domain/ir/property-name.mjs';
3
- import { createRef } from '../../../domain/openapi/json-pointer.mjs';
3
+ import { appendPointer } from '../../../domain/openapi/json-pointer.mjs';
4
4
  import { isMediaTypeComponentRef } from '../../../domain/openapi/media-type-object.mjs';
5
5
  import { documentEntries } from '../document-entries.mjs';
6
6
  import { refType } from '../ref-type.mjs';
@@ -13,7 +13,7 @@ function headerMember(name, header, location, context) {
13
13
  const isReference = "$ref" in header;
14
14
  const type = isReference ? refType(header.$ref) : headerType(
15
15
  header,
16
- { ...location, path: createRef([location.path, "headers", name]) },
16
+ { ...location, path: appendPointer(location.path, ["headers", name]) },
17
17
  context
18
18
  );
19
19
  return documentMember(name, type, header, {
@@ -35,7 +35,7 @@ function mediaTypeEntryType(entry, location, context) {
35
35
  function contentMember(response, location, context) {
36
36
  const entries = documentEntries(response.content ?? {}, context.options);
37
37
  const members = entries.map(([contentType, entry]) => {
38
- const path = createRef([location.path, "content", contentType]);
38
+ const path = appendPointer(location.path, ["content", contentType]);
39
39
  const type = mediaTypeEntryType(entry, { ...location, path }, context);
40
40
  return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });
41
41
  });
@@ -1 +1 @@
1
- {"version":3,"file":"response.mjs","sources":["../../../../src/application/transform/document/response.ts"],"sourcesContent":["import {\n irKeyword,\n irObject,\n irProperty,\n irStringIndexSignature,\n} from \"../../../domain/ir/constructors.js\";\nimport type { IrMember, IrPropertySignature, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport {\n isMediaTypeComponentRef,\n type MediaTypeObject,\n} from \"../../../domain/openapi/media-type-object.js\";\nimport type { ResponseObject } from \"../../../domain/openapi/response-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { UNKNOWN_TYPE } from \"../shared-types.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { headerType } from \"./header.js\";\nimport { contentEntryType, itemContentMember, mediaTypeType } from \"./media-type.js\";\n\ntype HeaderEntry = NonNullable<ResponseObject[\"headers\"]>[string];\n\nfunction headerMember(\n name: string,\n header: HeaderEntry,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n // A referenced header counts as required: the reference does not say otherwise.\n const isReference = \"$ref\" in header;\n const type = isReference\n ? refType(header.$ref)\n : headerType(\n header,\n { ...location, path: createRef([location.path, \"headers\", name]) },\n context,\n );\n return documentMember(name, type, header, {\n isReadonly: context.options.immutable,\n isOptional: !isReference && !header.required,\n });\n}\n\n/** The listed headers, then `[name: string]: unknown`, because servers may send others. */\nfunction headersMember(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n const entries = documentEntries(response.headers ?? {}, context.options);\n const members: IrMember[] = entries.map(([name, header]) =>\n headerMember(name, header, location, context),\n );\n members.push(irStringIndexSignature(\"name\", UNKNOWN_TYPE, context.options.immutable));\n return irProperty(toPropertyName(\"headers\"), irObject(members));\n}\n\n/**\n * One media type of a response. The original reads a `$ref` entry as a media type without a\n * schema, so it is `unknown`; a `$ref` to an OpenAPI 3.2 media type component is typed as it.\n */\nfunction mediaTypeEntryType(\n entry: NonNullable<ResponseObject[\"content\"]>[string],\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n return \"$ref\" in entry && isMediaTypeComponentRef(entry.$ref)\n ? contentEntryType(entry, location, context)\n : mediaTypeType(entry as MediaTypeObject, location, context);\n}\n\n/** `content` with one member per media type, or `content?: never` when there are none. */\nfunction contentMember(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n const entries = documentEntries(response.content ?? {}, context.options);\n const members = entries.map(([contentType, entry]) => {\n const path = createRef([location.path, \"content\", contentType]);\n const type = mediaTypeEntryType(entry, { ...location, path }, context);\n return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });\n });\n const name = toPropertyName(\"content\");\n return members.length > 0\n ? irProperty(name, irObject(members))\n : irProperty(name, irKeyword(\"never\"), { isOptional: true });\n}\n\n/**\n * A response (OpenAPI 3.2 §4.8.17): `{ headers: {…}; content: {…} }`, and `itemContent` when a\n * media type has an `itemSchema`. No member is readonly, even with --immutable, as in the original.\n */\nexport function responseType(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const itemContent = itemContentMember(response.content ?? {}, location, context, {\n isReadonly: false,\n });\n return irObject([\n headersMember(response, location, context),\n contentMember(response, location, context),\n ...(itemContent ? [itemContent] : []),\n ]);\n}\n"],"names":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AU,OAAO,CAAA;AAAA,IACzC,GAAI,WAAA,GAAc,CAAC,WAAW,IAAI;AAAC,GACpC,CAAA;AACH;;"}
1
+ {"version":3,"file":"response.mjs","sources":["../../../../src/application/transform/document/response.ts"],"sourcesContent":["import {\n irKeyword,\n irObject,\n irProperty,\n irStringIndexSignature,\n} from \"../../../domain/ir/constructors.js\";\nimport type { IrMember, IrPropertySignature, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { appendPointer } from \"../../../domain/openapi/json-pointer.js\";\nimport {\n isMediaTypeComponentRef,\n type MediaTypeObject,\n} from \"../../../domain/openapi/media-type-object.js\";\nimport type { ResponseObject } from \"../../../domain/openapi/response-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { UNKNOWN_TYPE } from \"../shared-types.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { headerType } from \"./header.js\";\nimport { contentEntryType, itemContentMember, mediaTypeType } from \"./media-type.js\";\n\ntype HeaderEntry = NonNullable<ResponseObject[\"headers\"]>[string];\n\nfunction headerMember(\n name: string,\n header: HeaderEntry,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n // A referenced header counts as required: the reference does not say otherwise.\n const isReference = \"$ref\" in header;\n const type = isReference\n ? refType(header.$ref)\n : headerType(\n header,\n { ...location, path: appendPointer(location.path, [\"headers\", name]) },\n context,\n );\n return documentMember(name, type, header, {\n isReadonly: context.options.immutable,\n isOptional: !isReference && !header.required,\n });\n}\n\n/** The listed headers, then `[name: string]: unknown`, because servers may send others. */\nfunction headersMember(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n const entries = documentEntries(response.headers ?? {}, context.options);\n const members: IrMember[] = entries.map(([name, header]) =>\n headerMember(name, header, location, context),\n );\n members.push(irStringIndexSignature(\"name\", UNKNOWN_TYPE, context.options.immutable));\n return irProperty(toPropertyName(\"headers\"), irObject(members));\n}\n\n/**\n * One media type of a response. The original reads a `$ref` entry as a media type without a\n * schema, so it is `unknown`; a `$ref` to an OpenAPI 3.2 media type component is typed as it.\n */\nfunction mediaTypeEntryType(\n entry: NonNullable<ResponseObject[\"content\"]>[string],\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n return \"$ref\" in entry && isMediaTypeComponentRef(entry.$ref)\n ? contentEntryType(entry, location, context)\n : mediaTypeType(entry as MediaTypeObject, location, context);\n}\n\n/** `content` with one member per media type, or `content?: never` when there are none. */\nfunction contentMember(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrPropertySignature {\n const entries = documentEntries(response.content ?? {}, context.options);\n const members = entries.map(([contentType, entry]) => {\n const path = appendPointer(location.path, [\"content\", contentType]);\n const type = mediaTypeEntryType(entry, { ...location, path }, context);\n return documentMember(contentType, type, entry, { isReadonly: context.options.immutable });\n });\n const name = toPropertyName(\"content\");\n return members.length > 0\n ? irProperty(name, irObject(members))\n : irProperty(name, irKeyword(\"never\"), { isOptional: true });\n}\n\n/**\n * A response (OpenAPI 3.2 §4.8.17): `{ headers: {…}; content: {…} }`, and `itemContent` when a\n * media type has an `itemSchema`. No member is readonly, even with --immutable, as in the original.\n */\nexport function responseType(\n response: ResponseObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const itemContent = itemContentMember(response.content ?? {}, location, context, {\n isReadonly: false,\n });\n return irObject([\n headersMember(response, location, context),\n contentMember(response, location, context),\n ...(itemContent ? [itemContent] : []),\n ]);\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAwBA,SAAS,YAAA,CACP,IAAA,EACA,MAAA,EACA,QAAA,EACA,OAAA,EACqB;AAErB,EAAA,MAAM,cAAc,MAAA,IAAU,MAAA;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAA,GACT,OAAA,CAAQ,MAAA,CAAO,IAAI,CAAA,GACnB,UAAA;AAAA,IACE,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,QAAQ,OAAO,CAAA;AACvE,EAAA,MAAM,UAAU,OAAA,CAAQ,GAAA,CAAI,CAAC,CAAC,WAAA,EAAa,KAAK,CAAA,KAAM;AACpD,IAAA,MAAM,OAAO,aAAA,CAAc,QAAA,CAAS,MAAM,CAAC,SAAA,EAAW,WAAW,CAAC,CAAA;AAClE,IAAA,MAAM,IAAA,GAAO,mBAAmB,KAAA,EAAO,EAAE,GAAG,QAAA,EAAU,IAAA,IAAQ,OAAO,CAAA;AACrE,IAAA,OAAO,cAAA,CAAe,aAAa,IAAA,EAAM,KAAA,EAAO,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EAC3F,CAAC,CAAA;AACD,EAAA,MAAM,IAAA,GAAO,eAAe,SAAS,CAAA;AACrC,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,GACpB,UAAA,CAAW,IAAA,EAAM,SAAS,OAAO,CAAC,CAAA,GAClC,UAAA,CAAW,MAAM,SAAA,CAAU,OAAO,GAAG,EAAE,UAAA,EAAY,MAAM,CAAA;AAC/D;AAMO,SAAS,YAAA,CACd,QAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,cAAc,iBAAA,CAAkB,QAAA,CAAS,WAAW,EAAC,EAAG,UAAU,OAAA,EAAS;AAAA,IAC/E,UAAA,EAAY;AAAA,GACb,CAAA;AACD,EAAA,OAAO,QAAA,CAAS;AAAA,IACd,aAAA,CAAc,QAAA,EAAU,QAAA,EAAU,OAAO,CAAA;AAAA,IACzC,aAAA,CAAc,QAAA,EAAU,QAAA,EAAU,OAAO,CAAA;AAAA,IACzC,GAAI,WAAA,GAAc,CAAC,WAAW,IAAI;AAAC,GACpC,CAAA;AACH;;"}
@@ -11,7 +11,7 @@ function responsesType(responses, location, context) {
11
11
  const members = documentEntries.documentEntries(responses, context.options).map(([code, response$1]) => {
12
12
  const type = "$ref" in response$1 ? refType.refType(response$1.$ref) : response.responseType(
13
13
  response$1,
14
- { ...location, path: jsonPointer.createRef([location.path, "responses", code]) },
14
+ { ...location, path: jsonPointer.appendPointer(location.path, ["responses", code]) },
15
15
  context
16
16
  );
17
17
  return documentMember.documentMember(code, type, response$1, { isReadonly: context.options.immutable });
@@ -1 +1 @@
1
- {"version":3,"file":"responses.cjs","sources":["../../../../src/application/transform/document/responses.ts"],"sourcesContent":["import { irKeyword, irObject } from \"../../../domain/ir/constructors.js\";\nimport type { IrType } from \"../../../domain/ir/nodes.js\";\nimport { createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport type { ResponsesObject } from \"../../../domain/openapi/response-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { responseType } from \"./response.js\";\n\n/** Responses by status code (OpenAPI 3.1 §4.8.16), or `never` when there are none. */\nexport function responsesType(\n responses: ResponsesObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const members = documentEntries(responses, context.options).map(([code, response]) => {\n const type =\n \"$ref\" in response\n ? refType(response.$ref)\n : responseType(\n response,\n { ...location, path: createRef([location.path, \"responses\", code]) },\n context,\n );\n return documentMember(code, type, response, { isReadonly: context.options.immutable });\n });\n return members.length > 0 ? irObject(members) : irKeyword(\"never\");\n}\n"],"names":["documentEntries","response","refType","responseType","createRef","documentMember","irObject","irKeyword"],"mappings":";;;;;;;;;AAWO,SAAS,aAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAUA,+BAAA,CAAgB,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,IAAA,EAAMC,UAAQ,CAAA,KAAM;AACpF,IAAA,MAAM,OACJ,MAAA,IAAUA,UAAA,GACNC,eAAA,CAAQD,UAAA,CAAS,IAAI,CAAA,GACrBE,qBAAA;AAAA,MACEF,UAAA;AAAA,MACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAMG,qBAAA,CAAU,CAAC,QAAA,CAAS,IAAA,EAAM,WAAA,EAAa,IAAI,CAAC,CAAA,EAAE;AAAA,MACnE;AAAA,KACF;AACN,IAAA,OAAOC,6BAAA,CAAe,MAAM,IAAA,EAAMJ,UAAA,EAAU,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EACvF,CAAC,CAAA;AACD,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,GAAIK,sBAAS,OAAO,CAAA,GAAIC,uBAAU,OAAO,CAAA;AACnE;;"}
1
+ {"version":3,"file":"responses.cjs","sources":["../../../../src/application/transform/document/responses.ts"],"sourcesContent":["import { irKeyword, irObject } from \"../../../domain/ir/constructors.js\";\nimport type { IrType } from \"../../../domain/ir/nodes.js\";\nimport { appendPointer } from \"../../../domain/openapi/json-pointer.js\";\nimport type { ResponsesObject } from \"../../../domain/openapi/response-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { responseType } from \"./response.js\";\n\n/** Responses by status code (OpenAPI 3.1 §4.8.16), or `never` when there are none. */\nexport function responsesType(\n responses: ResponsesObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const members = documentEntries(responses, context.options).map(([code, response]) => {\n const type =\n \"$ref\" in response\n ? refType(response.$ref)\n : responseType(\n response,\n { ...location, path: appendPointer(location.path, [\"responses\", code]) },\n context,\n );\n return documentMember(code, type, response, { isReadonly: context.options.immutable });\n });\n return members.length > 0 ? irObject(members) : irKeyword(\"never\");\n}\n"],"names":["documentEntries","response","refType","responseType","appendPointer","documentMember","irObject","irKeyword"],"mappings":";;;;;;;;;AAWO,SAAS,aAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAUA,+BAAA,CAAgB,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,IAAA,EAAMC,UAAQ,CAAA,KAAM;AACpF,IAAA,MAAM,OACJ,MAAA,IAAUA,UAAA,GACNC,eAAA,CAAQD,UAAA,CAAS,IAAI,CAAA,GACrBE,qBAAA;AAAA,MACEF,UAAA;AAAA,MACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAMG,yBAAA,CAAc,QAAA,CAAS,IAAA,EAAM,CAAC,WAAA,EAAa,IAAI,CAAC,CAAA,EAAE;AAAA,MACvE;AAAA,KACF;AACN,IAAA,OAAOC,6BAAA,CAAe,MAAM,IAAA,EAAMJ,UAAA,EAAU,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EACvF,CAAC,CAAA;AACD,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,GAAIK,sBAAS,OAAO,CAAA,GAAIC,uBAAU,OAAO,CAAA;AACnE;;"}
@@ -1,5 +1,5 @@
1
1
  import { irObject, irKeyword } from '../../../domain/ir/constructors.mjs';
2
- import { createRef } from '../../../domain/openapi/json-pointer.mjs';
2
+ import { appendPointer } from '../../../domain/openapi/json-pointer.mjs';
3
3
  import { documentEntries } from '../document-entries.mjs';
4
4
  import { refType } from '../ref-type.mjs';
5
5
  import { documentMember } from './document-member.mjs';
@@ -9,7 +9,7 @@ function responsesType(responses, location, context) {
9
9
  const members = documentEntries(responses, context.options).map(([code, response]) => {
10
10
  const type = "$ref" in response ? refType(response.$ref) : responseType(
11
11
  response,
12
- { ...location, path: createRef([location.path, "responses", code]) },
12
+ { ...location, path: appendPointer(location.path, ["responses", code]) },
13
13
  context
14
14
  );
15
15
  return documentMember(code, type, response, { isReadonly: context.options.immutable });
@@ -1 +1 @@
1
- {"version":3,"file":"responses.mjs","sources":["../../../../src/application/transform/document/responses.ts"],"sourcesContent":["import { irKeyword, irObject } from \"../../../domain/ir/constructors.js\";\nimport type { IrType } from \"../../../domain/ir/nodes.js\";\nimport { createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport type { ResponsesObject } from \"../../../domain/openapi/response-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { responseType } from \"./response.js\";\n\n/** Responses by status code (OpenAPI 3.1 §4.8.16), or `never` when there are none. */\nexport function responsesType(\n responses: ResponsesObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const members = documentEntries(responses, context.options).map(([code, response]) => {\n const type =\n \"$ref\" in response\n ? refType(response.$ref)\n : responseType(\n response,\n { ...location, path: createRef([location.path, \"responses\", code]) },\n context,\n );\n return documentMember(code, type, response, { isReadonly: context.options.immutable });\n });\n return members.length > 0 ? irObject(members) : irKeyword(\"never\");\n}\n"],"names":[],"mappings":";;;;;;;AAWO,SAAS,aAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAU,eAAA,CAAgB,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,IAAA,EAAM,QAAQ,CAAA,KAAM;AACpF,IAAA,MAAM,OACJ,MAAA,IAAU,QAAA,GACN,OAAA,CAAQ,QAAA,CAAS,IAAI,CAAA,GACrB,YAAA;AAAA,MACE,QAAA;AAAA,MACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,SAAA,CAAU,CAAC,QAAA,CAAS,IAAA,EAAM,WAAA,EAAa,IAAI,CAAC,CAAA,EAAE;AAAA,MACnE;AAAA,KACF;AACN,IAAA,OAAO,cAAA,CAAe,MAAM,IAAA,EAAM,QAAA,EAAU,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EACvF,CAAC,CAAA;AACD,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,GAAI,SAAS,OAAO,CAAA,GAAI,UAAU,OAAO,CAAA;AACnE;;"}
1
+ {"version":3,"file":"responses.mjs","sources":["../../../../src/application/transform/document/responses.ts"],"sourcesContent":["import { irKeyword, irObject } from \"../../../domain/ir/constructors.js\";\nimport type { IrType } from \"../../../domain/ir/nodes.js\";\nimport { appendPointer } from \"../../../domain/openapi/json-pointer.js\";\nimport type { ResponsesObject } from \"../../../domain/openapi/response-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { responseType } from \"./response.js\";\n\n/** Responses by status code (OpenAPI 3.1 §4.8.16), or `never` when there are none. */\nexport function responsesType(\n responses: ResponsesObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n const members = documentEntries(responses, context.options).map(([code, response]) => {\n const type =\n \"$ref\" in response\n ? refType(response.$ref)\n : responseType(\n response,\n { ...location, path: appendPointer(location.path, [\"responses\", code]) },\n context,\n );\n return documentMember(code, type, response, { isReadonly: context.options.immutable });\n });\n return members.length > 0 ? irObject(members) : irKeyword(\"never\");\n}\n"],"names":[],"mappings":";;;;;;;AAWO,SAAS,aAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,MAAM,OAAA,GAAU,eAAA,CAAgB,SAAA,EAAW,OAAA,CAAQ,OAAO,CAAA,CAAE,GAAA,CAAI,CAAC,CAAC,IAAA,EAAM,QAAQ,CAAA,KAAM;AACpF,IAAA,MAAM,OACJ,MAAA,IAAU,QAAA,GACN,OAAA,CAAQ,QAAA,CAAS,IAAI,CAAA,GACrB,YAAA;AAAA,MACE,QAAA;AAAA,MACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,aAAA,CAAc,QAAA,CAAS,IAAA,EAAM,CAAC,WAAA,EAAa,IAAI,CAAC,CAAA,EAAE;AAAA,MACvE;AAAA,KACF;AACN,IAAA,OAAO,cAAA,CAAe,MAAM,IAAA,EAAM,QAAA,EAAU,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAA;AAAA,EACvF,CAAC,CAAA;AACD,EAAA,OAAO,QAAQ,MAAA,GAAS,CAAA,GAAI,SAAS,OAAO,CAAA,GAAI,UAAU,OAAO,CAAA;AACnE;;"}
@@ -2,6 +2,8 @@
2
2
 
3
3
  const constructors = require('../../../domain/ir/constructors.cjs');
4
4
  const rawTextEscapes = require('../../../domain/ir/raw-text-escapes.cjs');
5
+ const numberedNames = require('../numbered-names.cjs');
6
+ const declaredTypeNames = require('./declared-type-names.cjs');
5
7
  const globalTypeReferences = require('./global-type-references.cjs');
6
8
 
7
9
  const REFERENCE_PREFIX = "components['";
@@ -19,16 +21,6 @@ function rootTypeAlias(name, kind, item) {
19
21
  function isRootTypeAlias(declaration) {
20
22
  return declaration.kind === "typeAlias" && declaration.type.kind === "raw" && declaration.type.text.startsWith(REFERENCE_PREFIX);
21
23
  }
22
- function footerTypeNames(declarations) {
23
- return new Set(
24
- declarations.flatMap((declaration) => {
25
- if (declaration.kind === "enum") {
26
- return [declaration.name];
27
- }
28
- return declaration.kind === "rawDeclaration" && declaration.name !== void 0 ? [declaration.name] : [];
29
- })
30
- );
31
- }
32
24
  function declaredNames(declarations) {
33
25
  return new Set(
34
26
  declarations.flatMap(
@@ -36,19 +28,11 @@ function declaredNames(declarations) {
36
28
  )
37
29
  );
38
30
  }
39
- function freeName(name, taken) {
40
- let candidate = `${name}_2`;
41
- for (let counter = 3; taken.has(candidate); counter++) {
42
- candidate = `${name}_${counter}`;
43
- }
44
- return candidate;
45
- }
46
31
  function renameTakenAliases(body, footer, closing = []) {
47
- const reserved = footerTypeNames(footer);
48
- for (const name of globalTypeReferences.globalTypeReferences([...body, ...footer, ...closing])) {
49
- reserved.add(name);
50
- }
51
- const taken = declaredNames([...body, ...footer, ...closing]);
32
+ const all = [...body, ...footer, ...closing];
33
+ const others = all.filter((declaration) => !isRootTypeAlias(declaration));
34
+ const reserved = /* @__PURE__ */ new Set([...declaredTypeNames.typeNamesDeclaredBy(others), ...globalTypeReferences.globalTypeReferences(all)]);
35
+ const taken = /* @__PURE__ */ new Set([...declaredNames(all), ...declaredTypeNames.typeNamesDeclaredBy(all)]);
52
36
  const aliasNames = /* @__PURE__ */ new Set();
53
37
  return body.map((declaration) => {
54
38
  if (!isRootTypeAlias(declaration)) {
@@ -59,12 +43,13 @@ function renameTakenAliases(body, footer, closing = []) {
59
43
  if (!isRepeated && !reserved.has(declaration.name)) {
60
44
  return declaration;
61
45
  }
62
- const name = freeName(declaration.name, taken);
46
+ const name = numberedNames.freeNumberedName(declaration.name, taken);
63
47
  taken.add(name);
64
48
  return { ...declaration, name };
65
49
  });
66
50
  }
67
51
 
52
+ exports.isRootTypeAlias = isRootTypeAlias;
68
53
  exports.renameTakenAliases = renameTakenAliases;
69
54
  exports.rootTypeAlias = rootTypeAlias;
70
55
  //# sourceMappingURL=root-type-aliases.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"root-type-aliases.cjs","sources":["../../../../src/application/transform/document/root-type-aliases.ts"],"sourcesContent":["import { irRaw } from \"../../../domain/ir/constructors.js\";\nimport type { IrDeclaration, IrTypeAliasDeclaration } from \"../../../domain/ir/nodes.js\";\nimport { escapeSingleQuotedText } from \"../../../domain/ir/raw-text-escapes.js\";\nimport type { ComponentKind } from \"../../../domain/openapi/components-object.js\";\nimport { globalTypeReferences } from \"./global-type-references.js\";\n\n/** The `--root-types` aliases: `export type Pet = components['schemas']['Pet'];`. */\n\nconst REFERENCE_PREFIX = \"components['\";\n\n/** The alias of one component. */\nexport function rootTypeAlias(\n name: string,\n kind: ComponentKind,\n item: string,\n): IrTypeAliasDeclaration {\n return {\n kind: \"typeAlias\",\n name,\n isExported: true,\n // The original writes the reference as text, with single quotes, and did not escape the\n // name: a quote in it could add code to the generated file (intentional fix).\n type: irRaw(`${REFERENCE_PREFIX}${kind}']['${escapeSingleQuotedText(item)}']`),\n comments: [],\n };\n}\n\nfunction isRootTypeAlias(declaration: IrDeclaration): declaration is IrTypeAliasDeclaration {\n return (\n declaration.kind === \"typeAlias\" &&\n declaration.type.kind === \"raw\" &&\n declaration.type.text.startsWith(REFERENCE_PREFIX)\n );\n}\n\n/**\n * The type names the footer declares that an alias must not take: enums, and helper types such as\n * `WithRequired`. Value declarations (`--enum-values` arrays) live in another namespace.\n */\nfunction footerTypeNames(declarations: readonly IrDeclaration[]): Set<string> {\n return new Set(\n declarations.flatMap((declaration) => {\n if (declaration.kind === \"enum\") {\n return [declaration.name];\n }\n return declaration.kind === \"rawDeclaration\" && declaration.name !== undefined\n ? [declaration.name]\n : [];\n }),\n );\n}\n\nfunction declaredNames(declarations: readonly IrDeclaration[]): Set<string> {\n return new Set(\n declarations.flatMap((declaration) =>\n \"name\" in declaration && declaration.name !== undefined ? [declaration.name] : [],\n ),\n );\n}\n\nfunction freeName(name: string, taken: ReadonlySet<string>): string {\n let candidate = `${name}_2`;\n for (let counter = 3; taken.has(candidate); counter++) {\n candidate = `${name}_${counter}`;\n }\n return candidate;\n}\n\n/**\n * Rename each root alias whose name an enum or a helper type of the footer also declares, or that\n * shadows a TypeScript global type the output refers to (`Record` in `Record<string, never>`), to\n * the next free `Name_2`, `Name_3`, … (the suffix `--root-types` uses for its own conflicts). The\n * footer and the globals keep their names, because the generated types refer to them. Before, the\n * output did not compile (enums: upstream #2099, #2341, #2206; helpers: a schema named\n * `WithRequired`, roadmap R11; globals: TS2315). Other declarations are returned unchanged.\n *\n * With the `root-type-numbering` fix (ADR-021, roadmap R13, backlog 30) the body also holds the\n * aliases a later schema of one exported name took the name from, after the other aliases and\n * under that same name. Each gets the next free number in body order, after the alias that kept\n * the name got its own: so the fix only adds exports, and every other alias keeps the name it has\n * without the fix.\n */\nexport function renameTakenAliases<T extends IrDeclaration>(\n body: readonly T[],\n footer: readonly IrDeclaration[],\n closing: readonly IrDeclaration[] = [],\n): T[] {\n const reserved = footerTypeNames(footer);\n for (const name of globalTypeReferences([...body, ...footer, ...closing])) {\n reserved.add(name);\n }\n const taken = declaredNames([...body, ...footer, ...closing]);\n const aliasNames = new Set<string>();\n return body.map((declaration) => {\n if (!isRootTypeAlias(declaration)) {\n return declaration;\n }\n const isRepeated = aliasNames.has(declaration.name);\n aliasNames.add(declaration.name);\n if (!isRepeated && !reserved.has(declaration.name)) {\n return declaration;\n }\n const name = freeName(declaration.name, taken);\n taken.add(name);\n return { ...declaration, name };\n });\n}\n"],"names":["irRaw","escapeSingleQuotedText","globalTypeReferences"],"mappings":";;;;;;AAQA,MAAM,gBAAA,GAAmB,cAAA;AAGlB,SAAS,aAAA,CACd,IAAA,EACA,IAAA,EACA,IAAA,EACwB;AACxB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,WAAA;AAAA,IACN,IAAA;AAAA,IACA,UAAA,EAAY,IAAA;AAAA;AAAA;AAAA,IAGZ,IAAA,EAAMA,kBAAA,CAAM,CAAA,EAAG,gBAAgB,CAAA,EAAG,IAAI,CAAA,IAAA,EAAOC,qCAAA,CAAuB,IAAI,CAAC,CAAA,EAAA,CAAI,CAAA;AAAA,IAC7E,UAAU;AAAC,GACb;AACF;AAEA,SAAS,gBAAgB,WAAA,EAAmE;AAC1F,EAAA,OACE,WAAA,CAAY,IAAA,KAAS,WAAA,IACrB,WAAA,CAAY,IAAA,CAAK,IAAA,KAAS,KAAA,IAC1B,WAAA,CAAY,IAAA,CAAK,IAAA,CAAK,UAAA,CAAW,gBAAgB,CAAA;AAErD;AAMA,SAAS,gBAAgB,YAAA,EAAqD;AAC5E,EAAA,OAAO,IAAI,GAAA;AAAA,IACT,YAAA,CAAa,OAAA,CAAQ,CAAC,WAAA,KAAgB;AACpC,MAAA,IAAI,WAAA,CAAY,SAAS,MAAA,EAAQ;AAC/B,QAAA,OAAO,CAAC,YAAY,IAAI,CAAA;AAAA,MAC1B;AACA,MAAA,OAAO,WAAA,CAAY,IAAA,K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CAAA,EAAG;AACjC,MAAA,OAAO,WAAA;AAAA,IACT;AACA,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,GAAA,CAAI,WAAA,CAAY,IAAI,CAAA;AAClD,IAAA,UAAA,CAAW,GAAA,CAAI,YAAY,IAAI,CAAA;AAC/B,IAAA,IAAI,CAAC,UAAA,IAAc,CAAC,SAAS,GAAA,CAAI,WAAA,CAAY,IAAI,CAAA,EAAG;AAClD,MAAA,OAAO,WAAA;AAAA,IACT;AACA,IAAA,MAAM,IAAA,GAAO,QAAA,CAAS,WAAA,CAAY,IAAA,EAAM,KAAK,CAAA;AAC7C,IAAA,KAAA,CAAM,IAAI,IAAI,CAAA;AACd,IAAA,OAAO,EAAE,GAAG,WAAA,EAAa,IAAA,EAAK;AAAA,EAChC,CAAC,CAAA;AACH;;;"}
1
+ {"version":3,"file":"root-type-aliases.cjs","sources":["../../../../src/application/transform/document/root-type-aliases.ts"],"sourcesContent":["import { irRaw } from \"../../../domain/ir/constructors.js\";\nimport type { IrDeclaration, IrTypeAliasDeclaration } from \"../../../domain/ir/nodes.js\";\nimport { escapeSingleQuotedText } from \"../../../domain/ir/raw-text-escapes.js\";\nimport type { ComponentKind } from \"../../../domain/openapi/components-object.js\";\nimport { freeNumberedName } from \"../numbered-names.js\";\nimport { typeNamesDeclaredBy } from \"./declared-type-names.js\";\nimport { globalTypeReferences } from \"./global-type-references.js\";\n\n/** The `--root-types` aliases: `export type Pet = components['schemas']['Pet'];`. */\n\nconst REFERENCE_PREFIX = \"components['\";\n\n/** The alias of one component. */\nexport function rootTypeAlias(\n name: string,\n kind: ComponentKind,\n item: string,\n): IrTypeAliasDeclaration {\n return {\n kind: \"typeAlias\",\n name,\n isExported: true,\n // The original writes the reference as text, with single quotes, and did not escape the\n // name: a quote in it could add code to the generated file (intentional fix).\n type: irRaw(`${REFERENCE_PREFIX}${kind}']['${escapeSingleQuotedText(item)}']`),\n comments: [],\n };\n}\n\n/** Whether the declaration is a `--root-types` alias, which gives way to every other name. */\nexport function isRootTypeAlias(declaration: IrDeclaration): declaration is IrTypeAliasDeclaration {\n return (\n declaration.kind === \"typeAlias\" &&\n declaration.type.kind === \"raw\" &&\n declaration.type.text.startsWith(REFERENCE_PREFIX)\n );\n}\n\nfunction declaredNames(declarations: readonly IrDeclaration[]): Set<string> {\n return new Set(\n declarations.flatMap((declaration) =>\n \"name\" in declaration && declaration.name !== undefined ? [declaration.name] : [],\n ),\n );\n}\n\n/**\n * Rename each root alias whose name another declaration of the output also takes (an enum, a\n * helper type, the `--make-paths-enum` enum `ApiPaths`, a root interface, `--read-write-markers`\n * or `inject` types), or that shadows a TypeScript global type the output refers to (`Record` in\n * `Record<string, never>`), to the next free `Name_2`, `Name_3`, … (the suffix `--root-types` uses\n * for its own conflicts). The others and the globals keep their names, because the generated\n * types refer to them. Before, the output did not compile (enums: upstream #2099, #2341, #2206;\n * helpers: a schema named `WithRequired`, roadmap R11; globals: TS2315; `ApiPaths`: TS2567).\n * Other declarations are returned unchanged.\n *\n * With the `root-type-numbering` fix (ADR-021, roadmap R13, backlog 30) the body also holds the\n * aliases a later schema of one exported name took the name from, after the other aliases and\n * under that same name. Each gets the next free number in body order, after the alias that kept\n * the name got its own: so the fix only adds exports, and every other alias keeps the name it has\n * without the fix.\n */\nexport function renameTakenAliases<T extends IrDeclaration>(\n body: readonly T[],\n footer: readonly IrDeclaration[],\n closing: readonly IrDeclaration[] = [],\n): T[] {\n const all = [...body, ...footer, ...closing];\n const others = all.filter((declaration) => !isRootTypeAlias(declaration));\n const reserved = new Set([...typeNamesDeclaredBy(others), ...globalTypeReferences(all)]);\n const taken = new Set([...declaredNames(all), ...typeNamesDeclaredBy(all)]);\n const aliasNames = new Set<string>();\n return body.map((declaration) => {\n if (!isRootTypeAlias(declaration)) {\n return declaration;\n }\n const isRepeated = aliasNames.has(declaration.name);\n aliasNames.add(declaration.name);\n if (!isRepeated && !reserved.has(declaration.name)) {\n return declaration;\n }\n const name = freeNumberedName(declaration.name, taken);\n taken.add(name);\n return { ...declaration, name };\n });\n}\n"],"names":["irRaw","escapeSingleQuotedText","typeNamesDeclaredBy","globalTypeReferences","freeNumberedName"],"mappings":";;;;;;;;AAUA,MAAM,gBAAA,GAAmB,cAAA;AAGlB,SAAS,aAAA,CACd,IAAA,EACA,IAAA,EACA,IAAA,EACwB;AACxB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,WAAA;AAAA,IACN,IAAA;AAAA,IACA,UAAA,EAAY,IAAA;AAAA;AAAA;AAAA,IAGZ,IAAA,EAAMA,kBAAA,CAAM,CAAA,EAAG,gBAAgB,CAAA,EAAG,IAAI,CAAA,IAAA,EAAOC,qCAAA,CAAuB,IAAI,CAAC,CAAA,EAAA,CAAI,CAAA;AAAA,IAC7E,UAAU;AAAC,GACb;AACF;AAGO,SAAS,gBAAgB,WAAA,EAAmE;AACjG,EAAA,OACE,WAAA,CAAY,IAAA,KAAS,WAAA,IACrB,WAAA,CAAY,IAAA,CAAK,IAAA,KAAS,KAAA,IAC1B,WAAA,CAAY,IAAA,CAAK,IAAA,CAAK,UAAA,CAAW,gBAAgB,CAAA;AAErD;AAEA,SAAS,cAAc,YAAA,EAAqD;AAC1E,EAAA,OAAO,IAAI,GAAA;AAAA,IACT,YAAA,CAAa,OAAA;AAAA,MAAQ,CAAC,WAAA,KACpB,MAAA,IAAU,WAAA,IAAe,WAAA,CAAY,IAAA,KAAS,MAAA,GAAY,CAAC,WAAA,CAAY,IAAI,CAAA,GAAI;AAAC;AAClF,GACF;AACF;AAkBO,SAAS,kBAAA,CACd,IAAA,EACA,MAAA,EACA,OAAA,GAAoC,EAAC,EAChC;AACL,EAAA,MAAM,MAAM,CAAC,GAAG,MAAM,GAAG,MAAA,EAAQ,GAAG,OAAO,CAAA;AAC3C,EAAA,MAAM,MAAA,GAAS,IAAI,MAAA,CAAO,CAAC,gBAAgB,CAAC,eAAA,CAAgB,WAAW,CAAC,CAAA;AACxE,EAAA,MAAM,QAAA,mBAAW,IAAI,GAAA,CAAI,CAAC,GAAGC,qCAAA,CAAoB,MAAM,CAAA,EAAG,GAAGC,yCAAA,CAAqB,GAAG,CAAC,CAAC,CAAA;AACvF,EAAA,MAAM,KAAA,mBAAQ,IAAI,GAAA,CAAI,CAAC,GAAG,aAAA,CAAc,GAAG,CAAA,EAAG,GAAGD,qCAAA,CAAoB,GAAG,CAAC,CAAC,CAAA;AAC1E,EAAA,MAAM,UAAA,uBAAiB,GAAA,EAAY;AACnC,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,CAAC,WAAA,KAAgB;AAC/B,IAAA,IAAI,CAAC,eAAA,CAAgB,WAAW,CAAA,EAAG;AACjC,MAAA,OAAO,WAAA;AAAA,IACT;AACA,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,GAAA,CAAI,WAAA,CAAY,IAAI,CAAA;AAClD,IAAA,UAAA,CAAW,GAAA,CAAI,YAAY,IAAI,CAAA;AAC/B,IAAA,IAAI,CAAC,UAAA,IAAc,CAAC,SAAS,GAAA,CAAI,WAAA,CAAY,IAAI,CAAA,EAAG;AAClD,MAAA,OAAO,WAAA;AAAA,IACT;AACA,IAAA,MAAM,IAAA,GAAOE,8BAAA,CAAiB,WAAA,CAAY,IAAA,EAAM,KAAK,CAAA;AACrD,IAAA,KAAA,CAAM,IAAI,IAAI,CAAA;AACd,IAAA,OAAO,EAAE,GAAG,WAAA,EAAa,IAAA,EAAK;AAAA,EAChC,CAAC,CAAA;AACH;;;;"}
@@ -1,5 +1,7 @@
1
1
  import { irRaw } from '../../../domain/ir/constructors.mjs';
2
2
  import { escapeSingleQuotedText } from '../../../domain/ir/raw-text-escapes.mjs';
3
+ import { freeNumberedName } from '../numbered-names.mjs';
4
+ import { typeNamesDeclaredBy } from './declared-type-names.mjs';
3
5
  import { globalTypeReferences } from './global-type-references.mjs';
4
6
 
5
7
  const REFERENCE_PREFIX = "components['";
@@ -17,16 +19,6 @@ function rootTypeAlias(name, kind, item) {
17
19
  function isRootTypeAlias(declaration) {
18
20
  return declaration.kind === "typeAlias" && declaration.type.kind === "raw" && declaration.type.text.startsWith(REFERENCE_PREFIX);
19
21
  }
20
- function footerTypeNames(declarations) {
21
- return new Set(
22
- declarations.flatMap((declaration) => {
23
- if (declaration.kind === "enum") {
24
- return [declaration.name];
25
- }
26
- return declaration.kind === "rawDeclaration" && declaration.name !== void 0 ? [declaration.name] : [];
27
- })
28
- );
29
- }
30
22
  function declaredNames(declarations) {
31
23
  return new Set(
32
24
  declarations.flatMap(
@@ -34,19 +26,11 @@ function declaredNames(declarations) {
34
26
  )
35
27
  );
36
28
  }
37
- function freeName(name, taken) {
38
- let candidate = `${name}_2`;
39
- for (let counter = 3; taken.has(candidate); counter++) {
40
- candidate = `${name}_${counter}`;
41
- }
42
- return candidate;
43
- }
44
29
  function renameTakenAliases(body, footer, closing = []) {
45
- const reserved = footerTypeNames(footer);
46
- for (const name of globalTypeReferences([...body, ...footer, ...closing])) {
47
- reserved.add(name);
48
- }
49
- const taken = declaredNames([...body, ...footer, ...closing]);
30
+ const all = [...body, ...footer, ...closing];
31
+ const others = all.filter((declaration) => !isRootTypeAlias(declaration));
32
+ const reserved = /* @__PURE__ */ new Set([...typeNamesDeclaredBy(others), ...globalTypeReferences(all)]);
33
+ const taken = /* @__PURE__ */ new Set([...declaredNames(all), ...typeNamesDeclaredBy(all)]);
50
34
  const aliasNames = /* @__PURE__ */ new Set();
51
35
  return body.map((declaration) => {
52
36
  if (!isRootTypeAlias(declaration)) {
@@ -57,11 +41,11 @@ function renameTakenAliases(body, footer, closing = []) {
57
41
  if (!isRepeated && !reserved.has(declaration.name)) {
58
42
  return declaration;
59
43
  }
60
- const name = freeName(declaration.name, taken);
44
+ const name = freeNumberedName(declaration.name, taken);
61
45
  taken.add(name);
62
46
  return { ...declaration, name };
63
47
  });
64
48
  }
65
49
 
66
- export { renameTakenAliases, rootTypeAlias };
50
+ export { isRootTypeAlias, renameTakenAliases, rootTypeAlias };
67
51
  //# sourceMappingURL=root-type-aliases.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"root-type-aliases.mjs","sources":["../../../../src/application/transform/document/root-type-aliases.ts"],"sourcesContent":["import { irRaw } from \"../../../domain/ir/constructors.js\";\nimport type { IrDeclaration, IrTypeAliasDeclaration } from \"../../../domain/ir/nodes.js\";\nimport { escapeSingleQuotedText } from \"../../../domain/ir/raw-text-escapes.js\";\nimport type { ComponentKind } from \"../../../domain/openapi/components-object.js\";\nimport { globalTypeReferences } from \"./global-type-references.js\";\n\n/** The `--root-types` aliases: `export type Pet = components['schemas']['Pet'];`. */\n\nconst REFERENCE_PREFIX = \"components['\";\n\n/** The alias of one component. */\nexport function rootTypeAlias(\n name: string,\n kind: ComponentKind,\n item: string,\n): IrTypeAliasDeclaration {\n return {\n kind: \"typeAlias\",\n name,\n isExported: true,\n // The original writes the reference as text, with single quotes, and did not escape the\n // name: a quote in it could add code to the generated file (intentional fix).\n type: irRaw(`${REFERENCE_PREFIX}${kind}']['${escapeSingleQuotedText(item)}']`),\n comments: [],\n };\n}\n\nfunction isRootTypeAlias(declaration: IrDeclaration): declaration is IrTypeAliasDeclaration {\n return (\n declaration.kind === \"typeAlias\" &&\n declaration.type.kind === \"raw\" &&\n declaration.type.text.startsWith(REFERENCE_PREFIX)\n );\n}\n\n/**\n * The type names the footer declares that an alias must not take: enums, and helper types such as\n * `WithRequired`. Value declarations (`--enum-values` arrays) live in another namespace.\n */\nfunction footerTypeNames(declarations: readonly IrDeclaration[]): Set<string> {\n return new Set(\n declarations.flatMap((declaration) => {\n if (declaration.kind === \"enum\") {\n return [declaration.name];\n }\n return declaration.kind === \"rawDeclaration\" && declaration.name !== undefined\n ? [declaration.name]\n : [];\n }),\n );\n}\n\nfunction declaredNames(declarations: readonly IrDeclaration[]): Set<string> {\n return new Set(\n declarations.flatMap((declaration) =>\n \"name\" in declaration && declaration.name !== undefined ? [declaration.name] : [],\n ),\n );\n}\n\nfunction freeName(name: string, taken: ReadonlySet<string>): string {\n let candidate = `${name}_2`;\n for (let counter = 3; taken.has(candidate); counter++) {\n candidate = `${name}_${counter}`;\n }\n return candidate;\n}\n\n/**\n * Rename each root alias whose name an enum or a helper type of the footer also declares, or that\n * shadows a TypeScript global type the output refers to (`Record` in `Record<string, never>`), to\n * the next free `Name_2`, `Name_3`, … (the suffix `--root-types` uses for its own conflicts). The\n * footer and the globals keep their names, because the generated types refer to them. Before, the\n * output did not compile (enums: upstream #2099, #2341, #2206; helpers: a schema named\n * `WithRequired`, roadmap R11; globals: TS2315). Other declarations are returned unchanged.\n *\n * With the `root-type-numbering` fix (ADR-021, roadmap R13, backlog 30) the body also holds the\n * aliases a later schema of one exported name took the name from, after the other aliases and\n * under that same name. Each gets the next free number in body order, after the alias that kept\n * the name got its own: so the fix only adds exports, and every other alias keeps the name it has\n * without the fix.\n */\nexport function renameTakenAliases<T extends IrDeclaration>(\n body: readonly T[],\n footer: readonly IrDeclaration[],\n closing: readonly IrDeclaration[] = [],\n): T[] {\n const reserved = footerTypeNames(footer);\n for (const name of globalTypeReferences([...body, ...footer, ...closing])) {\n reserved.add(name);\n }\n const taken = declaredNames([...body, ...footer, ...closing]);\n const aliasNames = new Set<string>();\n return body.map((declaration) => {\n if (!isRootTypeAlias(declaration)) {\n return declaration;\n }\n const isRepeated = aliasNames.has(declaration.name);\n aliasNames.add(declaration.name);\n if (!isRepeated && !reserved.has(declaration.name)) {\n return declaration;\n }\n const name = freeName(declaration.name, taken);\n taken.add(name);\n return { ...declaration, name };\n });\n}\n"],"names":[],"mappings":";;;;AAQA,MAAM,gBAAA,GAAmB,cAAA;AAGlB,SAAS,aAAA,CACd,IAAA,EACA,IAAA,EACA,IAAA,EACwB;AACxB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,WAAA;AAAA,IACN,IAAA;AAAA,IACA,UAAA,EAAY,IAAA;AAAA;AAAA;AAAA,IAGZ,IAAA,EAAM,KAAA,CAAM,CAAA,EAAG,gBAAgB,CAAA,EAAG,IAAI,CAAA,IAAA,EAAO,sBAAA,CA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,SAAS,kBAAA,CACd,IAAA,EACA,MAAA,EACA,OAAA,GAAoC,EAAC,EAChC;AACL,EAAA,MAAM,QAAA,GAAW,gBAAgB,MAAM,CAAA;AACvC,EAAA,KAAA,MAAW,IAAA,IAAQ,oBAAA,CAAqB,CAAC,GAAG,IAAA,EAAM,GAAG,MAAA,EAAQ,GAAG,OAAO,CAAC,CAAA,EAAG;AACzE,IAAA,QAAA,CAAS,IAAI,IAAI,CAAA;AAAA,EACnB;AACA,EAAA,MAAM,KAAA,GAAQ,cAAc,CAAC,GAAG,MAAM,GAAG,MAAA,EAAQ,GAAG,OAAO,CAAC,CAAA;AAC5D,EAAA,MAAM,UAAA,uBAAiB,GAAA,EAAY;AACnC,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,CAAC,WAAA,KAAgB;AAC/B,IAAA,IAAI,CAAC,eAAA,CAAgB,WAAW,CAAA,EAAG;AACjC,MAAA,OAAO,WAAA;AAAA,IACT;AACA,IAAA,MAAM,UAAA,GAAa,UAAA,CAAW,GAAA,CAAI,WAAA,CAAY,IAAI,CAAA;AAClD,IAAA,UAAA,CAAW,GAAA,CAAI,YAAY,IAAI,CAAA;AAC/B,IAAA,IAAI,CAAC,UAAA,IAAc,CAAC,SAAS,GAAA,CAAI,WAAA,CAAY,IAAI,CAAA,EAAG;AAClD,MAAA,OAAO,WAAA;AAAA,IACT;AACA,IAAA,MAAM,IAAA,GAAO,QAAA,CAAS,WAAA,CAAY,IAAA,EAAM,KAAK,CAAA;AAC7C,IAAA,KAAA,CAAM,IAAI,IAAI,CAAA;AACd,IAAA,OAAO,EAAE,GAAG,WAAA,EAAa,IAAA,EAAK;AAAA,EAChC,CAAC,CAAA;AACH;;"}
1
+ {"version":3,"file":"root-type-aliases.mjs","sources":["../../../../src/application/transform/document/root-type-aliases.ts"],"sourcesContent":["import { irRaw } from \"../../../domain/ir/constructors.js\";\nimport type { IrDeclaration, IrTypeAliasDeclaration } from \"../../../domain/ir/nodes.js\";\nimport { escapeSingleQuotedText } from \"../../../domain/ir/raw-text-escapes.js\";\nimport type { ComponentKind } from \"../../../domain/openapi/components-object.js\";\nimport { freeNumberedName } from \"../numbered-names.js\";\nimport { typeNamesDeclaredBy } from \"./declared-type-names.js\";\nimport { globalTypeReferences } from \"./global-type-references.js\";\n\n/** The `--root-types` aliases: `export type Pet = components['schemas']['Pet'];`. */\n\nconst REFERENCE_PREFIX = \"components['\";\n\n/** The alias of one component. */\nexport function rootTypeAlias(\n name: string,\n kind: ComponentKind,\n item: string,\n): IrTypeAliasDeclaration {\n return {\n kind: \"typeAlias\",\n name,\n isExported: true,\n // The original writes the reference as text, with single quotes, and did not escape the\n // name: a quote in it could add code to the generated file (intentional fix).\n type: irRaw(`${REFERENCE_PREFIX}${kind}']['${escapeSingleQuotedText(item)}']`),\n comments: [],\n };\n}\n\n/** Whether the declaration is a `--root-types` alias, which gives way to every other name. */\nexport function isRootTypeAlias(declaration: IrDeclaration): declaration is IrTypeAliasDeclaration {\n return (\n declaration.kind === \"typeAlias\" &&\n declaration.type.kind === \"raw\" &&\n declaration.type.text.startsWith(REFERENCE_PREFIX)\n );\n}\n\nfunction declaredNames(declarations: readonly IrDeclaration[]): Set<string> {\n return new Set(\n declarations.flatMap((declaration) =>\n \"name\" in declaration && declaration.name !== undefined ? [declaration.name] : [],\n ),\n );\n}\n\n/**\n * Rename each root alias whose name another declaration of the output also takes (an enum, a\n * helper type, the `--make-paths-enum` enum `ApiPaths`, a root interface, `--read-write-markers`\n * or `inject` types), or that shadows a TypeScript global type the output refers to (`Record` in\n * `Record<string, never>`), to the next free `Name_2`, `Name_3`, … (the suffix `--root-types` uses\n * for its own conflicts). The others and the globals keep their names, because the generated\n * types refer to them. Before, the output did not compile (enums: upstream #2099, #2341, #2206;\n * helpers: a schema named `WithRequired`, roadmap R11; globals: TS2315; `ApiPaths`: TS2567).\n * Other declarations are returned unchanged.\n *\n * With the `root-type-numbering` fix (ADR-021, roadmap R13, backlog 30) the body also holds the\n * aliases a later schema of one exported name took the name from, after the other aliases and\n * under that same name. Each gets the next free number in body order, after the alias that kept\n * the name got its own: so the fix only adds exports, and every other alias keeps the name it has\n * without the fix.\n */\nexport function renameTakenAliases<T extends IrDeclaration>(\n body: readonly T[],\n footer: readonly IrDeclaration[],\n closing: readonly IrDeclaration[] = [],\n): T[] {\n const all = [...body, ...footer, ...closing];\n const others = all.filter((declaration) => !isRootTypeAlias(declaration));\n const reserved = new Set([...typeNamesDeclaredBy(others), ...globalTypeReferences(all)]);\n const taken = new Set([...declaredNames(all), ...typeNamesDeclaredBy(all)]);\n const aliasNames = new Set<string>();\n return body.map((declaration) => {\n if (!isRootTypeAlias(declaration)) {\n return declaration;\n }\n const isRepeated = aliasNames.has(declaration.name);\n aliasNames.add(declaration.name);\n if (!isRepeated && !reserved.has(declaration.name)) {\n return declaration;\n }\n const name = freeNumberedName(declaration.name, taken);\n taken.add(name);\n return { ...declaration, name };\n });\n}\n"],"names":[],"mappings":";;;;;;AAUA,MAAM,gBAAA,GAAmB,cAAA;AAGlB,SAAS,aAAA,CACd,IAAA,EACA,IAAA,EACA,IAAA,EACwB;AACxB,EAAA,OAAO;AAAA,IACL,IAAA,EAAM,WAAA;AAAA,IACN,IAAA;AAAA,IACA,UAAA,EAAY,IAAA;AAAA;AAAA;AAAA,IAGZ,IAAA,EAAM,KAAA,CAAM,CAAA,EAAG,gBAAgB,CAAA,EAAG,IAAI,CAAA,IAAA,EAAO,sBAAA,CAAuB,IAAI,CAAC,CAAA,EAAA,CAAI,CAAA;AAAA,IAC7E,UAAU;AAAC,GACb;AACF;AAGO,SAAS,gBAAgB,WAAA,EAAmE;AACjG,EAAA,OACE,WAAA,CAAY,IAAA,KAAS,WAAA,IACrB,WAAA,CAAY,IAAA,CAAK,IAAA,KAAS,KAAA,IAC1B,WAAA,CAAY,IAAA,CAAK,IAAA,CAAK,UAAA,CAAW,gBAAgB,CAAA;AAErD;AAEA,SAAS,cAAc,YAAA,EAAqD;AAC1E,EAAA,OAAO,IAA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AAM,KAAK,CAAA;AACrD,IAAA,KAAA,CAAM,IAAI,IAAI,CAAA;AACd,IAAA,OAAO,EAAE,GAAG,WAAA,EAAa,IAAA,EAAK;AAAA,EAChC,CAAC,CAAA;AACH;;"}
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ const appendAll = require('../../../domain/append-all.cjs');
4
+
3
5
  const UNDEFINED = { kind: "keyword", keyword: "undefined" };
4
6
  function nameOf(member) {
5
7
  return member.name.kind === "string" ? member.name.value : member.name.text;
@@ -117,7 +119,7 @@ class TypeResolution {
117
119
  if (objects === null) {
118
120
  return null;
119
121
  }
120
- parts.push(...objects);
122
+ appendAll.appendAll(parts, objects);
121
123
  }
122
124
  return parts;
123
125
  }