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
@@ -1 +1 @@
1
- {"version":3,"file":"document.mjs","sources":["../../../../src/application/transform/document/document.ts"],"sourcesContent":["import { irKeyword, irObject, irRecord } from \"../../../domain/ir/constructors.js\";\nimport type {\n IrDeclaration,\n IrIntersectionType,\n IrObjectType,\n IrType,\n IrTypeAliasDeclaration,\n} from \"../../../domain/ir/nodes.js\";\nimport type { ComponentsObject } from \"../../../domain/openapi/components-object.js\";\nimport type { DocumentObject } from \"../../../domain/openapi/document-object.js\";\nimport type { PathsObject } from \"../../../domain/openapi/path-item-object.js\";\nimport { READ_WRITE_MARKER_TYPES } from \"../helper-types.js\";\nimport type { TransformContext, TransformOptions } from \"../transform-context.js\";\nimport { componentsType } from \"./components.js\";\nimport { type DeclaredTypeLookup, declaredTypeLookup } from \"./declared-types.js\";\nimport { defsRootType } from \"./defs-root.js\";\nimport { keptDeprecatedComponents } from \"./kept-deprecated.js\";\nimport { pathMembers, pathsObjectType } from \"./paths.js\";\nimport { apiPathsEnumDeclaration } from \"./paths-enum.js\";\nimport { webhooksType } from \"./webhooks.js\";\n\n/** The root types, in output order. */\nconst ROOT_KEYS = Object.freeze([\"paths\", \"webhooks\", \"components\", \"$defs\"] as const);\ntype RootKey = (typeof ROOT_KEYS)[number];\n\nconst OPERATIONS_NAME = \"operations\";\n/** The type of a root without members: `Record<string, never>`. */\nconst EMPTY_ROOT_TYPE = irRecord(irKeyword(\"string\"), irKeyword(\"never\"));\n\n/** A root's type and the declarations that follow it (the `--root-types` aliases). */\ninterface RootResult {\n readonly type: IrType;\n readonly aliases: readonly IrTypeAliasDeclaration[];\n /**\n * The root's final type, for a root that reads the types the whole file declares (`paths`, whose\n * overlap check follows references). `type` then only tells whether the root has members.\n */\n readonly withDeclaredTypes?: (lookup: DeclaredTypeLookup) => IrType;\n}\n\ntype RootTransform = (\n node: object,\n context: TransformContext,\n document: DocumentObject,\n) => RootResult;\n\n/** Without `--exclude-deprecated` nothing is left out, so the scan is skipped. */\nfunction keptDeprecated(document: DocumentObject, context: TransformContext): ReadonlySet<object> {\n return context.options.excludeDeprecated\n ? keptDeprecatedComponents(document, context.refs)\n : new Set();\n}\n\nconst ROOT_TRANSFORMS: Readonly<Record<RootKey, RootTransform>> = {\n paths: (node, context) => {\n const members = pathMembers(node as PathsObject, context);\n return {\n type: irObject(members.map(({ member }) => member)),\n aliases: [],\n withDeclaredTypes: (lookup) => pathsObjectType(members, lookup),\n };\n },\n webhooks: (node, context) => ({ type: webhooksType(node as PathsObject, context), aliases: [] }),\n components: (node, context, document) => {\n const kept = keptDeprecated(document, context);\n const { type, rootTypes } = componentsType(node as ComponentsObject, context, kept);\n return { type, aliases: rootTypes };\n },\n $defs: (node, context) => ({\n type: defsRootType(node as NonNullable<DocumentObject[\"$defs\"]>, context),\n aliases: [],\n }),\n};\n\nfunction emptyAlias(name: string): IrTypeAliasDeclaration {\n return { kind: \"typeAlias\", name, isExported: true, type: EMPTY_ROOT_TYPE, comments: [] };\n}\n\n/** A root type that declares something: an object with members, or an intersection of them. */\ntype RootBodyType = IrObjectType | IrIntersectionType;\n\nfunction isRootBody(type: IrType): type is RootBodyType {\n return (type.kind === \"object\" && type.members.length > 0) || type.kind === \"intersection\";\n}\n\n/**\n * A root with members: an interface, or a type alias with `--export-type`. An intersection (the\n * `paths` of overlapping `--path-params-as-types` keys) can only be a type alias.\n */\nfunction rootDeclaration(\n name: RootKey,\n type: RootBodyType,\n options: TransformOptions,\n): IrDeclaration {\n return options.exportType || type.kind === \"intersection\"\n ? { kind: \"typeAlias\", name, isExported: true, type, comments: [] }\n : { kind: \"interface\", name, isExported: true, members: type.members, comments: [] };\n}\n\n/**\n * The declarations of one root: its type, then its aliases. `finish` gives the root's declaration\n * again from the types the whole file declares, for a root with `withDeclaredTypes`.\n */\ninterface RootDeclarations {\n readonly declarations: readonly IrDeclaration[];\n readonly finish?: (lookup: DeclaredTypeLookup) => IrDeclaration;\n}\n\n/**\n * The declarations of one root. A root that is missing, or whose type has no members, is\n * `Record<string, never>`. Only an object type (or the `paths` intersection) counts as having\n * members: a callback type the IR keeps as raw text does not (ADR-004).\n */\nfunction rootDeclarations(\n root: RootKey,\n document: DocumentObject,\n context: TransformContext,\n): RootDeclarations {\n const node: unknown = document[root];\n if (!node || typeof node !== \"object\") {\n context.diagnostics.debug(`${root} done (skipped)`, 0);\n return { declarations: [emptyAlias(root)] };\n }\n const startedAt = context.diagnostics.now();\n const { type, aliases, withDeclaredTypes } = ROOT_TRANSFORMS[root](node, context, document);\n if (!isRootBody(type)) {\n context.diagnostics.debug(`${root} done (skipped)`, 0);\n return { declarations: [emptyAlias(root), ...aliases] };\n }\n const declaration = rootDeclaration(root, type, context.options);\n context.diagnostics.debug(`${root} done`, context.diagnostics.now() - startedAt);\n const finish =\n withDeclaredTypes &&\n ((lookup: DeclaredTypeLookup) => {\n const finished = withDeclaredTypes(lookup);\n return isRootBody(finished) ? rootDeclaration(root, finished, context.options) : declaration;\n });\n return { declarations: [declaration, ...aliases], ...(finish ? { finish } : {}) };\n}\n\n/**\n * Every root's declarations in output order. A root with `finish` gets its declaration from the\n * types of the other roots and of the footer (the `operations` interface), which exist only once\n * every root is transformed.\n */\nfunction rootsDeclarations(\n document: DocumentObject,\n context: TransformContext,\n footer: () => readonly IrDeclaration[],\n): IrDeclaration[] {\n const roots = ROOT_KEYS.map((root) => rootDeclarations(root, document, context));\n const transformed = roots.flatMap(({ declarations }) => declarations);\n if (roots.every(({ finish }) => finish === undefined)) {\n return transformed;\n }\n const lookup = declaredTypeLookup([...transformed, ...footer()]);\n return roots.flatMap(({ declarations, finish }) => {\n const [declaration, ...aliases] = declarations;\n return finish === undefined || declaration === undefined\n ? declarations\n : [finish(lookup), ...aliases];\n });\n}\n\n/**\n * The `inject` text as written (ADR-010, decision 4), without the blank lines around it. The\n * original reprinted it with the TypeScript printer; text without code printed nothing then.\n */\nfunction withoutBlankLinesAround(text: string): string {\n return text.replace(/^(?:[ \\t]*\\r?\\n)+/, \"\").trimEnd();\n}\n\n/** No footer declarations: the roots' references to `operations` stay unresolved. */\nconst NO_FOOTER = (): readonly IrDeclaration[] => [];\n\n/**\n * The document's declarations before the footer: helper types, injected code, then one root type\n * per root key with the aliases that follow it. `footer` reads the footer's declarations once the\n * roots are transformed.\n */\nexport function documentBody(\n document: DocumentObject,\n context: TransformContext,\n footer: () => readonly IrDeclaration[] = NO_FOOTER,\n): IrDeclaration[] {\n const declarations: IrDeclaration[] = [];\n if (context.options.readWriteMarkers) {\n declarations.push({ kind: \"rawDeclaration\", text: READ_WRITE_MARKER_TYPES });\n }\n const inject = withoutBlankLinesAround(context.options.inject ?? \"\");\n if (inject !== \"\") {\n declarations.push({ kind: \"rawDeclaration\", text: inject });\n }\n declarations.push(...rootsDeclarations(document, context, footer));\n return declarations;\n}\n\n/**\n * The declarations after the footer: an empty `operations` type when the footer has no\n * operations, and the `--make-paths-enum` enum.\n */\nexport function documentClosing(\n document: DocumentObject,\n context: TransformContext,\n hasOperations: boolean,\n): IrDeclaration[] {\n const declarations: IrDeclaration[] = [];\n if (!hasOperations) {\n declarations.push(emptyAlias(OPERATIONS_NAME));\n }\n if (context.options.makePathsEnum && document.paths) {\n declarations.push(apiPathsEnumDeclaration(document.paths));\n }\n return declarations;\n}\n"],"names":[],"mappings":";;;;;;;;;;AAsBA,MAAM,SAAA,GAAY,OAAO,MAAA,CAAO,CAAC,SAAS,UAAA,EAAY,YAAA,EAAc,OAAO,CAAU,CAAA;AAGrF,MAAM,eAAA,GAAkB,YAAA;AAExB,MAAM,kBAAkB,QAAA,CAAS,SAAA,CAAU,QAAQ,CAAA,EAAG,SAAA,CAAU,OAAO,CAAC,CAAA;AAoBxE,SAAS,cAAA,CAAe,UAA0B,OAAA,EAAgD;AAChG,EAAA,OAAO,OAAA,CAAQ,QAAQ,iBAAA,GACnB,wBAAA,CAAyB,UAAU,OAAA,CAAQ,IAAI,CAAA,mBAC/C,IAAI,GAAA,EAAI;AACd;AAEA,MAAM,eAAA,GAA4D;AAAA,EAChE,KAAA,EAAO,CAAC,IAAA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C,CAAA;AAAA,EAC3D;AACA,EAAA,OAAO,YAAA;AACT;;"}
1
+ {"version":3,"file":"document.mjs","sources":["../../../../src/application/transform/document/document.ts"],"sourcesContent":["import { appendAll } from \"../../../domain/append-all.js\";\nimport { irKeyword, irObject, irRecord } from \"../../../domain/ir/constructors.js\";\nimport type {\n IrDeclaration,\n IrIntersectionType,\n IrObjectType,\n IrType,\n IrTypeAliasDeclaration,\n} from \"../../../domain/ir/nodes.js\";\nimport type { ComponentsObject } from \"../../../domain/openapi/components-object.js\";\nimport type { DocumentObject } from \"../../../domain/openapi/document-object.js\";\nimport type { PathsObject } from \"../../../domain/openapi/path-item-object.js\";\nimport { READ_WRITE_MARKER_TYPES } from \"../helper-types.js\";\nimport type { TransformContext, TransformOptions } from \"../transform-context.js\";\nimport { componentsType } from \"./components.js\";\nimport { type DeclaredTypeLookup, declaredTypeLookup } from \"./declared-types.js\";\nimport { defsRootType } from \"./defs-root.js\";\nimport { keptDeprecatedComponents } from \"./kept-deprecated.js\";\nimport { pathMembers, pathsObjectType } from \"./paths.js\";\nimport { apiPathsEnumDeclaration } from \"./paths-enum.js\";\nimport { webhooksType } from \"./webhooks.js\";\n\n/** The root types, in output order. */\nexport const ROOT_KEYS = Object.freeze([\"paths\", \"webhooks\", \"components\", \"$defs\"] as const);\ntype RootKey = (typeof ROOT_KEYS)[number];\n\nexport const OPERATIONS_NAME = \"operations\";\n/** The type of a root without members: `Record<string, never>`. */\nconst EMPTY_ROOT_TYPE = irRecord(irKeyword(\"string\"), irKeyword(\"never\"));\n\n/** A root's type and the declarations that follow it (the `--root-types` aliases). */\ninterface RootResult {\n readonly type: IrType;\n readonly aliases: readonly IrTypeAliasDeclaration[];\n /**\n * The root's final type, for a root that reads the types the whole file declares (`paths`, whose\n * overlap check follows references). `type` then only tells whether the root has members.\n */\n readonly withDeclaredTypes?: (lookup: DeclaredTypeLookup) => IrType;\n}\n\ntype RootTransform = (\n node: object,\n context: TransformContext,\n document: DocumentObject,\n) => RootResult;\n\n/** Without `--exclude-deprecated` nothing is left out, so the scan is skipped. */\nfunction keptDeprecated(document: DocumentObject, context: TransformContext): ReadonlySet<object> {\n return context.options.excludeDeprecated\n ? keptDeprecatedComponents(document, context.refs)\n : new Set();\n}\n\nconst ROOT_TRANSFORMS: Readonly<Record<RootKey, RootTransform>> = {\n paths: (node, context) => {\n const members = pathMembers(node as PathsObject, context);\n return {\n type: irObject(members.map(({ member }) => member)),\n aliases: [],\n withDeclaredTypes: (lookup) => pathsObjectType(members, lookup),\n };\n },\n webhooks: (node, context) => ({ type: webhooksType(node as PathsObject, context), aliases: [] }),\n components: (node, context, document) => {\n const kept = keptDeprecated(document, context);\n const { type, rootTypes } = componentsType(node as ComponentsObject, context, kept);\n return { type, aliases: rootTypes };\n },\n $defs: (node, context) => ({\n type: defsRootType(node as NonNullable<DocumentObject[\"$defs\"]>, context),\n aliases: [],\n }),\n};\n\nfunction emptyAlias(name: string): IrTypeAliasDeclaration {\n return { kind: \"typeAlias\", name, isExported: true, type: EMPTY_ROOT_TYPE, comments: [] };\n}\n\n/** A root type that declares something: an object with members, or an intersection of them. */\ntype RootBodyType = IrObjectType | IrIntersectionType;\n\nfunction isRootBody(type: IrType): type is RootBodyType {\n return (type.kind === \"object\" && type.members.length > 0) || type.kind === \"intersection\";\n}\n\n/**\n * A root with members: an interface, or a type alias with `--export-type`. An intersection (the\n * `paths` of overlapping `--path-params-as-types` keys) can only be a type alias.\n */\nfunction rootDeclaration(\n name: RootKey,\n type: RootBodyType,\n options: TransformOptions,\n): IrDeclaration {\n return options.exportType || type.kind === \"intersection\"\n ? { kind: \"typeAlias\", name, isExported: true, type, comments: [] }\n : { kind: \"interface\", name, isExported: true, members: type.members, comments: [] };\n}\n\n/**\n * The declarations of one root: its type, then its aliases. `finish` gives the root's declaration\n * again from the types the whole file declares, for a root with `withDeclaredTypes`.\n */\ninterface RootDeclarations {\n readonly declarations: readonly IrDeclaration[];\n readonly finish?: (lookup: DeclaredTypeLookup) => IrDeclaration;\n}\n\n/**\n * The declarations of one root. A root that is missing, or whose type has no members, is\n * `Record<string, never>`. Only an object type (or the `paths` intersection) counts as having\n * members: a callback type the IR keeps as raw text does not (ADR-004).\n */\nfunction rootDeclarations(\n root: RootKey,\n document: DocumentObject,\n context: TransformContext,\n): RootDeclarations {\n const node: unknown = document[root];\n if (!node || typeof node !== \"object\") {\n context.diagnostics.debug(`${root} done (skipped)`, 0);\n return { declarations: [emptyAlias(root)] };\n }\n const startedAt = context.diagnostics.now();\n const { type, aliases, withDeclaredTypes } = ROOT_TRANSFORMS[root](node, context, document);\n if (!isRootBody(type)) {\n context.diagnostics.debug(`${root} done (skipped)`, 0);\n return { declarations: [emptyAlias(root), ...aliases] };\n }\n const declaration = rootDeclaration(root, type, context.options);\n context.diagnostics.debug(`${root} done`, context.diagnostics.now() - startedAt);\n const finish =\n withDeclaredTypes &&\n ((lookup: DeclaredTypeLookup) => {\n const finished = withDeclaredTypes(lookup);\n return isRootBody(finished) ? rootDeclaration(root, finished, context.options) : declaration;\n });\n return { declarations: [declaration, ...aliases], ...(finish ? { finish } : {}) };\n}\n\n/**\n * Every root's declarations in output order. A root with `finish` gets its declaration from the\n * types of the other roots and of the footer (the `operations` interface), which exist only once\n * every root is transformed.\n */\nfunction rootsDeclarations(\n document: DocumentObject,\n context: TransformContext,\n footer: () => readonly IrDeclaration[],\n): IrDeclaration[] {\n const roots = ROOT_KEYS.map((root) => rootDeclarations(root, document, context));\n const transformed = roots.flatMap(({ declarations }) => declarations);\n if (roots.every(({ finish }) => finish === undefined)) {\n return transformed;\n }\n const lookup = declaredTypeLookup([...transformed, ...footer()]);\n return roots.flatMap(({ declarations, finish }) => {\n const [declaration, ...aliases] = declarations;\n return finish === undefined || declaration === undefined\n ? declarations\n : [finish(lookup), ...aliases];\n });\n}\n\n/**\n * The `inject` text as written (ADR-010, decision 4), without the blank lines around it. The\n * original reprinted it with the TypeScript printer; text without code printed nothing then.\n */\nfunction withoutBlankLinesAround(text: string): string {\n return text.replace(/^(?:[ \\t]*\\r?\\n)+/, \"\").trimEnd();\n}\n\n/** No footer declarations: the roots' references to `operations` stay unresolved. */\nconst NO_FOOTER = (): readonly IrDeclaration[] => [];\n\n/**\n * The document's declarations before the footer: helper types, injected code, then one root type\n * per root key with the aliases that follow it. `footer` reads the footer's declarations once the\n * roots are transformed.\n */\nexport function documentBody(\n document: DocumentObject,\n context: TransformContext,\n footer: () => readonly IrDeclaration[] = NO_FOOTER,\n): IrDeclaration[] {\n const declarations: IrDeclaration[] = [];\n if (context.options.readWriteMarkers) {\n declarations.push({ kind: \"rawDeclaration\", text: READ_WRITE_MARKER_TYPES });\n }\n const inject = withoutBlankLinesAround(context.options.inject ?? \"\");\n if (inject !== \"\") {\n declarations.push({ kind: \"rawDeclaration\", text: inject });\n }\n appendAll(declarations, rootsDeclarations(document, context, footer));\n return declarations;\n}\n\n/**\n * The declarations after the footer: an empty `operations` type when the footer has no\n * operations, and the `--make-paths-enum` enum.\n */\nexport function documentClosing(\n document: DocumentObject,\n context: TransformContext,\n hasOperations: boolean,\n): IrDeclaration[] {\n const declarations: IrDeclaration[] = [];\n if (!hasOperations) {\n declarations.push(emptyAlias(OPERATIONS_NAME));\n }\n if (context.options.makePathsEnum && document.paths) {\n declarations.push(apiPathsEnumDeclaration(document.paths));\n }\n return declarations;\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAuBO,MAAM,SAAA,GAAY,OAAO,MAAA,CAAO,CAAC,SAAS,UAAA,EAAY,YAAA,EAAc,OAAO,CAAU;AAGrF,MAAM,eAAA,GAAkB;AAE/B,MAAM,kBAAkB,QAAA,CAAS,SAAA,CAAU,QAAQ,CAAA,EAAG,SAAA,CAAU,OAAO,CAAC,CAAA;AAoBxE,SAAS,cAAA,CAAe,UAA0B,OAAA,EAAgD;AAChG,EAAA,OAAO,OAAA,CAAQ,QAAQ,iBAAA,GACnB,wBAAA,CAAyB,UAAU,OAAA,CAAQ,IAAI,CAAA,mBAC/C,IAAI,GAAA,E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nD,IAAA,YAAA,CAAa,IAAA,CAAK,uBAAA,CAAwB,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA,EAC3D;AACA,EAAA,OAAO,YAAA;AACT;;"}
@@ -0,0 +1,62 @@
1
+ 'use strict';
2
+
3
+ const helperTypes = require('../helper-types.cjs');
4
+ const declaredTypeNames = require('./declared-type-names.cjs');
5
+ const document = require('./document.cjs');
6
+ const globalTypeReferences = require('./global-type-references.cjs');
7
+ const pathsEnum = require('./paths-enum.cjs');
8
+ const rootTypeAliases = require('./root-type-aliases.cjs');
9
+
10
+ const NAMES_THE_OUTPUT_MAY_NEED = /* @__PURE__ */ new Set([
11
+ ...globalTypeReferences.GLOBAL_TYPE_NAMES,
12
+ ...Object.values(helperTypes.HELPER_TYPES).map(({ name }) => name),
13
+ ...declaredTypeNames.typeNamesInText(helperTypes.READ_WRITE_MARKER_TYPES),
14
+ pathsEnum.API_PATHS_NAME,
15
+ ...document.ROOT_KEYS,
16
+ document.OPERATIONS_NAME
17
+ ]);
18
+ function namesTheOutputNeeds({ body, footer, closing }) {
19
+ const others = [
20
+ ...body.filter((declaration) => !rootTypeAliases.isRootTypeAlias(declaration)),
21
+ ...footer.filter((declaration) => declaration.kind !== "enum"),
22
+ ...closing
23
+ ];
24
+ return /* @__PURE__ */ new Set([
25
+ ...globalTypeReferences.globalTypeReferences([...body, ...footer, ...closing]),
26
+ ...declaredTypeNames.typeNamesDeclaredBy(others)
27
+ ]);
28
+ }
29
+ const SKIPPED_KEYS = /* @__PURE__ */ new Set(["origin"]);
30
+ const ENUM_REFERENCE_RE = /^(typeof )?([^.]+)(\..*)?$/s;
31
+ function renamedReference(name, renames) {
32
+ const match = ENUM_REFERENCE_RE.exec(name);
33
+ const renamed = match === null ? void 0 : renames.get(match[2] ?? "");
34
+ return renamed === void 0 ? name : `${match?.[1] ?? ""}${renamed}${match?.[3] ?? ""}`;
35
+ }
36
+ function isNode(value) {
37
+ return typeof value === "object" && value !== null;
38
+ }
39
+ function renamedNode(value, renames) {
40
+ if (Array.isArray(value)) {
41
+ return value.map((item) => renamedNode(item, renames));
42
+ }
43
+ if (!isNode(value)) {
44
+ return value;
45
+ }
46
+ const node = Object.fromEntries(
47
+ Object.entries(value).map(([key, child]) => [
48
+ key,
49
+ SKIPPED_KEYS.has(key) ? child : renamedNode(child, renames)
50
+ ])
51
+ );
52
+ const isNamed = (node.kind === "reference" || node.kind === "enum") && typeof node.name === "string";
53
+ return isNamed ? { ...node, name: renamedReference(node.name, renames) } : node;
54
+ }
55
+ function withEnumsRenamed(declarations, renames) {
56
+ return renames.size === 0 ? [...declarations] : renamedNode(declarations, renames);
57
+ }
58
+
59
+ exports.NAMES_THE_OUTPUT_MAY_NEED = NAMES_THE_OUTPUT_MAY_NEED;
60
+ exports.namesTheOutputNeeds = namesTheOutputNeeds;
61
+ exports.withEnumsRenamed = withEnumsRenamed;
62
+ //# sourceMappingURL=enum-names-given-back.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum-names-given-back.cjs","sources":["../../../../src/application/transform/document/enum-names-given-back.ts"],"sourcesContent":["import type { IrDeclaration } from \"../../../domain/ir/nodes.js\";\nimport { HELPER_TYPES, READ_WRITE_MARKER_TYPES } from \"../helper-types.js\";\nimport { typeNamesDeclaredBy, typeNamesInText } from \"./declared-type-names.js\";\nimport { OPERATIONS_NAME, ROOT_KEYS } from \"./document.js\";\nimport { GLOBAL_TYPE_NAMES, globalTypeReferences } from \"./global-type-references.js\";\nimport { API_PATHS_NAME } from \"./paths-enum.js\";\nimport { isRootTypeAlias } from \"./root-type-aliases.js\";\n\n/**\n * The second step of naming `--enum` declarations (`EnumNameClaims`): once the output is known,\n * an enum that gave way to a name the output turned out not to need gets that name back.\n */\n\n/**\n * The type names the output of a document may need, besides its enums: the global types it may\n * refer to and the names the generator declares itself. An enum avoids them until the end.\n */\nexport const NAMES_THE_OUTPUT_MAY_NEED: ReadonlySet<string> = new Set([\n ...GLOBAL_TYPE_NAMES,\n ...Object.values(HELPER_TYPES).map(({ name }) => name),\n ...typeNamesInText(READ_WRITE_MARKER_TYPES),\n API_PATHS_NAME,\n ...ROOT_KEYS,\n OPERATIONS_NAME,\n]);\n\n/** The parts of a transformed document; the footer holds only IR declarations here. */\nexport interface DocumentParts {\n readonly body: readonly IrDeclaration[];\n readonly footer: readonly IrDeclaration[];\n readonly closing: readonly IrDeclaration[];\n}\n\n/**\n * The type names the output needs besides its enums: the globals it refers to, and the names of\n * its other declarations. Root aliases give way to enums (`renameTakenAliases`), so they count\n * for nothing.\n */\nexport function namesTheOutputNeeds({ body, footer, closing }: DocumentParts): Set<string> {\n const others = [\n ...body.filter((declaration) => !isRootTypeAlias(declaration)),\n ...footer.filter((declaration) => declaration.kind !== \"enum\"),\n ...closing,\n ];\n return new Set([\n ...globalTypeReferences([...body, ...footer, ...closing]),\n ...typeNamesDeclaredBy(others),\n ]);\n}\n\n/** `origin` holds the compiler node a raw type was printed from; it is not IR. */\nconst SKIPPED_KEYS: ReadonlySet<string> = new Set([\"origin\"]);\n\n/** The enum references the generator writes: `Name`, `Name.member` and `typeof Name`. */\nconst ENUM_REFERENCE_RE = /^(typeof )?([^.]+)(\\..*)?$/s;\n\nfunction renamedReference(name: string, renames: ReadonlyMap<string, string>): string {\n const match = ENUM_REFERENCE_RE.exec(name);\n const renamed = match === null ? undefined : renames.get(match[2] ?? \"\");\n return renamed === undefined ? name : `${match?.[1] ?? \"\"}${renamed}${match?.[3] ?? \"\"}`;\n}\n\nfunction isNode(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction renamedNode(value: unknown, renames: ReadonlyMap<string, string>): unknown {\n if (Array.isArray(value)) {\n return value.map((item) => renamedNode(item, renames));\n }\n if (!isNode(value)) {\n return value;\n }\n const node = Object.fromEntries(\n Object.entries(value).map(([key, child]) => [\n key,\n SKIPPED_KEYS.has(key) ? child : renamedNode(child, renames),\n ]),\n );\n const isNamed =\n (node.kind === \"reference\" || node.kind === \"enum\") && typeof node.name === \"string\";\n return isNamed ? { ...node, name: renamedReference(node.name as string, renames) } : node;\n}\n\n/** The declarations with each enum in `renames` (old name to new) renamed, references too. */\nexport function withEnumsRenamed<T extends IrDeclaration>(\n declarations: readonly T[],\n renames: ReadonlyMap<string, string>,\n): T[] {\n return renames.size === 0 ? [...declarations] : (renamedNode(declarations, renames) as T[]);\n}\n"],"names":["GLOBAL_TYPE_NAMES","HELPER_TYPES","typeNamesInText","READ_WRITE_MARKER_TYPES","API_PATHS_NAME","ROOT_KEYS","OPERATIONS_NAME","isRootTypeAlias","globalTypeReferences","typeNamesDeclaredBy"],"mappings":";;;;;;;;;AAiBO,MAAM,yBAAA,uBAAqD,GAAA,CAAI;AAAA,EACpE,GAAGA,sCAAA;AAAA,EACH,GAAG,MAAA,CAAO,MAAA,CAAOC,wBAAY,CAAA,CAAE,IAAI,CAAC,EAAE,IAAA,EAAK,KAAM,IAAI,CAAA;AAAA,EACrD,GAAGC,kCAAgBC,mCAAuB,CAAA;AAAA,EAC1CC,wBAAA;AAAA,EACA,GAAGC,kBAAA;AAAA,EACHC;AACF,CAAC;AAcM,SAAS,mBAAA,CAAoB,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAQ,EAA+B;AACzF,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,GAAG,KAAK,MAAA,CAAO,CAAC,gBAAgB,CAACC,+BAAA,CAAgB,WAAW,CAAC,CAAA;AAAA,IAC7D,GAAG,MAAA,CAAO,MAAA,CAAO,CAAC,WAAA,KAAgB,WAAA,CAAY,SAAS,MAAM,CAAA;AAAA,IAC7D,GAAG;AAAA,GACL;AACA,EAAA,2BAAW,GAAA,CAAI;AAAA,IACb,GAAGC,0CAAqB,CAAC,GAAG,MAAM,GAAG,MAAA,EAAQ,GAAG,OAAO,CAAC,CAAA;AAAA,IACxD,GAAGC,sCAAoB,MAAM;AAAA,GAC9B,CAAA;AACH;AAGA,MAAM,YAAA,mBAAoC,IAAI,GAAA,CAAI,CAAC,Q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A,CAAK,IAAA,KAAS,QAAA;AAC9E,EAAA,OAAO,OAAA,GAAU,EAAE,GAAG,IAAA,EAAM,IAAA,EAAM,iBAAiB,IAAA,CAAK,IAAA,EAAgB,OAAO,CAAA,EAAE,GAAI,IAAA;AACvF;AAGO,SAAS,gBAAA,CACd,cACA,OAAA,EACK;AACL,EAAA,OAAO,OAAA,CAAQ,SAAS,CAAA,GAAI,CAAC,GAAG,YAAY,CAAA,GAAK,WAAA,CAAY,YAAA,EAAc,OAAO,CAAA;AACpF;;;;"}
@@ -0,0 +1,58 @@
1
+ import { HELPER_TYPES, READ_WRITE_MARKER_TYPES } from '../helper-types.mjs';
2
+ import { typeNamesInText, typeNamesDeclaredBy } from './declared-type-names.mjs';
3
+ import { ROOT_KEYS, OPERATIONS_NAME } from './document.mjs';
4
+ import { GLOBAL_TYPE_NAMES, globalTypeReferences } from './global-type-references.mjs';
5
+ import { API_PATHS_NAME } from './paths-enum.mjs';
6
+ import { isRootTypeAlias } from './root-type-aliases.mjs';
7
+
8
+ const NAMES_THE_OUTPUT_MAY_NEED = /* @__PURE__ */ new Set([
9
+ ...GLOBAL_TYPE_NAMES,
10
+ ...Object.values(HELPER_TYPES).map(({ name }) => name),
11
+ ...typeNamesInText(READ_WRITE_MARKER_TYPES),
12
+ API_PATHS_NAME,
13
+ ...ROOT_KEYS,
14
+ OPERATIONS_NAME
15
+ ]);
16
+ function namesTheOutputNeeds({ body, footer, closing }) {
17
+ const others = [
18
+ ...body.filter((declaration) => !isRootTypeAlias(declaration)),
19
+ ...footer.filter((declaration) => declaration.kind !== "enum"),
20
+ ...closing
21
+ ];
22
+ return /* @__PURE__ */ new Set([
23
+ ...globalTypeReferences([...body, ...footer, ...closing]),
24
+ ...typeNamesDeclaredBy(others)
25
+ ]);
26
+ }
27
+ const SKIPPED_KEYS = /* @__PURE__ */ new Set(["origin"]);
28
+ const ENUM_REFERENCE_RE = /^(typeof )?([^.]+)(\..*)?$/s;
29
+ function renamedReference(name, renames) {
30
+ const match = ENUM_REFERENCE_RE.exec(name);
31
+ const renamed = match === null ? void 0 : renames.get(match[2] ?? "");
32
+ return renamed === void 0 ? name : `${match?.[1] ?? ""}${renamed}${match?.[3] ?? ""}`;
33
+ }
34
+ function isNode(value) {
35
+ return typeof value === "object" && value !== null;
36
+ }
37
+ function renamedNode(value, renames) {
38
+ if (Array.isArray(value)) {
39
+ return value.map((item) => renamedNode(item, renames));
40
+ }
41
+ if (!isNode(value)) {
42
+ return value;
43
+ }
44
+ const node = Object.fromEntries(
45
+ Object.entries(value).map(([key, child]) => [
46
+ key,
47
+ SKIPPED_KEYS.has(key) ? child : renamedNode(child, renames)
48
+ ])
49
+ );
50
+ const isNamed = (node.kind === "reference" || node.kind === "enum") && typeof node.name === "string";
51
+ return isNamed ? { ...node, name: renamedReference(node.name, renames) } : node;
52
+ }
53
+ function withEnumsRenamed(declarations, renames) {
54
+ return renames.size === 0 ? [...declarations] : renamedNode(declarations, renames);
55
+ }
56
+
57
+ export { NAMES_THE_OUTPUT_MAY_NEED, namesTheOutputNeeds, withEnumsRenamed };
58
+ //# sourceMappingURL=enum-names-given-back.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enum-names-given-back.mjs","sources":["../../../../src/application/transform/document/enum-names-given-back.ts"],"sourcesContent":["import type { IrDeclaration } from \"../../../domain/ir/nodes.js\";\nimport { HELPER_TYPES, READ_WRITE_MARKER_TYPES } from \"../helper-types.js\";\nimport { typeNamesDeclaredBy, typeNamesInText } from \"./declared-type-names.js\";\nimport { OPERATIONS_NAME, ROOT_KEYS } from \"./document.js\";\nimport { GLOBAL_TYPE_NAMES, globalTypeReferences } from \"./global-type-references.js\";\nimport { API_PATHS_NAME } from \"./paths-enum.js\";\nimport { isRootTypeAlias } from \"./root-type-aliases.js\";\n\n/**\n * The second step of naming `--enum` declarations (`EnumNameClaims`): once the output is known,\n * an enum that gave way to a name the output turned out not to need gets that name back.\n */\n\n/**\n * The type names the output of a document may need, besides its enums: the global types it may\n * refer to and the names the generator declares itself. An enum avoids them until the end.\n */\nexport const NAMES_THE_OUTPUT_MAY_NEED: ReadonlySet<string> = new Set([\n ...GLOBAL_TYPE_NAMES,\n ...Object.values(HELPER_TYPES).map(({ name }) => name),\n ...typeNamesInText(READ_WRITE_MARKER_TYPES),\n API_PATHS_NAME,\n ...ROOT_KEYS,\n OPERATIONS_NAME,\n]);\n\n/** The parts of a transformed document; the footer holds only IR declarations here. */\nexport interface DocumentParts {\n readonly body: readonly IrDeclaration[];\n readonly footer: readonly IrDeclaration[];\n readonly closing: readonly IrDeclaration[];\n}\n\n/**\n * The type names the output needs besides its enums: the globals it refers to, and the names of\n * its other declarations. Root aliases give way to enums (`renameTakenAliases`), so they count\n * for nothing.\n */\nexport function namesTheOutputNeeds({ body, footer, closing }: DocumentParts): Set<string> {\n const others = [\n ...body.filter((declaration) => !isRootTypeAlias(declaration)),\n ...footer.filter((declaration) => declaration.kind !== \"enum\"),\n ...closing,\n ];\n return new Set([\n ...globalTypeReferences([...body, ...footer, ...closing]),\n ...typeNamesDeclaredBy(others),\n ]);\n}\n\n/** `origin` holds the compiler node a raw type was printed from; it is not IR. */\nconst SKIPPED_KEYS: ReadonlySet<string> = new Set([\"origin\"]);\n\n/** The enum references the generator writes: `Name`, `Name.member` and `typeof Name`. */\nconst ENUM_REFERENCE_RE = /^(typeof )?([^.]+)(\\..*)?$/s;\n\nfunction renamedReference(name: string, renames: ReadonlyMap<string, string>): string {\n const match = ENUM_REFERENCE_RE.exec(name);\n const renamed = match === null ? undefined : renames.get(match[2] ?? \"\");\n return renamed === undefined ? name : `${match?.[1] ?? \"\"}${renamed}${match?.[3] ?? \"\"}`;\n}\n\nfunction isNode(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction renamedNode(value: unknown, renames: ReadonlyMap<string, string>): unknown {\n if (Array.isArray(value)) {\n return value.map((item) => renamedNode(item, renames));\n }\n if (!isNode(value)) {\n return value;\n }\n const node = Object.fromEntries(\n Object.entries(value).map(([key, child]) => [\n key,\n SKIPPED_KEYS.has(key) ? child : renamedNode(child, renames),\n ]),\n );\n const isNamed =\n (node.kind === \"reference\" || node.kind === \"enum\") && typeof node.name === \"string\";\n return isNamed ? { ...node, name: renamedReference(node.name as string, renames) } : node;\n}\n\n/** The declarations with each enum in `renames` (old name to new) renamed, references too. */\nexport function withEnumsRenamed<T extends IrDeclaration>(\n declarations: readonly T[],\n renames: ReadonlyMap<string, string>,\n): T[] {\n return renames.size === 0 ? [...declarations] : (renamedNode(declarations, renames) as T[]);\n}\n"],"names":[],"mappings":";;;;;;;AAiBO,MAAM,yBAAA,uBAAqD,GAAA,CAAI;AAAA,EACpE,GAAG,iBAAA;AAAA,EACH,GAAG,MAAA,CAAO,MAAA,CAAO,YAAY,CAAA,CAAE,IAAI,CAAC,EAAE,IAAA,EAAK,KAAM,IAAI,CAAA;AAAA,EACrD,GAAG,gBAAgB,uBAAuB,CAAA;AAAA,EAC1C,cAAA;AAAA,EACA,GAAG,SAAA;AAAA,EACH;AACF,CAAC;AAcM,SAAS,mBAAA,CAAoB,EAAE,IAAA,EAAM,MAAA,EAAQ,SAAQ,EAA+B;AACzF,EAAA,MAAM,MAAA,GAAS;AAAA,IACb,GAAG,KAAK,MAAA,CAAO,CAAC,gBAAgB,CAAC,eAAA,CAAgB,WAAW,CAAC,CAAA;AAAA,IAC7D,GAAG,MAAA,CAAO,MAAA,CAAO,CAAC,WAAA,KAAgB,WAAA,CAAY,SAAS,MAAM,CAAA;AAAA,IAC7D,GAAG;AAAA,GACL;AACA,EAAA,2BAAW,GAAA,CAAI;AAAA,IACb,GAAG,qBAAqB,CAAC,GAAG,MAAM,GAAG,MAAA,EAAQ,GAAG,OAAO,CAAC,CAAA;AAAA,IACxD,GAAG,oBAAoB,MAAM;AAAA,GAC9B,CAAA;AACH;AAGA,MAAM,YAAA,mBAAoC,IAAI,GAAA,CAAI,CAAC,QAAQ,CAAC,CAAA;AAG5D,MAAM,iBA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AAA,OAAO,OAAA,GAAU,EAAE,GAAG,IAAA,EAAM,IAAA,EAAM,iBAAiB,IAAA,CAAK,IAAA,EAAgB,OAAO,CAAA,EAAE,GAAI,IAAA;AACvF;AAGO,SAAS,gBAAA,CACd,cACA,OAAA,EACK;AACL,EAAA,OAAO,OAAA,CAAQ,SAAS,CAAA,GAAI,CAAC,GAAG,YAAY,CAAA,GAAK,WAAA,CAAY,YAAA,EAAc,OAAO,CAAA;AACpF;;"}
@@ -59,5 +59,6 @@ function globalTypeReferences(declarations) {
59
59
  return used;
60
60
  }
61
61
 
62
+ exports.GLOBAL_TYPE_NAMES = GLOBAL_TYPE_NAMES;
62
63
  exports.globalTypeReferences = globalTypeReferences;
63
64
  //# sourceMappingURL=global-type-references.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-type-references.cjs","sources":["../../../../src/application/transform/document/global-type-references.ts"],"sourcesContent":["import type { IrDeclaration } from \"../../../domain/ir/nodes.js\";\n\n/**\n * The TypeScript global types that generated code can refer to: in references (`Record<string,\n * never>`, `Omit<…>`, the `Blob` of `--binary-as-blob`) and in the text of footer helpers\n * (`Exclude<…>`, `Readonly<…>`). A module declaration of the same name shadows the global: every\n * use of it then fails to compile, or silently names the module's type (`Blob`).\n */\nconst GLOBAL_TYPE_NAMES: ReadonlySet<string> = new Set([\n \"Array\",\n \"Blob\",\n \"Exclude\",\n \"Extract\",\n \"NonNullable\",\n \"Omit\",\n \"Partial\",\n \"Pick\",\n \"Readonly\",\n \"ReadonlyArray\",\n \"Record\",\n \"Required\",\n]);\n\nconst GENERIC_USE = /\\b([A-Z][A-Za-z]*)\\s*</g;\n\n/** `origin` holds the outside node a raw type was printed from; it is not part of the output. */\nconst SKIPPED_KEYS: ReadonlySet<string> = new Set([\"origin\", \"comments\"]);\n\nfunction isObject(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction addTextUses(text: string, used: Set<string>): void {\n for (const match of text.matchAll(GENERIC_USE)) {\n const name = match[1] ?? \"\";\n if (GLOBAL_TYPE_NAMES.has(name)) {\n used.add(name);\n }\n }\n}\n\nfunction addNodeUses(node: Readonly<Record<string, unknown>>, used: Set<string>): void {\n if (node.kind === \"reference\" && typeof node.name === \"string\") {\n if (GLOBAL_TYPE_NAMES.has(node.name)) {\n used.add(node.name);\n }\n } else if (\n (node.kind === \"raw\" || node.kind === \"rawDeclaration\") &&\n typeof node.text === \"string\"\n ) {\n addTextUses(node.text, used);\n }\n}\n\nfunction visit(value: unknown, used: Set<string>): void {\n if (Array.isArray(value)) {\n for (const item of value) {\n visit(item, used);\n }\n return;\n }\n if (!isObject(value)) {\n return;\n }\n addNodeUses(value, used);\n for (const [key, child] of Object.entries(value)) {\n if (!SKIPPED_KEYS.has(key)) {\n visit(child, used);\n }\n }\n}\n\n/** The TypeScript global type names that the declarations refer to. */\nexport function globalTypeReferences(declarations: readonly IrDeclaration[]): Set<string> {\n const used = new Set<string>();\n visit(declarations, used);\n return used;\n}\n"],"names":[],"mappings":";;AAQA,MAAM,iBAAA,uBAA6C,GAAA,CAAI;AAAA,EACrD,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,eAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAC,CAAA;AAED,MAAM,WAAA,GAAc,yBAAA;AAGpB,MAAM,+BAAoC,IAAI,GAAA,CAAI,CAAC,QAAA,EAAU,UAAU,CAAC,CAAA;AAExE,SAAS,SAAS,KAAA,EAA4D;AAC5E,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA;AAChD;AAEA,SAAS,WAAA,CAAY,MAAc,IAAA,EAAyB;AAC1D,EAAA,KAAA,MAAW,KAAA,IAAS,IAAA,CAAK,QAAA,CAAS,WAAW,CAAA,EAAG;AAC9C,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IACnB;AAAA,EACF;AACF;AAGO,SAAS,qBAAqB,YAAA,EAAqD;AACxF,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,KAAA,CAAM,cAAc,IAAI,CAAA;AACxB,EAAA,OAAO,IAAA;AACT;;"}
1
+ {"version":3,"file":"global-type-references.cjs","sources":["../../../../src/application/transform/document/global-type-references.ts"],"sourcesContent":["import type { IrDeclaration } from \"../../../domain/ir/nodes.js\";\n\n/**\n * The TypeScript global types that generated code can refer to: in references (`Record<string,\n * never>`, `Omit<…>`, the `Blob` of `--binary-as-blob`) and in the text of footer helpers\n * (`Exclude<…>`, `Readonly<…>`). A module declaration of the same name shadows the global: every\n * use of it then fails to compile, or silently names the module's type (`Blob`).\n */\nexport const GLOBAL_TYPE_NAMES: ReadonlySet<string> = new Set([\n \"Array\",\n \"Blob\",\n \"Exclude\",\n \"Extract\",\n \"NonNullable\",\n \"Omit\",\n \"Partial\",\n \"Pick\",\n \"Readonly\",\n \"ReadonlyArray\",\n \"Record\",\n \"Required\",\n]);\n\nconst GENERIC_USE = /\\b([A-Z][A-Za-z]*)\\s*</g;\n\n/** `origin` holds the outside node a raw type was printed from; it is not part of the output. */\nconst SKIPPED_KEYS: ReadonlySet<string> = new Set([\"origin\", \"comments\"]);\n\nfunction isObject(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction addTextUses(text: string, used: Set<string>): void {\n for (const match of text.matchAll(GENERIC_USE)) {\n const name = match[1] ?? \"\";\n if (GLOBAL_TYPE_NAMES.has(name)) {\n used.add(name);\n }\n }\n}\n\nfunction addNodeUses(node: Readonly<Record<string, unknown>>, used: Set<string>): void {\n if (node.kind === \"reference\" && typeof node.name === \"string\") {\n if (GLOBAL_TYPE_NAMES.has(node.name)) {\n used.add(node.name);\n }\n } else if (\n (node.kind === \"raw\" || node.kind === \"rawDeclaration\") &&\n typeof node.text === \"string\"\n ) {\n addTextUses(node.text, used);\n }\n}\n\nfunction visit(value: unknown, used: Set<string>): void {\n if (Array.isArray(value)) {\n for (const item of value) {\n visit(item, used);\n }\n return;\n }\n if (!isObject(value)) {\n return;\n }\n addNodeUses(value, used);\n for (const [key, child] of Object.entries(value)) {\n if (!SKIPPED_KEYS.has(key)) {\n visit(child, used);\n }\n }\n}\n\n/** The TypeScript global type names that the declarations refer to. */\nexport function globalTypeReferences(declarations: readonly IrDeclaration[]): Set<string> {\n const used = new Set<string>();\n visit(declarations, used);\n return used;\n}\n"],"names":[],"mappings":";;AAQO,MAAM,iBAAA,uBAA6C,GAAA,CAAI;AAAA,EAC5D,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,eAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAC;AAED,MAAM,WAAA,GAAc,yBAAA;AAGpB,MAAM,+BAAoC,IAAI,GAAA,CAAI,CAAC,QAAA,EAAU,UAAU,CAAC,CAAA;AAExE,SAAS,SAAS,KAAA,EAA4D;AAC5E,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA;AAChD;AAEA,SAAS,WAAA,CAAY,MAAc,IAAA,EAAyB;AAC1D,EAAA,KAAA,MAAW,KAAA,IAAS,IAAA,CAAK,QAAA,CAAS,WAAW,CAAA,EAAG;AAC9C,IAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAC,CAAA,IAAK,EAAA;AACzB,IAAA,IAAI,iBAAA,CAAkB,GAAA,CAAI,IAAI,CAAA,EAAG;AAC/B,MAAA,IAAA,CAAK,IAAI,IAAI,CAAA;AAAA,IACf;AAAA,EACF;AACF;AAEA,SAAS,WAAA,CAAY,MAAyC,IAAA,EAAyB;AACrF,EAAA,IAAI,KAAK,IAAA,KAAS,WAAA,IAAe,OAAO,IAAA,CAAK,SAAS,QAAA,EAAU;AAC9D,IAAA,IAAI,iBAAA,CAAkB,GAAA,CAAI,IAAA,CAAK,IAAI,CAAA,EAAG;AACpC,MAAA,IAAA,CAAK,GAAA,CAAI,KAAK,IAAI,CAAA;AAAA,IACpB;AAAA,EACF,CAAA,MAAA,IAAA,CACG,IAAA,CAAK,IAAA,KAAS,KAAA,IAAS,IAAA,CAAK,SAAS,gBAAA,KACtC,OAAO,IAAA,CAAK,IAAA,KAAS,QAAA,EACrB;AACA,IAAA,WAAA,CAAY,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA,EAC7B;AACF;AAEA,SAAS,KAAA,CAAM,OAAgB,IAAA,EAAyB;AACtD,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,MAAA,KAAA,CAAM,MAAM,IAAI,CAAA;AAAA,IAClB;AACA,IAAA;AAAA,EACF;AACA,EAAA,IAAI,CAAC,QAAA,CAAS,KAAK,CAAA,EAAG;AACpB,IAAA;AAAA,EACF;AACA,EAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AACvB,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,IAAA,IAAI,CAAC,YAAA,CAAa,GAAA,CAAI,GAAG,CAAA,EAAG;AAC1B,MAAA,KAAA,CAAM,OAAO,IAAI,CAAA;AAAA,IACnB;AAAA,EACF;AACF;AAGO,SAAS,qBAAqB,YAAA,EAAqD;AACxF,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,KAAA,CAAM,cAAc,IAAI,CAAA;AACxB,EAAA,OAAO,IAAA;AACT;;;"}
@@ -57,5 +57,5 @@ function globalTypeReferences(declarations) {
57
57
  return used;
58
58
  }
59
59
 
60
- export { globalTypeReferences };
60
+ export { GLOBAL_TYPE_NAMES, globalTypeReferences };
61
61
  //# sourceMappingURL=global-type-references.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-type-references.mjs","sources":["../../../../src/application/transform/document/global-type-references.ts"],"sourcesContent":["import type { IrDeclaration } from \"../../../domain/ir/nodes.js\";\n\n/**\n * The TypeScript global types that generated code can refer to: in references (`Record<string,\n * never>`, `Omit<…>`, the `Blob` of `--binary-as-blob`) and in the text of footer helpers\n * (`Exclude<…>`, `Readonly<…>`). A module declaration of the same name shadows the global: every\n * use of it then fails to compile, or silently names the module's type (`Blob`).\n */\nconst GLOBAL_TYPE_NAMES: ReadonlySet<string> = new Set([\n \"Array\",\n \"Blob\",\n \"Exclude\",\n \"Extract\",\n \"NonNullable\",\n \"Omit\",\n \"Partial\",\n \"Pick\",\n \"Readonly\",\n \"ReadonlyArray\",\n \"Record\",\n \"Required\",\n]);\n\nconst GENERIC_USE = /\\b([A-Z][A-Za-z]*)\\s*</g;\n\n/** `origin` holds the outside node a raw type was printed from; it is not part of the output. */\nconst SKIPPED_KEYS: ReadonlySet<string> = new Set([\"origin\", \"comments\"]);\n\nfunction isObject(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction addTextUses(text: string, used: Set<string>): void {\n for (const match of text.matchAll(GENERIC_USE)) {\n const name = match[1] ?? \"\";\n if (GLOBAL_TYPE_NAMES.has(name)) {\n used.add(name);\n }\n }\n}\n\nfunction addNodeUses(node: Readonly<Record<string, unknown>>, used: Set<string>): void {\n if (node.kind === \"reference\" && typeof node.name === \"string\") {\n if (GLOBAL_TYPE_NAMES.has(node.name)) {\n used.add(node.name);\n }\n } else if (\n (node.kind === \"raw\" || node.kind === \"rawDeclaration\") &&\n typeof node.text === \"string\"\n ) {\n addTextUses(node.text, used);\n }\n}\n\nfunction visit(value: unknown, used: Set<string>): void {\n if (Array.isArray(value)) {\n for (const item of value) {\n visit(item, used);\n }\n return;\n }\n if (!isObject(value)) {\n return;\n }\n addNodeUses(value, used);\n for (const [key, child] of Object.entries(value)) {\n if (!SKIPPED_KEYS.has(key)) {\n visit(child, used);\n }\n }\n}\n\n/** The TypeScript global type names that the declarations refer to. */\nexport function globalTypeReferences(declarations: readonly IrDeclaration[]): Set<string> {\n const used = new Set<string>();\n visit(declarations, used);\n return used;\n}\n"],"names":[],"mappings":"AAQA,MAAM,iBAAA,uBAA6C,GAAA,CAAI;AAAA,EACrD,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,aAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,eAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAC,CAAA;AAED,MAAM,WAAA,GAAc,yBAAA;AAGpB,MAAM,+BAAoC,IAAI,GAAA,CAAI,CAAC,QAAA,EAAU,UAAU,CAAC,CAAA;AAExE,SAAS,SAAS,KAAA,EAA4D;AAC5E,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,KAAA,KAAU,IAAA;AAChD;AAEA,SAAS,WAAA,CAAY,MAAc,IAAA,EAAyB;AAC1D,EAAA,KAAA,MAAW,KAAA,IAAS,IAAA,CAAK,QAAA,CAAS,WAAW,CAAA,EAAG;AAC9C,IAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAC,CAAA,IAAK,EAAA;AACzB,IAAA,IAAI,iBAAA,CAAkB,GAAA,CAAI,IAAI,CAAA,EAAG;AAC/B,MAAA,IAAA,CAAK,IAAI,IAAI,CAAA;AAAA,IACf;AAAA,EACF;AACF;AAEA,SAAS,WAAA,CAAY,MAAyC,IAAA,EAAyB;AACrF,EAAA,IAAI,KAAK,IAAA,KAAS,WAAA,IAAe,OAAO,IAAA,CAAK,SAAS,QAAA,EAAU;AAC9D,IAAA,IAAI,iBAAA,CAAkB,GAAA,CAAI,IAAA,CAAK,IAAI,CAAA,EAAG;AACpC,MAAA,IAAA,CAAK,GAAA,CAAI,KAAK,IAAI,CAAA;AAAA,IACpB;AAAA,EACF,CAAA,MAAA,IAAA,CACG,IAAA,CAAK,IAAA,KAAS,KAAA,IAAS,IAAA,CAAK,SAAS,gBAAA,KACtC,OAAO,IAAA,CAAK,IAAA,KAAS,QAAA,EACrB;AACA,IAAA,WAAA,CAAY,IAAA,CAAK,MAAM,IAAI,CAAA;AAAA,EAC7B;AACF;AAEA,SAAS,KAAA,CAAM,OAAgB,IAAA,EAAyB;AACtD,EAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,KAAK,CAAA,EAAG;AACxB,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,MAAA,KAAA,CAAM,MAAM,IAAI,CAAA;AAAA,IAClB;AACA,IAAA;AAAA,EACF;AACA,EAAA,IAAI,CAAC,QAAA,CAAS,KAAK,CAAA,EAAG;AACpB,IAAA;AAAA,EACF;AACA,EAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AACvB,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,IAAA,IAAI,CAAC,YAAA,CAAa,GAAA,CAAI,GAAG,CAAA,EAAG;AAC1B,MAAA,KAAA,CAAM,OAAO,IAAI,CAAA;AAAA,IACnB;AAAA,EACF;AACF;AAGO,SAAS,qBAAqB,YAAA,EAAqD;AACxF,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,KAAA,CAAM,cAAc,IAAI,CAAA;AACxB,EAAA,OAAO,IAAA;AACT;;"}
1
+ {"version":3,"file":"global-type-references.mjs","sources":["../../../../src/application/transform/document/global-type-references.ts"],"sourcesContent":["import type { IrDeclaration } from \"../../../domain/ir/nodes.js\";\n\n/**\n * The TypeScript global types that generated code can refer to: in references (`Record<string,\n * never>`, `Omit<…>`, the `Blob` of `--binary-as-blob`) and in the text of footer helpers\n * (`Exclude<…>`, `Readonly<…>`). A module declaration of the same name shadows the global: every\n * use of it then fails to compile, or silently names the module's type (`Blob`).\n */\nexport const GLOBAL_TYPE_NAMES: ReadonlySet<string> = new Set([\n \"Array\",\n \"Blob\",\n \"Exclude\",\n \"Extract\",\n \"NonNullable\",\n \"Omit\",\n \"Partial\",\n \"Pick\",\n \"Readonly\",\n \"ReadonlyArray\",\n \"Record\",\n \"Required\",\n]);\n\nconst GENERIC_USE = /\\b([A-Z][A-Za-z]*)\\s*</g;\n\n/** `origin` holds the outside node a raw type was printed from; it is not part of the output. */\nconst SKIPPED_KEYS: ReadonlySet<string> = new Set([\"origin\", \"comments\"]);\n\nfunction isObject(value: unknown): value is Readonly<Record<string, unknown>> {\n return typeof value === \"object\" && value !== null;\n}\n\nfunction addTextUses(text: string, used: Set<string>): void {\n for (const match of text.matchAll(GENERIC_USE)) {\n const name = match[1] ?? \"\";\n if (GLOBAL_TYPE_NAMES.has(name)) {\n used.add(name);\n }\n }\n}\n\nfunction addNodeUses(node: Readonly<Record<string, unknown>>, used: Set<string>): void {\n if (node.kind === \"reference\" && typeof node.name === \"string\") {\n if (GLOBAL_TYPE_NAMES.has(node.name)) {\n used.add(node.name);\n }\n } else if (\n (node.kind === \"raw\" || node.kind === \"rawDeclaration\") &&\n typeof node.text === \"string\"\n ) {\n addTextUses(node.text, used);\n }\n}\n\nfunction visit(value: unknown, used: Set<string>): void {\n if (Array.isArray(value)) {\n for (const item of value) {\n visit(item, used);\n }\n return;\n }\n if (!isObject(value)) {\n return;\n }\n addNodeUses(value, used);\n for (const [key, child] of Object.entries(value)) {\n if (!SKIPPED_KEYS.has(key)) {\n visit(child, used);\n }\n }\n}\n\n/** The TypeScript global type names that the declarations refer to. */\nexport function globalTypeReferences(declarations: readonly IrDeclaration[]): Set<string> {\n const used = new Set<string>();\n visit(declarations, used);\n return used;\n}\n"],"names":[],"mappings":"AAQO,MAAM,iBAAA,uBAA6C,GAAA,CAAI;AAAA,EAC5D,OAAA;AAAA,EACA,MAAA;AAAA,EACA,SAAA;AAAA,EACA,SAAA;AAAA,EACA,aAAA;AAAA,EAC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EAAG;AACxB,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,MAAA,KAAA,CAAM,MAAM,IAAI,CAAA;AAAA,IAClB;AACA,IAAA;AAAA,EACF;AACA,EAAA,IAAI,CAAC,QAAA,CAAS,KAAK,CAAA,EAAG;AACpB,IAAA;AAAA,EACF;AACA,EAAA,WAAA,CAAY,OAAO,IAAI,CAAA;AACvB,EAAA,KAAA,MAAW,CAAC,GAAA,EAAK,KAAK,KAAK,MAAA,CAAO,OAAA,CAAQ,KAAK,CAAA,EAAG;AAChD,IAAA,IAAI,CAAC,YAAA,CAAa,GAAA,CAAI,GAAG,CAAA,EAAG;AAC1B,MAAA,KAAA,CAAM,OAAO,IAAI,CAAA;AAAA,IACnB;AAAA,EACF;AACF;AAGO,SAAS,qBAAqB,YAAA,EAAqD;AACxF,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,KAAA,CAAM,cAAc,IAAI,CAAA;AACxB,EAAA,OAAO,IAAA;AACT;;"}
@@ -21,11 +21,11 @@ function itemSchemaAt(entry, path, context) {
21
21
  const resolved = mediaTypeObject.isMediaTypeComponentRef(entry.$ref) ? context.refs.resolve(entry.$ref) : void 0;
22
22
  return { schema: resolved?.itemSchema, path: jsonPointer.createRef([entry.$ref, "itemSchema"]) };
23
23
  }
24
- return { schema: entry.itemSchema, path: jsonPointer.createRef([path, "itemSchema"]) };
24
+ return { schema: entry.itemSchema, path: jsonPointer.appendPointer(path, ["itemSchema"]) };
25
25
  }
26
26
  function itemContentMember(content, location, context, flags) {
27
27
  const members = documentEntries.documentEntries(content, context.options).flatMap(([mediaType, entry]) => {
28
- const contentPath = jsonPointer.createRef([location.path, "content", mediaType]);
28
+ const contentPath = jsonPointer.appendPointer(location.path, ["content", mediaType]);
29
29
  const item = itemSchemaAt(entry, contentPath, context);
30
30
  if (item.schema === void 0) {
31
31
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"media-type.cjs","sources":["../../../../src/application/transform/document/media-type.ts"],"sourcesContent":["import { irObject, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { 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 type ContentMap,\n isMediaTypeComponentRef,\n type MediaTypeObject,\n} from \"../../../domain/openapi/media-type-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { transformSchema } from \"../schema/schema-transform.js\";\nimport { UNKNOWN_TYPE } from \"../shared-types.js\";\nimport { documentMember } from \"./document-member.js\";\n\n/** The sibling of `content` that holds item types (ADR-020). */\nconst ITEM_CONTENT_KEY = \"itemContent\";\n\n/** A media type's schema, or `unknown` when it has none (OpenAPI 3.1 §4.8.14). */\nexport function mediaTypeType(\n mediaType: MediaTypeObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n return mediaType.schema ? transformSchema(mediaType.schema, location, context) : UNKNOWN_TYPE;\n}\n\n/** A `content` entry: a `$ref` is transformed like a schema `$ref`, the rest as a media type. */\nexport function contentEntryType(\n entry: ContentMap[string],\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n // `in` throws for a null entry, as in the original.\n return \"$ref\" in entry\n ? transformSchema(entry, location, context)\n : mediaTypeType(entry, location, context);\n}\n\n/** The `itemSchema` of a `content` entry and where it is, following a `$ref` to a component. */\nfunction itemSchemaAt(\n entry: ContentMap[string],\n path: string,\n context: SchemaContext,\n): { readonly schema: MediaTypeObject[\"itemSchema\"]; readonly path: string } {\n if (\"$ref\" in entry) {\n // Other `$ref`s in `content` keep their pre-3.2 output, so only media type components count.\n const resolved = isMediaTypeComponentRef(entry.$ref)\n ? (context.refs.resolve(entry.$ref) as MediaTypeObject | undefined)\n : undefined;\n return { schema: resolved?.itemSchema, path: createRef([entry.$ref, \"itemSchema\"]) };\n }\n return { schema: entry.itemSchema, path: createRef([path, \"itemSchema\"]) };\n}\n\n/**\n * `itemContent`: the type of one item of each media type with an `itemSchema` (OpenAPI 3.2), next\n * to `content`, which keeps the type of the complete body. Null when no media type has one.\n */\nexport function itemContentMember(\n content: ContentMap,\n location: SchemaLocation,\n context: SchemaContext,\n flags: { readonly isReadonly: boolean },\n): IrPropertySignature | null {\n const members = documentEntries(content, context.options).flatMap(([mediaType, entry]) => {\n const contentPath = createRef([location.path, \"content\", mediaType]);\n const item = itemSchemaAt(entry, contentPath, context);\n if (item.schema === undefined) {\n return [];\n }\n const type = transformSchema(item.schema, { ...location, path: item.path }, context);\n return [documentMember(mediaType, type, entry, { isReadonly: context.options.immutable })];\n });\n return members.length > 0\n ? irProperty(toPropertyName(ITEM_CONTENT_KEY), irObject(members), flags)\n : null;\n}\n"],"names":["transformSchema","UNKNOWN_TYPE","isMediaTypeComponentRef","createRef","documentEntries","documentMember","irProperty","toPropertyName","irObject"],"mappings":";;;;;;;;;;;AAgBA,MAAM,gBAAA,GAAmB,aAAA;AAGlB,SAAS,aAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,OAAO,UAAU,MAAA,GAASA,+BAAA,CAAgB,UAAU,MAAA,EAAQ,QAAA,EAAU,OAAO,CAAA,GAAIC,wBAAA;AACnF;AAGO,SAAS,gBAAA,CACd,KAAA,EACA,QAAA,EACA,OAAA,EACQ;AAER,EAAA,OAAO,MAAA,IAAU,KAAA,GACbD,+BAAA,CAAgB,KAAA,EAAO,QAAA,EAAU,OAAO,CAAA,GACxC,aAAA,CAAc,KAAA,EAAO,QAAA,EAAU,OAAO,CAAA;AAC5C;AAGA,SAAS,YAAA,CACP,KAAA,EACA,IAAA,EACA,OAAA,EAC2E;AAC3E,EAAA,IAAI,UAAU,KAAA,EAAO;AAEnB,IAAA,MAAM,QAAA,GAAWE,uCAAA,CAAwB,KAAA,CAAM,IAAI,CAAA,GAC9C,QAAQ,IAAA,CAAK,OAAA,CAAQ,KAAA,CAAM,IA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,CAAA,GACrE,IAAA;AACN;;;;"}
1
+ {"version":3,"file":"media-type.cjs","sources":["../../../../src/application/transform/document/media-type.ts"],"sourcesContent":["import { irObject, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrPropertySignature, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { appendPointer, createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport {\n type ContentMap,\n isMediaTypeComponentRef,\n type MediaTypeObject,\n} from \"../../../domain/openapi/media-type-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { transformSchema } from \"../schema/schema-transform.js\";\nimport { UNKNOWN_TYPE } from \"../shared-types.js\";\nimport { documentMember } from \"./document-member.js\";\n\n/** The sibling of `content` that holds item types (ADR-020). */\nconst ITEM_CONTENT_KEY = \"itemContent\";\n\n/** A media type's schema, or `unknown` when it has none (OpenAPI 3.1 §4.8.14). */\nexport function mediaTypeType(\n mediaType: MediaTypeObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n return mediaType.schema ? transformSchema(mediaType.schema, location, context) : UNKNOWN_TYPE;\n}\n\n/** A `content` entry: a `$ref` is transformed like a schema `$ref`, the rest as a media type. */\nexport function contentEntryType(\n entry: ContentMap[string],\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n // `in` throws for a null entry, as in the original.\n return \"$ref\" in entry\n ? transformSchema(entry, location, context)\n : mediaTypeType(entry, location, context);\n}\n\n/** The `itemSchema` of a `content` entry and where it is, following a `$ref` to a component. */\nfunction itemSchemaAt(\n entry: ContentMap[string],\n path: string,\n context: SchemaContext,\n): { readonly schema: MediaTypeObject[\"itemSchema\"]; readonly path: string } {\n if (\"$ref\" in entry) {\n // Other `$ref`s in `content` keep their pre-3.2 output, so only media type components count.\n const resolved = isMediaTypeComponentRef(entry.$ref)\n ? (context.refs.resolve(entry.$ref) as MediaTypeObject | undefined)\n : undefined;\n // `createRef` reads the `$ref` itself as a pointer; only the constant segment is appended.\n return { schema: resolved?.itemSchema, path: createRef([entry.$ref, \"itemSchema\"]) };\n }\n return { schema: entry.itemSchema, path: appendPointer(path, [\"itemSchema\"]) };\n}\n\n/**\n * `itemContent`: the type of one item of each media type with an `itemSchema` (OpenAPI 3.2), next\n * to `content`, which keeps the type of the complete body. Null when no media type has one.\n */\nexport function itemContentMember(\n content: ContentMap,\n location: SchemaLocation,\n context: SchemaContext,\n flags: { readonly isReadonly: boolean },\n): IrPropertySignature | null {\n const members = documentEntries(content, context.options).flatMap(([mediaType, entry]) => {\n const contentPath = appendPointer(location.path, [\"content\", mediaType]);\n const item = itemSchemaAt(entry, contentPath, context);\n if (item.schema === undefined) {\n return [];\n }\n const type = transformSchema(item.schema, { ...location, path: item.path }, context);\n return [documentMember(mediaType, type, entry, { isReadonly: context.options.immutable })];\n });\n return members.length > 0\n ? irProperty(toPropertyName(ITEM_CONTENT_KEY), irObject(members), flags)\n : null;\n}\n"],"names":["transformSchema","UNKNOWN_TYPE","isMediaTypeComponentRef","createRef","appendPointer","documentEntries","documentMember","irProperty","toPropertyName","irObject"],"mappings":";;;;;;;;;;;AAgBA,MAAM,gBAAA,GAAmB,aAAA;AAGlB,SAAS,aAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,OAAO,UAAU,MAAA,GAASA,+BAAA,CAAgB,UAAU,MAAA,EAAQ,QAAA,EAAU,OAAO,CAAA,GAAIC,wBAAA;AACnF;AAGO,SAAS,gBAAA,CACd,KAAA,EACA,QAAA,EACA,OAAA,EACQ;AAER,EAAA,OAAO,MAAA,IAAU,KAAA,GACbD,+BAAA,CAAgB,KAAA,EAAO,QAAA,EAAU,OAAO,CAAA,GACxC,aAAA,CAAc,KAAA,EAAO,QAAA,EAAU,OAAO,CAAA;AAC5C;AAGA,SAAS,YAAA,CACP,KAAA,EACA,IAAA,EACA,OAAA,EAC2E;AAC3E,EAAA,IAAI,U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AA;AACD,EAAA,OAAO,OAAA,CAAQ,MAAA,GAAS,CAAA,GACpBC,uBAAA,CAAWC,2BAAA,CAAe,gBAAgB,CAAA,EAAGC,qBAAA,CAAS,OAAO,CAAA,EAAG,KAAK,CAAA,GACrE,IAAA;AACN;;;;"}
@@ -1,6 +1,6 @@
1
1
  import { irProperty, 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, createRef } 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 { transformSchema } from '../schema/schema-transform.mjs';
@@ -19,11 +19,11 @@ function itemSchemaAt(entry, path, context) {
19
19
  const resolved = isMediaTypeComponentRef(entry.$ref) ? context.refs.resolve(entry.$ref) : void 0;
20
20
  return { schema: resolved?.itemSchema, path: createRef([entry.$ref, "itemSchema"]) };
21
21
  }
22
- return { schema: entry.itemSchema, path: createRef([path, "itemSchema"]) };
22
+ return { schema: entry.itemSchema, path: appendPointer(path, ["itemSchema"]) };
23
23
  }
24
24
  function itemContentMember(content, location, context, flags) {
25
25
  const members = documentEntries(content, context.options).flatMap(([mediaType, entry]) => {
26
- const contentPath = createRef([location.path, "content", mediaType]);
26
+ const contentPath = appendPointer(location.path, ["content", mediaType]);
27
27
  const item = itemSchemaAt(entry, contentPath, context);
28
28
  if (item.schema === void 0) {
29
29
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"media-type.mjs","sources":["../../../../src/application/transform/document/media-type.ts"],"sourcesContent":["import { irObject, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { 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 type ContentMap,\n isMediaTypeComponentRef,\n type MediaTypeObject,\n} from \"../../../domain/openapi/media-type-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { transformSchema } from \"../schema/schema-transform.js\";\nimport { UNKNOWN_TYPE } from \"../shared-types.js\";\nimport { documentMember } from \"./document-member.js\";\n\n/** The sibling of `content` that holds item types (ADR-020). */\nconst ITEM_CONTENT_KEY = \"itemContent\";\n\n/** A media type's schema, or `unknown` when it has none (OpenAPI 3.1 §4.8.14). */\nexport function mediaTypeType(\n mediaType: MediaTypeObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n return mediaType.schema ? transformSchema(mediaType.schema, location, context) : UNKNOWN_TYPE;\n}\n\n/** A `content` entry: a `$ref` is transformed like a schema `$ref`, the rest as a media type. */\nexport function contentEntryType(\n entry: ContentMap[string],\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n // `in` throws for a null entry, as in the original.\n return \"$ref\" in entry\n ? transformSchema(entry, location, context)\n : mediaTypeType(entry, location, context);\n}\n\n/** The `itemSchema` of a `content` entry and where it is, following a `$ref` to a component. */\nfunction itemSchemaAt(\n entry: ContentMap[string],\n path: string,\n context: SchemaContext,\n): { readonly schema: MediaTypeObject[\"itemSchema\"]; readonly path: string } {\n if (\"$ref\" in entry) {\n // Other `$ref`s in `content` keep their pre-3.2 output, so only media type components count.\n const resolved = isMediaTypeComponentRef(entry.$ref)\n ? (context.refs.resolve(entry.$ref) as MediaTypeObject | undefined)\n : undefined;\n return { schema: resolved?.itemSchema, path: createRef([entry.$ref, \"itemSchema\"]) };\n }\n return { schema: entry.itemSchema, path: createRef([path, \"itemSchema\"]) };\n}\n\n/**\n * `itemContent`: the type of one item of each media type with an `itemSchema` (OpenAPI 3.2), next\n * to `content`, which keeps the type of the complete body. Null when no media type has one.\n */\nexport function itemContentMember(\n content: ContentMap,\n location: SchemaLocation,\n context: SchemaContext,\n flags: { readonly isReadonly: boolean },\n): IrPropertySignature | null {\n const members = documentEntries(content, context.options).flatMap(([mediaType, entry]) => {\n const contentPath = createRef([location.path, \"content\", mediaType]);\n const item = itemSchemaAt(entry, contentPath, context);\n if (item.schema === undefined) {\n return [];\n }\n const type = transformSchema(item.schema, { ...location, path: item.path }, context);\n return [documentMember(mediaType, type, entry, { isReadonly: context.options.immutable })];\n });\n return members.length > 0\n ? irProperty(toPropertyName(ITEM_CONTENT_KEY), irObject(members), flags)\n : null;\n}\n"],"names":[],"mappings":";;;;;;;;;AAgBA,MAAM,gBAAA,GAAmB,aAAA;AAGlB,SAAS,aAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,OAAO,UAAU,MAAA,GAAS,eAAA,CAAgB,UAAU,MAAA,EAAQ,QAAA,EAAU,OAAO,CAAA,GAAI,YAAA;AACnF;AAGO,SAAS,gBAAA,CACd,KAAA,EACA,QAAA,EACA,OAAA,EACQ;AAER,EAAA,OAAO,MAAA,IAAU,KAAA,GACb,eAAA,CAAgB,KAAA,EAAO,QAAA,EAAU,OAAO,CAAA,GACxC,aAAA,CAAc,KAAA,EAAO,QAAA,EAAU,OAAO,CAAA;AAC5C;AAGA,SAAS,YAAA,CACP,KAAA,EACA,IAAA,EACA,OAAA,EAC2E;AAC3E,EAAA,IAAI,UAAU,KAAA,EAAO;AAEnB,IAAA,MAAM,QAAA,GAAW,uBAAA,CAAwB,KAAA,CAAM,IAAI,CAAA,GAC9C,QAAQ,IAAA,CAAK,OAAA,CAAQ,KAAA,CAAM,IAAI,CAAA,GAChC,MAAA;AACJ,IAAA,OAAO,EAAE,MAAA,EAAQ,QAAA,EAAU,UAAA,EAAY,IAAA,EAAM,SAAA,CAAU,CAAC,KAAA,CAAM,IAAA,EAAM,YAAY,CAAC,CAAA,EAAE;AAAA,EACrF;AACA,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,CAAM,UAAA,EAAY,IAAA,EAAM,UAAU,CAAC,IAAA,EAAM,YAAY,CAAC,CAAA,EAAE;AAC3E;AAMO,SAAS,iBAAA,CACd,OAAA,EACA,QAAA,EACA,OAAA,EACA,KAAA,EAC4B;AAC5B,EAAA,MAAM,OAAA,GAAU,eAAA,CAAgB,OAAA,EAAS,OAAA,CAAQ,OAAO,CAAA,CAAE,OAAA,CAAQ,CAAC,CAAC,SAAA,EAAW,KAAK,CAAA,KAAM;AACxF,IAAA,MAAM,cAAc,SAAA,CAAU,CAAC,SAAS,IAAA,EAAM,SAAA,EAAW,SAAS,CAAC,CAAA;AACnE,IAAA,MAAM,IAAA,GAAO,YAAA,CAAa,KAAA,EAAO,WAAA,EAAa,OAAO,CAAA;AACrD,IAAA,IAAI,IAAA,CAAK,WAAW,MAAA,EAAW;AAC7B,MAAA,OAAO,EAAC;AAAA,IACV;AACA,IAAA,MAAM,IAAA,GAAO,eAAA,CAAgB,IAAA,CAAK,MAAA,EAAQ,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,IAAA,CAAK,IAAA,EAAK,EAAG,OAAO,CAAA;AACnF,IAAA,OAAO,CAAC,cAAA,CAAe,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAC,CAAA;AAAA,EAC3F,CAAC,CAAA;AACD,EAAA,OAAO,OAAA,CAAQ,MAAA,GAAS,CAAA,GACpB,UAAA,CAAW,cAAA,CAAe,gBAAgB,CAAA,EAAG,QAAA,CAAS,OAAO,CAAA,EAAG,KAAK,CAAA,GACrE,IAAA;AACN;;"}
1
+ {"version":3,"file":"media-type.mjs","sources":["../../../../src/application/transform/document/media-type.ts"],"sourcesContent":["import { irObject, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrPropertySignature, IrType } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { appendPointer, createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport {\n type ContentMap,\n isMediaTypeComponentRef,\n type MediaTypeObject,\n} from \"../../../domain/openapi/media-type-object.js\";\nimport { documentEntries } from \"../document-entries.js\";\nimport type { SchemaContext, SchemaLocation } from \"../schema/schema-context.js\";\nimport { transformSchema } from \"../schema/schema-transform.js\";\nimport { UNKNOWN_TYPE } from \"../shared-types.js\";\nimport { documentMember } from \"./document-member.js\";\n\n/** The sibling of `content` that holds item types (ADR-020). */\nconst ITEM_CONTENT_KEY = \"itemContent\";\n\n/** A media type's schema, or `unknown` when it has none (OpenAPI 3.1 §4.8.14). */\nexport function mediaTypeType(\n mediaType: MediaTypeObject,\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n return mediaType.schema ? transformSchema(mediaType.schema, location, context) : UNKNOWN_TYPE;\n}\n\n/** A `content` entry: a `$ref` is transformed like a schema `$ref`, the rest as a media type. */\nexport function contentEntryType(\n entry: ContentMap[string],\n location: SchemaLocation,\n context: SchemaContext,\n): IrType {\n // `in` throws for a null entry, as in the original.\n return \"$ref\" in entry\n ? transformSchema(entry, location, context)\n : mediaTypeType(entry, location, context);\n}\n\n/** The `itemSchema` of a `content` entry and where it is, following a `$ref` to a component. */\nfunction itemSchemaAt(\n entry: ContentMap[string],\n path: string,\n context: SchemaContext,\n): { readonly schema: MediaTypeObject[\"itemSchema\"]; readonly path: string } {\n if (\"$ref\" in entry) {\n // Other `$ref`s in `content` keep their pre-3.2 output, so only media type components count.\n const resolved = isMediaTypeComponentRef(entry.$ref)\n ? (context.refs.resolve(entry.$ref) as MediaTypeObject | undefined)\n : undefined;\n // `createRef` reads the `$ref` itself as a pointer; only the constant segment is appended.\n return { schema: resolved?.itemSchema, path: createRef([entry.$ref, \"itemSchema\"]) };\n }\n return { schema: entry.itemSchema, path: appendPointer(path, [\"itemSchema\"]) };\n}\n\n/**\n * `itemContent`: the type of one item of each media type with an `itemSchema` (OpenAPI 3.2), next\n * to `content`, which keeps the type of the complete body. Null when no media type has one.\n */\nexport function itemContentMember(\n content: ContentMap,\n location: SchemaLocation,\n context: SchemaContext,\n flags: { readonly isReadonly: boolean },\n): IrPropertySignature | null {\n const members = documentEntries(content, context.options).flatMap(([mediaType, entry]) => {\n const contentPath = appendPointer(location.path, [\"content\", mediaType]);\n const item = itemSchemaAt(entry, contentPath, context);\n if (item.schema === undefined) {\n return [];\n }\n const type = transformSchema(item.schema, { ...location, path: item.path }, context);\n return [documentMember(mediaType, type, entry, { isReadonly: context.options.immutable })];\n });\n return members.length > 0\n ? irProperty(toPropertyName(ITEM_CONTENT_KEY), irObject(members), flags)\n : null;\n}\n"],"names":[],"mappings":";;;;;;;;;AAgBA,MAAM,gBAAA,GAAmB,aAAA;AAGlB,SAAS,aAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACQ;AACR,EAAA,OAAO,UAAU,MAAA,GAAS,eAAA,CAAgB,UAAU,MAAA,EAAQ,QAAA,EAAU,OAAO,CAAA,GAAI,YAAA;AACnF;AAGO,SAAS,gBAAA,CACd,KAAA,EACA,QAAA,EACA,OAAA,EACQ;AAER,EAAA,OAAO,MAAA,IAAU,KAAA,GACb,eAAA,CAAgB,KAAA,EAAO,QAAA,EAAU,OAAO,CAAA,GACxC,aAAA,CAAc,KAAA,EAAO,QAAA,EAAU,OAAO,CAAA;AAC5C;AAGA,SAAS,YAAA,CACP,KAAA,EACA,IAAA,EACA,OAAA,EAC2E;AAC3E,EAAA,IAAI,UAAU,KAAA,EAAO;AAEnB,IAAA,MAAM,QAAA,GAAW,uBAAA,CAAwB,KAAA,CAAM,IAAI,CAAA,GAC9C,QAAQ,IAAA,CAAK,OAAA,CAAQ,KAAA,CAAM,IAAI,CAAA,GAChC,MAAA;AAEJ,IAAA,OAAO,EAAE,MAAA,EAAQ,QAAA,EAAU,UAAA,EAAY,IAAA,EAAM,SAAA,CAAU,CAAC,KAAA,CAAM,IAAA,EAAM,YAAY,CAAC,CAAA,EAAE;AAAA,EACrF;AACA,EAAA,OAAO,EAAE,MAAA,EAAQ,KAAA,CAAM,UAAA,EAAY,IAAA,EAAM,cAAc,IAAA,EAAM,CAAC,YAAY,CAAC,CAAA,EAAE;AAC/E;AAMO,SAAS,iBAAA,CACd,OAAA,EACA,QAAA,EACA,OAAA,EACA,KAAA,EAC4B;AAC5B,EAAA,MAAM,OAAA,GAAU,eAAA,CAAgB,OAAA,EAAS,OAAA,CAAQ,OAAO,CAAA,CAAE,OAAA,CAAQ,CAAC,CAAC,SAAA,EAAW,KAAK,CAAA,KAAM;AACxF,IAAA,MAAM,cAAc,aAAA,CAAc,QAAA,CAAS,MAAM,CAAC,SAAA,EAAW,SAAS,CAAC,CAAA;AACvE,IAAA,MAAM,IAAA,GAAO,YAAA,CAAa,KAAA,EAAO,WAAA,EAAa,OAAO,CAAA;AACrD,IAAA,IAAI,IAAA,CAAK,WAAW,MAAA,EAAW;AAC7B,MAAA,OAAO,EAAC;AAAA,IACV;AACA,IAAA,MAAM,IAAA,GAAO,eAAA,CAAgB,IAAA,CAAK,MAAA,EAAQ,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,IAAA,CAAK,IAAA,EAAK,EAAG,OAAO,CAAA;AACnF,IAAA,OAAO,CAAC,cAAA,CAAe,SAAA,EAAW,IAAA,EAAM,KAAA,EAAO,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW,CAAC,CAAA;AAAA,EAC3F,CAAC,CAAA;AACD,EAAA,OAAO,OAAA,CAAQ,MAAA,GAAS,CAAA,GACpB,UAAA,CAAW,cAAA,CAAe,gBAAgB,CAAA,EAAG,QAAA,CAAS,OAAO,CAAA,EAAG,KAAK,CAAA,GACrE,IAAA;AACN;;"}
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ const appendAll = require('../../../domain/append-all.cjs');
4
+ const pathItem = require('./path-item.cjs');
5
+
6
+ function operationKeysWritten(document) {
7
+ const keys = /* @__PURE__ */ new Set();
8
+ const seen = /* @__PURE__ */ new WeakSet();
9
+ const pending = [document];
10
+ while (pending.length > 0) {
11
+ const value = pending.pop();
12
+ if (typeof value !== "object" || value === null || seen.has(value)) {
13
+ continue;
14
+ }
15
+ seen.add(value);
16
+ const { operationId } = value;
17
+ if (typeof operationId === "string") {
18
+ keys.add(pathItem.operationKeyOf(operationId));
19
+ }
20
+ appendAll.appendAll(pending, Object.values(value));
21
+ }
22
+ return keys;
23
+ }
24
+
25
+ exports.operationKeysWritten = operationKeysWritten;
26
+ //# sourceMappingURL=operation-keys-written.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-keys-written.cjs","sources":["../../../../src/application/transform/document/operation-keys-written.ts"],"sourcesContent":["import { appendAll } from \"../../../domain/append-all.js\";\nimport { operationKeyOf } from \"./path-item.js\";\n\n/**\n * Every `operations` key that an `operationId` in the document asks for, so that a repeated ID\n * never gets a number another operation has as its own ID (`OperationKeys`). Operations can sit\n * in `paths`, `webhooks`, `components.pathItems` and callbacks, so the whole document is read. A\n * Link Object's `operationId` is read too; an extra name only makes a number skip it.\n */\nexport function operationKeysWritten(document: object): Set<string> {\n const keys = new Set<string>();\n const seen = new WeakSet<object>();\n const pending: unknown[] = [document];\n while (pending.length > 0) {\n const value = pending.pop();\n if (typeof value !== \"object\" || value === null || seen.has(value)) {\n continue;\n }\n seen.add(value);\n const { operationId } = value as { operationId?: unknown };\n if (typeof operationId === \"string\") {\n keys.add(operationKeyOf(operationId));\n }\n appendAll(pending, Object.values(value));\n }\n return keys;\n}\n"],"names":["operationKeyOf","appendAll"],"mappings":";;;;;AASO,SAAS,qBAAqB,QAAA,EAA+B;AAClE,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,IAAA,uBAAW,OAAA,EAAgB;AACjC,EAAA,MAAM,OAAA,GAAqB,CAAC,QAAQ,CAAA;AACpC,EAAA,OAAO,OAAA,CAAQ,SAAS,CAAA,EAAG;AACzB,IAAA,MAAM,KAAA,GAAQ,QAAQ,GAAA,EAAI;AAC1B,IAAA,IAAI,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,EAAG;AAClE,MAAA;AAAA,IACF;AACA,IAAA,IAAA,CAAK,IAAI,KAAK,CAAA;AACd,IAAA,MAAM,EAAE,aAAY,GAAI,KAAA;AACxB,IAAA,IAAI,OAAO,gBAAgB,QAAA,EAAU;AACnC,MAAA,IAAA,CAAK,GAAA,CAAIA,uBAAA,CAAe,WAAW,CAAC,CAAA;AAAA,IACtC;AACA,IAAAC,mBAAA,CAAU,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,EACzC;AACA,EAAA,OAAO,IAAA;AACT;;"}
@@ -0,0 +1,24 @@
1
+ import { appendAll } from '../../../domain/append-all.mjs';
2
+ import { operationKeyOf } from './path-item.mjs';
3
+
4
+ function operationKeysWritten(document) {
5
+ const keys = /* @__PURE__ */ new Set();
6
+ const seen = /* @__PURE__ */ new WeakSet();
7
+ const pending = [document];
8
+ while (pending.length > 0) {
9
+ const value = pending.pop();
10
+ if (typeof value !== "object" || value === null || seen.has(value)) {
11
+ continue;
12
+ }
13
+ seen.add(value);
14
+ const { operationId } = value;
15
+ if (typeof operationId === "string") {
16
+ keys.add(operationKeyOf(operationId));
17
+ }
18
+ appendAll(pending, Object.values(value));
19
+ }
20
+ return keys;
21
+ }
22
+
23
+ export { operationKeysWritten };
24
+ //# sourceMappingURL=operation-keys-written.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operation-keys-written.mjs","sources":["../../../../src/application/transform/document/operation-keys-written.ts"],"sourcesContent":["import { appendAll } from \"../../../domain/append-all.js\";\nimport { operationKeyOf } from \"./path-item.js\";\n\n/**\n * Every `operations` key that an `operationId` in the document asks for, so that a repeated ID\n * never gets a number another operation has as its own ID (`OperationKeys`). Operations can sit\n * in `paths`, `webhooks`, `components.pathItems` and callbacks, so the whole document is read. A\n * Link Object's `operationId` is read too; an extra name only makes a number skip it.\n */\nexport function operationKeysWritten(document: object): Set<string> {\n const keys = new Set<string>();\n const seen = new WeakSet<object>();\n const pending: unknown[] = [document];\n while (pending.length > 0) {\n const value = pending.pop();\n if (typeof value !== \"object\" || value === null || seen.has(value)) {\n continue;\n }\n seen.add(value);\n const { operationId } = value as { operationId?: unknown };\n if (typeof operationId === \"string\") {\n keys.add(operationKeyOf(operationId));\n }\n appendAll(pending, Object.values(value));\n }\n return keys;\n}\n"],"names":[],"mappings":";;;AASO,SAAS,qBAAqB,QAAA,EAA+B;AAClE,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,IAAA,uBAAW,OAAA,EAAgB;AACjC,EAAA,MAAM,OAAA,GAAqB,CAAC,QAAQ,CAAA;AACpC,EAAA,OAAO,OAAA,CAAQ,SAAS,CAAA,EAAG;AACzB,IAAA,MAAM,KAAA,GAAQ,QAAQ,GAAA,EAAI;AAC1B,IAAA,IAAI,OAAO,UAAU,QAAA,IAAY,KAAA,KAAU,QAAQ,IAAA,CAAK,GAAA,CAAI,KAAK,CAAA,EAAG;AAClE,MAAA;AAAA,IACF;AACA,IAAA,IAAA,CAAK,IAAI,KAAK,CAAA;AACd,IAAA,MAAM,EAAE,aAAY,GAAI,KAAA;AACxB,IAAA,IAAI,OAAO,gBAAgB,QAAA,EAAU;AACnC,MAAA,IAAA,CAAK,GAAA,CAAI,cAAA,CAAe,WAAW,CAAC,CAAA;AAAA,IACtC;AACA,IAAA,SAAA,CAAU,OAAA,EAAS,MAAA,CAAO,MAAA,CAAO,KAAK,CAAC,CAAA;AAAA,EACzC;AACA,EAAA,OAAO,IAAA;AACT;;"}
@@ -21,7 +21,7 @@ function requestBodyMember(operation, location, context) {
21
21
  const isReference = "$ref" in body;
22
22
  const type = isReference ? refType.refType(body.$ref) : requestBody.requestBodyType(
23
23
  body,
24
- { ...location, path: jsonPointer.createRef([location.path, "requestBody"]) },
24
+ { ...location, path: jsonPointer.appendPointer(location.path, ["requestBody"]) },
25
25
  context
26
26
  );
27
27
  const resolved = isReference ? context.refs.resolve(body.$ref) : body;
@@ -1 +1 @@
1
- {"version":3,"file":"operation.cjs","sources":["../../../../src/application/transform/document/operation.ts"],"sourcesContent":["import { irKeyword, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrPropertySignature } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport type { OperationObject } from \"../../../domain/openapi/operation-object.js\";\nimport type { RequestBodyObject } from \"../../../domain/openapi/request-body-object.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaLocation } from \"../schema/schema-context.js\";\nimport type { TransformContext } from \"../transform-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { parametersMember } from \"./parameters.js\";\nimport { requestBodyType } from \"./request-body.js\";\nimport { responsesType } from \"./responses.js\";\n\n/** `requestBody`, optional unless the resolved body is required; `requestBody?: never` if none. */\nfunction requestBodyMember(\n operation: OperationObject,\n location: SchemaLocation,\n context: TransformContext,\n): IrPropertySignature {\n const isReadonly = context.options.immutable;\n const body = operation.requestBody;\n if (!body) {\n return irProperty(toPropertyName(\"requestBody\"), irKeyword(\"never\"), {\n isOptional: true,\n isReadonly,\n });\n }\n const isReference = \"$ref\" in body;\n const type = isReference\n ? refType(body.$ref)\n : requestBodyType(\n body,\n { ...location, path: createRef([location.path, \"requestBody\"]) },\n context,\n );\n const resolved = isReference\n ? (context.refs.resolve(body.$ref) as RequestBodyObject | undefined)\n : body;\n return documentMember(\"requestBody\", type, body, {\n isReadonly,\n isOptional: !resolved?.required,\n });\n}\n\n/**\n * The members of an operation (OpenAPI 3.1 §4.8.10): `parameters`, `requestBody` and `responses`.\n * `location.path` is the operation's pointer.\n */\nexport function operationMembers(\n operation: OperationObject,\n location: SchemaLocation,\n context: TransformContext,\n): IrPropertySignature[] {\n // Built in document order: each part may add footer declarations (enums), in this order.\n const parameters = parametersMember(operation.parameters ?? [], location, context);\n const requestBody = requestBodyMember(operation, location, context);\n const responses = responsesType(operation.responses ?? {}, location, context);\n return [\n parameters,\n requestBody,\n irProperty(toPropertyName(\"responses\"), responses, { isReadonly: context.options.immutable }),\n ];\n}\n"],"names":["irProperty","toPropertyName","irKeyword","refType","requestBodyType","createRef","documentMember","parameters","parametersMember","responses","responsesType"],"mappings":";;;;;;;;;;;AAeA,SAAS,iBAAA,CACP,SAAA,EACA,QAAA,EACA,OAAA,EACqB;AACrB,EAAA,MAAM,UAAA,GAAa,QAAQ,OAAA,CAAQ,SAAA;AACnC,EAAA,MAAM,OAAO,SAAA,CAAU,WAAA;AACvB,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAOA,wBAAWC,2BAAA,CAAe,aAAa,CAAA,EAAGC,sBAAA,CAAU,OAAO,CAAA,EAAG;AAAA,MACnE,UAAA,EAAY,IAAA;AAAA,MACZ;AAAA,KACD,CAAA;AAAA,EACH;AACA,EAAA,MAAM,cAAc,MAAA,IAAU,IAAA;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAA,GACTC,eAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,GACjBC,2BAAA;AAAA,IACE,IAAA;AAAA,IACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAMC,qBAAA,CAAU,CAAC,QAAA,CAAS,IAAA,EAAM,aAAa,CAAC,CAAA,EAAE;AAAA,IAC/D;AAAA,GACF;AACJ,EAAA,MAAM,WAAW,WAAA,GACZ,OAAA,CAAQ,KAAK,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,GAC/B,IAAA;AACJ,EAAA,OAAOC,6BAAA,CAAe,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM;AAAA,IAC/C,UAAA;AAAA,IACA,UAAA,EAAY,CAAC,QAAA,EAAU;AAAA,GACxB,CAAA;AACH;AAMO,SAAS,gBAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACuB;AAEvB,EAAA,MAAMC,eAAaC,2BAAA,CAAiB,SAAA,CAAU,cAAc,EAAC,EAAG,UAAU,OAAO,CAAA;AACjF,EAAA,MAAM,WAAA,GAAc,iBAAA,CAAkB,SAAA,EAAW,QAAA,EAAU,OAAO,CAAA;AAClE,EAAA,MAAMC,cAAYC,uBAAA,CAAc,SAAA,CAAU,aAAa,EAAC,EAAG,UAAU,OAAO,CAAA;AAC5E,EAAA,OAAO;AAAA,IACLH,YAAA;AAAA,IACA,WAAA;AAAA,IACAP,uBAAA,CAAWC,2BAAA,CAAe,WAAW,CAAA,EAAGQ,WAAA,EAAW,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW;AAAA,GAC9F;AACF;;"}
1
+ {"version":3,"file":"operation.cjs","sources":["../../../../src/application/transform/document/operation.ts"],"sourcesContent":["import { irKeyword, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrPropertySignature } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { appendPointer } from \"../../../domain/openapi/json-pointer.js\";\nimport type { OperationObject } from \"../../../domain/openapi/operation-object.js\";\nimport type { RequestBodyObject } from \"../../../domain/openapi/request-body-object.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaLocation } from \"../schema/schema-context.js\";\nimport type { TransformContext } from \"../transform-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { parametersMember } from \"./parameters.js\";\nimport { requestBodyType } from \"./request-body.js\";\nimport { responsesType } from \"./responses.js\";\n\n/** `requestBody`, optional unless the resolved body is required; `requestBody?: never` if none. */\nfunction requestBodyMember(\n operation: OperationObject,\n location: SchemaLocation,\n context: TransformContext,\n): IrPropertySignature {\n const isReadonly = context.options.immutable;\n const body = operation.requestBody;\n if (!body) {\n return irProperty(toPropertyName(\"requestBody\"), irKeyword(\"never\"), {\n isOptional: true,\n isReadonly,\n });\n }\n const isReference = \"$ref\" in body;\n const type = isReference\n ? refType(body.$ref)\n : requestBodyType(\n body,\n { ...location, path: appendPointer(location.path, [\"requestBody\"]) },\n context,\n );\n const resolved = isReference\n ? (context.refs.resolve(body.$ref) as RequestBodyObject | undefined)\n : body;\n return documentMember(\"requestBody\", type, body, {\n isReadonly,\n isOptional: !resolved?.required,\n });\n}\n\n/**\n * The members of an operation (OpenAPI 3.1 §4.8.10): `parameters`, `requestBody` and `responses`.\n * `location.path` is the operation's pointer.\n */\nexport function operationMembers(\n operation: OperationObject,\n location: SchemaLocation,\n context: TransformContext,\n): IrPropertySignature[] {\n // Built in document order: each part may add footer declarations (enums), in this order.\n const parameters = parametersMember(operation.parameters ?? [], location, context);\n const requestBody = requestBodyMember(operation, location, context);\n const responses = responsesType(operation.responses ?? {}, location, context);\n return [\n parameters,\n requestBody,\n irProperty(toPropertyName(\"responses\"), responses, { isReadonly: context.options.immutable }),\n ];\n}\n"],"names":["irProperty","toPropertyName","irKeyword","refType","requestBodyType","appendPointer","documentMember","parameters","parametersMember","responses","responsesType"],"mappings":";;;;;;;;;;;AAeA,SAAS,iBAAA,CACP,SAAA,EACA,QAAA,EACA,OAAA,EACqB;AACrB,EAAA,MAAM,UAAA,GAAa,QAAQ,OAAA,CAAQ,SAAA;AACnC,EAAA,MAAM,OAAO,SAAA,CAAU,WAAA;AACvB,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAOA,wBAAWC,2BAAA,CAAe,aAAa,CAAA,EAAGC,sBAAA,CAAU,OAAO,CAAA,EAAG;AAAA,MACnE,UAAA,EAAY,IAAA;AAAA,MACZ;AAAA,KACD,CAAA;AAAA,EACH;AACA,EAAA,MAAM,cAAc,MAAA,IAAU,IAAA;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAA,GACTC,eAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,GACjBC,2BAAA;AAAA,IACE,IAAA;AAAA,IACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAMC,yBAAA,CAAc,SAAS,IAAA,EAAM,CAAC,aAAa,CAAC,CAAA,EAAE;AAAA,IACnE;AAAA,GACF;AACJ,EAAA,MAAM,WAAW,WAAA,GACZ,OAAA,CAAQ,KAAK,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,GAC/B,IAAA;AACJ,EAAA,OAAOC,6BAAA,CAAe,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM;AAAA,IAC/C,UAAA;AAAA,IACA,UAAA,EAAY,CAAC,QAAA,EAAU;AAAA,GACxB,CAAA;AACH;AAMO,SAAS,gBAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACuB;AAEvB,EAAA,MAAMC,eAAaC,2BAAA,CAAiB,SAAA,CAAU,cAAc,EAAC,EAAG,UAAU,OAAO,CAAA;AACjF,EAAA,MAAM,WAAA,GAAc,iBAAA,CAAkB,SAAA,EAAW,QAAA,EAAU,OAAO,CAAA;AAClE,EAAA,MAAMC,cAAYC,uBAAA,CAAc,SAAA,CAAU,aAAa,EAAC,EAAG,UAAU,OAAO,CAAA;AAC5E,EAAA,OAAO;AAAA,IACLH,YAAA;AAAA,IACA,WAAA;AAAA,IACAP,uBAAA,CAAWC,2BAAA,CAAe,WAAW,CAAA,EAAGQ,WAAA,EAAW,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW;AAAA,GAC9F;AACF;;"}
@@ -1,6 +1,6 @@
1
1
  import { 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 { refType } from '../ref-type.mjs';
5
5
  import { documentMember } from './document-member.mjs';
6
6
  import { parametersMember } from './parameters.mjs';
@@ -19,7 +19,7 @@ function requestBodyMember(operation, location, context) {
19
19
  const isReference = "$ref" in body;
20
20
  const type = isReference ? refType(body.$ref) : requestBodyType(
21
21
  body,
22
- { ...location, path: createRef([location.path, "requestBody"]) },
22
+ { ...location, path: appendPointer(location.path, ["requestBody"]) },
23
23
  context
24
24
  );
25
25
  const resolved = isReference ? context.refs.resolve(body.$ref) : body;
@@ -1 +1 @@
1
- {"version":3,"file":"operation.mjs","sources":["../../../../src/application/transform/document/operation.ts"],"sourcesContent":["import { irKeyword, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrPropertySignature } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { createRef } from \"../../../domain/openapi/json-pointer.js\";\nimport type { OperationObject } from \"../../../domain/openapi/operation-object.js\";\nimport type { RequestBodyObject } from \"../../../domain/openapi/request-body-object.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaLocation } from \"../schema/schema-context.js\";\nimport type { TransformContext } from \"../transform-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { parametersMember } from \"./parameters.js\";\nimport { requestBodyType } from \"./request-body.js\";\nimport { responsesType } from \"./responses.js\";\n\n/** `requestBody`, optional unless the resolved body is required; `requestBody?: never` if none. */\nfunction requestBodyMember(\n operation: OperationObject,\n location: SchemaLocation,\n context: TransformContext,\n): IrPropertySignature {\n const isReadonly = context.options.immutable;\n const body = operation.requestBody;\n if (!body) {\n return irProperty(toPropertyName(\"requestBody\"), irKeyword(\"never\"), {\n isOptional: true,\n isReadonly,\n });\n }\n const isReference = \"$ref\" in body;\n const type = isReference\n ? refType(body.$ref)\n : requestBodyType(\n body,\n { ...location, path: createRef([location.path, \"requestBody\"]) },\n context,\n );\n const resolved = isReference\n ? (context.refs.resolve(body.$ref) as RequestBodyObject | undefined)\n : body;\n return documentMember(\"requestBody\", type, body, {\n isReadonly,\n isOptional: !resolved?.required,\n });\n}\n\n/**\n * The members of an operation (OpenAPI 3.1 §4.8.10): `parameters`, `requestBody` and `responses`.\n * `location.path` is the operation's pointer.\n */\nexport function operationMembers(\n operation: OperationObject,\n location: SchemaLocation,\n context: TransformContext,\n): IrPropertySignature[] {\n // Built in document order: each part may add footer declarations (enums), in this order.\n const parameters = parametersMember(operation.parameters ?? [], location, context);\n const requestBody = requestBodyMember(operation, location, context);\n const responses = responsesType(operation.responses ?? {}, location, context);\n return [\n parameters,\n requestBody,\n irProperty(toPropertyName(\"responses\"), responses, { isReadonly: context.options.immutable }),\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;AAeA,SAAS,iBAAA,CACP,SAAA,EACA,QAAA,EACA,OAAA,EACqB;AACrB,EAAA,MAAM,UAAA,GAAa,QAAQ,OAAA,CAAQ,SAAA;AACnC,EAAA,MAAM,OAAO,SAAA,CAAU,WAAA;AACvB,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAO,WAAW,cAAA,CAAe,aAAa,CAAA,EAAG,SAAA,CAAU,OAAO,CAAA,EAAG;AAAA,MACnE,UAAA,EAAY,IAAA;AAAA,MACZ;AAAA,KACD,CAAA;AAAA,EACH;AACA,EAAA,MAAM,cAAc,MAAA,IAAU,IAAA;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAA,GACT,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,GACjB,eAAA;AAAA,IACE,IAAA;AAAA,IACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,SAAA,CAAU,CAAC,QAAA,CAAS,IAAA,EAAM,aAAa,CAAC,CAAA,EAAE;AAAA,IAC/D;AAAA,GACF;AACJ,EAAA,MAAM,WAAW,WAAA,GACZ,OAAA,CAAQ,KAAK,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,GAC/B,IAAA;AACJ,EAAA,OAAO,cAAA,CAAe,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM;AAAA,IAC/C,UAAA;AAAA,IACA,UAAA,EAAY,CAAC,QAAA,EAAU;AAAA,GACxB,CAAA;AACH;AAMO,SAAS,gBAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACuB;AAEvB,EAAA,MAAM,aAAa,gBAAA,CAAiB,SAAA,CAAU,cAAc,EAAC,EAAG,UAAU,OAAO,CAAA;AACjF,EAAA,MAAM,WAAA,GAAc,iBAAA,CAAkB,SAAA,EAAW,QAAA,EAAU,OAAO,CAAA;AAClE,EAAA,MAAM,YAAY,aAAA,CAAc,SAAA,CAAU,aAAa,EAAC,EAAG,UAAU,OAAO,CAAA;AAC5E,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA,CAAW,cAAA,CAAe,WAAW,CAAA,EAAG,SAAA,EAAW,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW;AAAA,GAC9F;AACF;;"}
1
+ {"version":3,"file":"operation.mjs","sources":["../../../../src/application/transform/document/operation.ts"],"sourcesContent":["import { irKeyword, irProperty } from \"../../../domain/ir/constructors.js\";\nimport type { IrPropertySignature } from \"../../../domain/ir/nodes.js\";\nimport { toPropertyName } from \"../../../domain/ir/property-name.js\";\nimport { appendPointer } from \"../../../domain/openapi/json-pointer.js\";\nimport type { OperationObject } from \"../../../domain/openapi/operation-object.js\";\nimport type { RequestBodyObject } from \"../../../domain/openapi/request-body-object.js\";\nimport { refType } from \"../ref-type.js\";\nimport type { SchemaLocation } from \"../schema/schema-context.js\";\nimport type { TransformContext } from \"../transform-context.js\";\nimport { documentMember } from \"./document-member.js\";\nimport { parametersMember } from \"./parameters.js\";\nimport { requestBodyType } from \"./request-body.js\";\nimport { responsesType } from \"./responses.js\";\n\n/** `requestBody`, optional unless the resolved body is required; `requestBody?: never` if none. */\nfunction requestBodyMember(\n operation: OperationObject,\n location: SchemaLocation,\n context: TransformContext,\n): IrPropertySignature {\n const isReadonly = context.options.immutable;\n const body = operation.requestBody;\n if (!body) {\n return irProperty(toPropertyName(\"requestBody\"), irKeyword(\"never\"), {\n isOptional: true,\n isReadonly,\n });\n }\n const isReference = \"$ref\" in body;\n const type = isReference\n ? refType(body.$ref)\n : requestBodyType(\n body,\n { ...location, path: appendPointer(location.path, [\"requestBody\"]) },\n context,\n );\n const resolved = isReference\n ? (context.refs.resolve(body.$ref) as RequestBodyObject | undefined)\n : body;\n return documentMember(\"requestBody\", type, body, {\n isReadonly,\n isOptional: !resolved?.required,\n });\n}\n\n/**\n * The members of an operation (OpenAPI 3.1 §4.8.10): `parameters`, `requestBody` and `responses`.\n * `location.path` is the operation's pointer.\n */\nexport function operationMembers(\n operation: OperationObject,\n location: SchemaLocation,\n context: TransformContext,\n): IrPropertySignature[] {\n // Built in document order: each part may add footer declarations (enums), in this order.\n const parameters = parametersMember(operation.parameters ?? [], location, context);\n const requestBody = requestBodyMember(operation, location, context);\n const responses = responsesType(operation.responses ?? {}, location, context);\n return [\n parameters,\n requestBody,\n irProperty(toPropertyName(\"responses\"), responses, { isReadonly: context.options.immutable }),\n ];\n}\n"],"names":[],"mappings":";;;;;;;;;AAeA,SAAS,iBAAA,CACP,SAAA,EACA,QAAA,EACA,OAAA,EACqB;AACrB,EAAA,MAAM,UAAA,GAAa,QAAQ,OAAA,CAAQ,SAAA;AACnC,EAAA,MAAM,OAAO,SAAA,CAAU,WAAA;AACvB,EAAA,IAAI,CAAC,IAAA,EAAM;AACT,IAAA,OAAO,WAAW,cAAA,CAAe,aAAa,CAAA,EAAG,SAAA,CAAU,OAAO,CAAA,EAAG;AAAA,MACnE,UAAA,EAAY,IAAA;AAAA,MACZ;AAAA,KACD,CAAA;AAAA,EACH;AACA,EAAA,MAAM,cAAc,MAAA,IAAU,IAAA;AAC9B,EAAA,MAAM,IAAA,GAAO,WAAA,GACT,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,GACjB,eAAA;AAAA,IACE,IAAA;AAAA,IACA,EAAE,GAAG,QAAA,EAAU,IAAA,EAAM,aAAA,CAAc,SAAS,IAAA,EAAM,CAAC,aAAa,CAAC,CAAA,EAAE;AAAA,IACnE;AAAA,GACF;AACJ,EAAA,MAAM,WAAW,WAAA,GACZ,OAAA,CAAQ,KAAK,OAAA,CAAQ,IAAA,CAAK,IAAI,CAAA,GAC/B,IAAA;AACJ,EAAA,OAAO,cAAA,CAAe,aAAA,EAAe,IAAA,EAAM,IAAA,EAAM;AAAA,IAC/C,UAAA;AAAA,IACA,UAAA,EAAY,CAAC,QAAA,EAAU;AAAA,GACxB,CAAA;AACH;AAMO,SAAS,gBAAA,CACd,SAAA,EACA,QAAA,EACA,OAAA,EACuB;AAEvB,EAAA,MAAM,aAAa,gBAAA,CAAiB,SAAA,CAAU,cAAc,EAAC,EAAG,UAAU,OAAO,CAAA;AACjF,EAAA,MAAM,WAAA,GAAc,iBAAA,CAAkB,SAAA,EAAW,QAAA,EAAU,OAAO,CAAA;AAClE,EAAA,MAAM,YAAY,aAAA,CAAc,SAAA,CAAU,aAAa,EAAC,EAAG,UAAU,OAAO,CAAA;AAC5E,EAAA,OAAO;AAAA,IACL,UAAA;AAAA,IACA,WAAA;AAAA,IACA,UAAA,CAAW,cAAA,CAAe,WAAW,CAAA,EAAG,SAAA,EAAW,EAAE,UAAA,EAAY,OAAA,CAAQ,OAAA,CAAQ,SAAA,EAAW;AAAA,GAC9F;AACF;;"}
@@ -0,0 +1,34 @@
1
+ 'use strict';
2
+
3
+ function resolveParameter(parameter, refs) {
4
+ return "$ref" in parameter ? refs.resolve(parameter.$ref) : parameter;
5
+ }
6
+ function isDeprecatedParameter(parameter) {
7
+ const schema = parameter?.schema;
8
+ return Boolean(parameter?.deprecated || schema?.deprecated);
9
+ }
10
+ function parameterEntries(parameters, context) {
11
+ const entries = parameters.map((original) => ({
12
+ original,
13
+ resolved: resolveParameter(original, context.refs)
14
+ }));
15
+ if (context.options.alphabetize) {
16
+ entries.sort(
17
+ (left, right) => (left.resolved?.name ?? "").localeCompare(right.resolved?.name ?? "")
18
+ );
19
+ }
20
+ return context.options.excludeDeprecated ? entries.filter(({ resolved }) => !isDeprecatedParameter(resolved)) : entries;
21
+ }
22
+ function mergedParameters(pathItem, operation, refs) {
23
+ const byKey = /* @__PURE__ */ new Map();
24
+ for (const parameter of [...pathItem.parameters ?? [], ...operation.parameters ?? []]) {
25
+ const resolved = resolveParameter(parameter, refs);
26
+ byKey.set(`${resolved?.in}-${resolved?.name}`, parameter);
27
+ }
28
+ return [...byKey.values()];
29
+ }
30
+
31
+ exports.mergedParameters = mergedParameters;
32
+ exports.parameterEntries = parameterEntries;
33
+ exports.resolveParameter = resolveParameter;
34
+ //# sourceMappingURL=parameter-entries.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parameter-entries.cjs","sources":["../../../../src/application/transform/document/parameter-entries.ts"],"sourcesContent":["import type { OperationObject } from \"../../../domain/openapi/operation-object.js\";\nimport type {\n ParameterObject,\n ParameterOrReference,\n} from \"../../../domain/openapi/parameter-object.js\";\nimport type { PathItemObject } from \"../../../domain/openapi/path-item-object.js\";\nimport type { SchemaObject } from \"../../../domain/openapi/schema-object.js\";\nimport type { RefResolver } from \"../schema/schema-context.js\";\nimport type { TransformContext } from \"../transform-context.js\";\n\n/** A parameter as written in the document, and the object its `$ref` points to. */\nexport interface ParameterEntry {\n readonly original: ParameterOrReference;\n readonly resolved: ParameterObject | undefined;\n}\n\n/** An entry whose `$ref` resolved, so its location and name are known. */\nexport type ResolvedEntry = ParameterEntry & { readonly resolved: ParameterObject };\n\n/** The parameter object itself, or the one its `$ref` points to. */\nexport function resolveParameter(\n parameter: ParameterOrReference,\n refs: RefResolver,\n): ParameterObject | undefined {\n return \"$ref\" in parameter\n ? (refs.resolve(parameter.$ref) as ParameterObject | undefined)\n : parameter;\n}\n\nfunction isDeprecatedParameter(parameter: ParameterObject | undefined): boolean {\n const schema = parameter?.schema as SchemaObject | undefined;\n return Boolean(parameter?.deprecated || schema?.deprecated);\n}\n\n/** Resolved parameters, sorted for `--alphabetize`, without deprecated ones if excluded. */\nexport function parameterEntries(\n parameters: readonly ParameterOrReference[],\n context: TransformContext,\n): ParameterEntry[] {\n const entries = parameters.map((original) => ({\n original,\n resolved: resolveParameter(original, context.refs),\n }));\n if (context.options.alphabetize) {\n // Unlike map keys, the original sorts parameters with the default locale's `localeCompare`.\n entries.sort((left, right) =>\n (left.resolved?.name ?? \"\").localeCompare(right.resolved?.name ?? \"\"),\n );\n }\n return context.options.excludeDeprecated\n ? entries.filter(({ resolved }) => !isDeprecatedParameter(resolved))\n : entries;\n}\n\n/**\n * Path item parameters followed by the operation's, keyed by location and name, so an operation\n * parameter replaces the path item parameter it redefines (upstream issue #1798).\n */\nexport function mergedParameters(\n pathItem: PathItemObject,\n operation: OperationObject,\n refs: RefResolver,\n): ParameterOrReference[] {\n const byKey = new Map<string, ParameterOrReference>();\n for (const parameter of [...(pathItem.parameters ?? []), ...(operation.parameters ?? [])]) {\n const resolved = resolveParameter(parameter, refs);\n byKey.set(`${resolved?.in}-${resolved?.name}`, parameter);\n }\n return [...byKey.values()];\n}\n"],"names":[],"mappings":";;AAoBO,SAAS,gBAAA,CACd,WACA,IAAA,EAC6B;AAC7B,EAAA,OAAO,UAAU,SAAA,GACZ,IAAA,CAAK,OAAA,CAAQ,SAAA,CAAU,IAAI,CAAA,GAC5B,SAAA;AACN;AAEA,SAAS,sBAAsB,SAAA,EAAiD;AAC9E,EAAA,MAAM,SAAS,SAAA,EAAW,MAAA;AAC1B,EAAA,OAAO,OAAA,CAAQ,SAAA,EAAW,UAAA,IAAc,MAAA,EAAQ,UAAU,CAAA;AAC5D;AAGO,SAAS,gBAAA,CACd,YACA,OAAA,EACkB;AAClB,EAAA,MAAM,OAAA,GAAU,UAAA,CAAW,GAAA,CAAI,CAAC,QAAA,MAAc;AAAA,IAC5C,QAAA;AAAA,IACA,QAAA,EAAU,gBAAA,CAAiB,QAAA,EAAU,OAAA,CAAQ,IAAI;AAAA,GACnD,CAAE,CAAA;AACF,EAAA,IAAI,OAAA,CAAQ,QAAQ,WAAA,EAAa;AAE/B,IAAA,OAAA,CAAQ,IAAA;AAAA,MAAK,CAAC,IAAA,EAAM,KAAA,KAAA,CACjB,IAAA,CAAK,QAAA,EAAU,IAAA,IAAQ,EAAA,EAAI,aAAA,CAAc,KAAA,CAAM,QAAA,EAAU,IAAA,IAAQ,EAAE;AAAA,KACtE;AAAA,EACF;AACA,EAAA,OAAO,OAAA,CAAQ,OAAA,C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