keq 2.8.13 → 2.9.0

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 (842) hide show
  1. package/.claude/settings.local.json +26 -0
  2. package/CHANGELOG.md +14 -0
  3. package/dist/esm/src/create-request.js +2 -0
  4. package/dist/esm/src/middlewares/mutex-flow-control-middleware.d.ts +2 -0
  5. package/dist/esm/src/middlewares/mutex-flow-control-middleware.js +22 -0
  6. package/dist/esm/src/types/keq-flow-control.d.ts +1 -1
  7. package/dist/esm/src/types/keq-global.d.ts +1 -0
  8. package/dist/esm/src/util/create-response-proxy.js +2 -2
  9. package/dist/esm/src/util/fork.js +3 -3
  10. package/dist/umd/src/create-request.js +3 -1
  11. package/dist/umd/src/middlewares/mutex-flow-control-middleware.d.ts +2 -0
  12. package/dist/umd/src/middlewares/mutex-flow-control-middleware.js +36 -0
  13. package/dist/umd/src/types/keq-flow-control.d.ts +1 -1
  14. package/dist/umd/src/types/keq-global.d.ts +1 -0
  15. package/dist/umd/src/util/create-response-proxy.js +2 -2
  16. package/dist/umd/src/util/fork.js +3 -3
  17. package/package.json +1 -1
  18. package/packages/cache/.turbo/turbo-build.log +26 -16
  19. package/packages/cache/dist/index.d.mts +354 -0
  20. package/packages/cache/dist/index.d.mts.map +1 -0
  21. package/packages/cache/dist/index.d.ts +352 -5
  22. package/packages/cache/dist/index.d.ts.map +1 -1
  23. package/packages/cache/dist/index.js +1211 -1256
  24. package/packages/cache/dist/index.js.map +1 -1
  25. package/packages/cache/dist/index.mjs +1183 -1231
  26. package/packages/cache/dist/index.mjs.map +1 -1
  27. package/packages/cli/.turbo/turbo-build.log +88 -24
  28. package/packages/cli/dist/cli.cjs +1333 -2891
  29. package/packages/cli/dist/cli.cjs.map +1 -1
  30. package/packages/cli/dist/cli.d.cts +1 -0
  31. package/packages/cli/dist/cli.d.mts +1 -0
  32. package/packages/cli/dist/cli.mjs +1359 -0
  33. package/packages/cli/dist/cli.mjs.map +1 -0
  34. package/packages/cli/dist/compiler-0Kli6UCr.cjs +738 -0
  35. package/packages/cli/dist/compiler-0Kli6UCr.cjs.map +1 -0
  36. package/packages/cli/dist/compiler-C3AE8j54.mjs +715 -0
  37. package/packages/cli/dist/compiler-C3AE8j54.mjs.map +1 -0
  38. package/packages/cli/dist/index.cjs +18 -2853
  39. package/packages/cli/dist/index.cjs.map +1 -1
  40. package/packages/cli/dist/index.d.cts +17 -0
  41. package/packages/cli/dist/index.d.cts.map +1 -0
  42. package/packages/cli/dist/index.d.mts +17 -0
  43. package/packages/cli/dist/index.d.mts.map +1 -0
  44. package/packages/cli/dist/index.mjs +10 -0
  45. package/packages/cli/dist/index.mjs.map +1 -0
  46. package/packages/cli/dist/init-BNhD2oCI.mjs +168 -0
  47. package/packages/cli/dist/init-BNhD2oCI.mjs.map +1 -0
  48. package/packages/cli/dist/init-DqxLcRSQ.cjs +170 -0
  49. package/packages/cli/dist/init-DqxLcRSQ.cjs.map +1 -0
  50. package/packages/cli/dist/logger-D7PyVZo3.cjs +46 -0
  51. package/packages/cli/dist/logger-D7PyVZo3.cjs.map +1 -0
  52. package/packages/cli/dist/logger-QLBHySQ3.mjs +12 -0
  53. package/packages/cli/dist/logger-QLBHySQ3.mjs.map +1 -0
  54. package/packages/cli/dist/micro-function.translator-BmJZzkKh.cjs +16 -0
  55. package/packages/cli/dist/micro-function.translator-BmJZzkKh.cjs.map +1 -0
  56. package/packages/cli/dist/micro-function.translator-CDfkj4Tt.mjs +11 -0
  57. package/packages/cli/dist/micro-function.translator-CDfkj4Tt.mjs.map +1 -0
  58. package/packages/cli/dist/mock-command-Bp1LxSls.mjs +350 -0
  59. package/packages/cli/dist/mock-command-Bp1LxSls.mjs.map +1 -0
  60. package/packages/cli/dist/mock-command-WZcfy5Iq.cjs +353 -0
  61. package/packages/cli/dist/mock-command-WZcfy5Iq.cjs.map +1 -0
  62. package/packages/cli/dist/plugins-CgMhaNZq.cjs +3558 -0
  63. package/packages/cli/dist/plugins-CgMhaNZq.cjs.map +1 -0
  64. package/packages/cli/dist/plugins-DCvJ8iHR.mjs +3280 -0
  65. package/packages/cli/dist/plugins-DCvJ8iHR.mjs.map +1 -0
  66. package/packages/cli/dist/plugins.cjs +36 -2425
  67. package/packages/cli/dist/plugins.d.cts +2 -0
  68. package/packages/cli/dist/plugins.d.mts +2 -0
  69. package/packages/cli/dist/plugins.mjs +2 -0
  70. package/packages/cli/dist/runtime-config-BWQlPhiB.d.cts +780 -0
  71. package/packages/cli/dist/runtime-config-BWQlPhiB.d.cts.map +1 -0
  72. package/packages/cli/dist/runtime-config-CrzK-Ucf.d.mts +780 -0
  73. package/packages/cli/dist/runtime-config-CrzK-Ucf.d.mts.map +1 -0
  74. package/packages/cli/dist/translators.cjs +14 -0
  75. package/packages/cli/dist/translators.cjs.map +1 -0
  76. package/packages/cli/dist/translators.d.cts +14 -0
  77. package/packages/cli/dist/translators.d.cts.map +1 -0
  78. package/packages/cli/dist/translators.d.mts +14 -0
  79. package/packages/cli/dist/translators.d.mts.map +1 -0
  80. package/packages/cli/dist/translators.mjs +12 -0
  81. package/packages/cli/dist/translators.mjs.map +1 -0
  82. package/packages/cli/node_modules/.bin/eslint +2 -2
  83. package/packages/cli/node_modules/.bin/jiti +2 -2
  84. package/packages/cli/node_modules/.bin/js-yaml +2 -2
  85. package/packages/cli/node_modules/.bin/jsf +21 -0
  86. package/packages/cli/node_modules/.bin/jsonpath +2 -2
  87. package/packages/cli/node_modules/.bin/jsonpath-plus +2 -2
  88. package/packages/cli/node_modules/.bin/semver +2 -2
  89. package/packages/cli/node_modules/.bin/tsc +4 -4
  90. package/packages/cli/node_modules/.bin/tsserver +4 -4
  91. package/packages/exception/.turbo/turbo-build.log +26 -31
  92. package/packages/exception/dist/index.d.mts +21 -0
  93. package/packages/exception/dist/index.d.mts.map +1 -0
  94. package/packages/exception/dist/index.d.ts +21 -0
  95. package/packages/exception/dist/index.d.ts.map +1 -0
  96. package/packages/exception/dist/index.js +97 -105
  97. package/packages/exception/dist/index.js.map +1 -1
  98. package/packages/exception/dist/index.mjs +92 -104
  99. package/packages/exception/dist/index.mjs.map +1 -1
  100. package/packages/headers/.turbo/turbo-build.log +26 -16
  101. package/packages/headers/dist/index.d.mts +46 -0
  102. package/packages/headers/dist/index.d.mts.map +1 -0
  103. package/packages/headers/dist/index.d.ts +46 -0
  104. package/packages/headers/dist/index.d.ts.map +1 -0
  105. package/packages/headers/dist/index.js +68 -64
  106. package/packages/headers/dist/index.js.map +1 -1
  107. package/packages/headers/dist/index.mjs +62 -43
  108. package/packages/headers/dist/index.mjs.map +1 -1
  109. package/packages/keq/.turbo/turbo-build.log +26 -16
  110. package/packages/keq/dist/index.d.mts +962 -0
  111. package/packages/keq/dist/index.d.mts.map +1 -0
  112. package/packages/keq/dist/index.d.ts +961 -7
  113. package/packages/keq/dist/index.d.ts.map +1 -1
  114. package/packages/keq/dist/index.js +1727 -1830
  115. package/packages/keq/dist/index.js.map +1 -1
  116. package/packages/keq/dist/index.mjs +1671 -1805
  117. package/packages/keq/dist/index.mjs.map +1 -1
  118. package/packages/nestjs/.turbo/turbo-build.log +26 -16
  119. package/packages/nestjs/dist/index.d.mts +52 -0
  120. package/packages/nestjs/dist/index.d.mts.map +1 -0
  121. package/packages/nestjs/dist/index.d.ts +51 -2
  122. package/packages/nestjs/dist/index.d.ts.map +1 -1
  123. package/packages/nestjs/dist/index.js +156 -60
  124. package/packages/nestjs/dist/index.js.map +1 -1
  125. package/packages/nestjs/dist/index.mjs +133 -42
  126. package/packages/nestjs/dist/index.mjs.map +1 -1
  127. package/packages/test/.turbo/turbo-build.log +1 -1
  128. package/packages/url/.turbo/turbo-build.log +26 -16
  129. package/packages/url/dist/index.d.mts +9 -0
  130. package/packages/url/dist/index.d.mts.map +1 -0
  131. package/packages/url/dist/index.d.ts +9 -0
  132. package/packages/url/dist/index.d.ts.map +1 -0
  133. package/packages/url/dist/index.js +36 -60
  134. package/packages/url/dist/index.js.map +1 -1
  135. package/packages/url/dist/index.mjs +33 -39
  136. package/packages/url/dist/index.mjs.map +1 -1
  137. package/packages/cache/dist/cache-entry/cache-entry.d.ts +0 -17
  138. package/packages/cache/dist/cache-entry/cache-entry.d.ts.map +0 -1
  139. package/packages/cache/dist/cache-entry/index.d.ts +0 -4
  140. package/packages/cache/dist/cache-entry/index.d.ts.map +0 -1
  141. package/packages/cache/dist/cache-entry/types/cache-entry-build-options.d.ts +0 -8
  142. package/packages/cache/dist/cache-entry/types/cache-entry-build-options.d.ts.map +0 -1
  143. package/packages/cache/dist/cache-entry/types/cache-entry-options.d.ts +0 -7
  144. package/packages/cache/dist/cache-entry/types/cache-entry-options.d.ts.map +0 -1
  145. package/packages/cache/dist/cache.d.ts +0 -38
  146. package/packages/cache/dist/cache.d.ts.map +0 -1
  147. package/packages/cache/dist/constants/eviction.enum.d.ts +0 -7
  148. package/packages/cache/dist/constants/eviction.enum.d.ts.map +0 -1
  149. package/packages/cache/dist/constants/index.d.ts +0 -5
  150. package/packages/cache/dist/constants/index.d.ts.map +0 -1
  151. package/packages/cache/dist/constants/max-expired-at.d.ts +0 -2
  152. package/packages/cache/dist/constants/max-expired-at.d.ts.map +0 -1
  153. package/packages/cache/dist/constants/size.enum.d.ts +0 -7
  154. package/packages/cache/dist/constants/size.enum.d.ts.map +0 -1
  155. package/packages/cache/dist/constants/strategy.enum.d.ts +0 -7
  156. package/packages/cache/dist/constants/strategy.enum.d.ts.map +0 -1
  157. package/packages/cache/dist/exceptions/cache-exception.d.ts +0 -5
  158. package/packages/cache/dist/exceptions/cache-exception.d.ts.map +0 -1
  159. package/packages/cache/dist/exceptions/index.d.ts +0 -2
  160. package/packages/cache/dist/exceptions/index.d.ts.map +0 -1
  161. package/packages/cache/dist/request-cache-handler/index.d.ts +0 -2
  162. package/packages/cache/dist/request-cache-handler/index.d.ts.map +0 -1
  163. package/packages/cache/dist/request-cache-handler/request-cache-handler.d.ts +0 -23
  164. package/packages/cache/dist/request-cache-handler/request-cache-handler.d.ts.map +0 -1
  165. package/packages/cache/dist/storage/index.d.ts +0 -6
  166. package/packages/cache/dist/storage/index.d.ts.map +0 -1
  167. package/packages/cache/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts +0 -22
  168. package/packages/cache/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts.map +0 -1
  169. package/packages/cache/dist/storage/indexed-db-storage/constants/default-table-name.d.ts +0 -2
  170. package/packages/cache/dist/storage/indexed-db-storage/constants/default-table-name.d.ts.map +0 -1
  171. package/packages/cache/dist/storage/indexed-db-storage/index.d.ts +0 -3
  172. package/packages/cache/dist/storage/indexed-db-storage/index.d.ts.map +0 -1
  173. package/packages/cache/dist/storage/indexed-db-storage/indexed-db-storage.d.ts +0 -12
  174. package/packages/cache/dist/storage/indexed-db-storage/indexed-db-storage.d.ts.map +0 -1
  175. package/packages/cache/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts +0 -11
  176. package/packages/cache/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts.map +0 -1
  177. package/packages/cache/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts +0 -11
  178. package/packages/cache/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts.map +0 -1
  179. package/packages/cache/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts +0 -11
  180. package/packages/cache/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts.map +0 -1
  181. package/packages/cache/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts +0 -11
  182. package/packages/cache/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts.map +0 -1
  183. package/packages/cache/dist/storage/indexed-db-storage/types/index.d.ts +0 -7
  184. package/packages/cache/dist/storage/indexed-db-storage/types/index.d.ts.map +0 -1
  185. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts +0 -12
  186. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts.map +0 -1
  187. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts +0 -8
  188. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts.map +0 -1
  189. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts +0 -14
  190. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts.map +0 -1
  191. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts +0 -29
  192. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts.map +0 -1
  193. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts +0 -14
  194. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts.map +0 -1
  195. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts +0 -13
  196. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts.map +0 -1
  197. package/packages/cache/dist/storage/internal-storage/internal-storage.d.ts +0 -16
  198. package/packages/cache/dist/storage/internal-storage/internal-storage.d.ts.map +0 -1
  199. package/packages/cache/dist/storage/internal-storage/types/events.d.ts +0 -16
  200. package/packages/cache/dist/storage/internal-storage/types/events.d.ts.map +0 -1
  201. package/packages/cache/dist/storage/internal-storage/types/storage-options.d.ts +0 -20
  202. package/packages/cache/dist/storage/internal-storage/types/storage-options.d.ts.map +0 -1
  203. package/packages/cache/dist/storage/keq-cache-storage.d.ts +0 -20
  204. package/packages/cache/dist/storage/keq-cache-storage.d.ts.map +0 -1
  205. package/packages/cache/dist/storage/memory-storage/base-memory-storage.d.ts +0 -31
  206. package/packages/cache/dist/storage/memory-storage/base-memory-storage.d.ts.map +0 -1
  207. package/packages/cache/dist/storage/memory-storage/index.d.ts +0 -3
  208. package/packages/cache/dist/storage/memory-storage/index.d.ts.map +0 -1
  209. package/packages/cache/dist/storage/memory-storage/lfu-memory-storage.d.ts +0 -11
  210. package/packages/cache/dist/storage/memory-storage/lfu-memory-storage.d.ts.map +0 -1
  211. package/packages/cache/dist/storage/memory-storage/lru-memory-storage.d.ts +0 -11
  212. package/packages/cache/dist/storage/memory-storage/lru-memory-storage.d.ts.map +0 -1
  213. package/packages/cache/dist/storage/memory-storage/memory-storage.d.ts +0 -13
  214. package/packages/cache/dist/storage/memory-storage/memory-storage.d.ts.map +0 -1
  215. package/packages/cache/dist/storage/memory-storage/random-memory-storage.d.ts +0 -11
  216. package/packages/cache/dist/storage/memory-storage/random-memory-storage.d.ts.map +0 -1
  217. package/packages/cache/dist/storage/memory-storage/ttl-memory-storage.d.ts +0 -11
  218. package/packages/cache/dist/storage/memory-storage/ttl-memory-storage.d.ts.map +0 -1
  219. package/packages/cache/dist/storage/memory-storage/types/index.d.ts +0 -3
  220. package/packages/cache/dist/storage/memory-storage/types/index.d.ts.map +0 -1
  221. package/packages/cache/dist/storage/memory-storage/types/memory-storage-options.d.ts +0 -9
  222. package/packages/cache/dist/storage/memory-storage/types/memory-storage-options.d.ts.map +0 -1
  223. package/packages/cache/dist/storage/memory-storage/types/memory-storage-size.d.ts +0 -13
  224. package/packages/cache/dist/storage/memory-storage/types/memory-storage-size.d.ts.map +0 -1
  225. package/packages/cache/dist/storage/memory-storage/utils/humanize-size.d.ts +0 -6
  226. package/packages/cache/dist/storage/memory-storage/utils/humanize-size.d.ts.map +0 -1
  227. package/packages/cache/dist/storage/memory-storage/utils/index.d.ts +0 -3
  228. package/packages/cache/dist/storage/memory-storage/utils/index.d.ts.map +0 -1
  229. package/packages/cache/dist/storage/memory-storage/utils/serialize-response-body.d.ts +0 -6
  230. package/packages/cache/dist/storage/memory-storage/utils/serialize-response-body.d.ts.map +0 -1
  231. package/packages/cache/dist/storage/multi-tier-storage/index.d.ts +0 -3
  232. package/packages/cache/dist/storage/multi-tier-storage/index.d.ts.map +0 -1
  233. package/packages/cache/dist/storage/multi-tier-storage/multi-tier-storage.d.ts +0 -36
  234. package/packages/cache/dist/storage/multi-tier-storage/multi-tier-storage.d.ts.map +0 -1
  235. package/packages/cache/dist/storage/multi-tier-storage/types/index.d.ts +0 -2
  236. package/packages/cache/dist/storage/multi-tier-storage/types/index.d.ts.map +0 -1
  237. package/packages/cache/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts +0 -5
  238. package/packages/cache/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts.map +0 -1
  239. package/packages/cache/dist/storage/tier-storage/index.d.ts +0 -3
  240. package/packages/cache/dist/storage/tier-storage/index.d.ts.map +0 -1
  241. package/packages/cache/dist/storage/tier-storage/tier-storage.d.ts +0 -15
  242. package/packages/cache/dist/storage/tier-storage/tier-storage.d.ts.map +0 -1
  243. package/packages/cache/dist/storage/tier-storage/types/index.d.ts +0 -2
  244. package/packages/cache/dist/storage/tier-storage/types/index.d.ts.map +0 -1
  245. package/packages/cache/dist/storage/tier-storage/types/tier-storage-options.d.ts +0 -21
  246. package/packages/cache/dist/storage/tier-storage/types/tier-storage-options.d.ts.map +0 -1
  247. package/packages/cache/dist/strategies/cache-first.d.ts +0 -3
  248. package/packages/cache/dist/strategies/cache-first.d.ts.map +0 -1
  249. package/packages/cache/dist/strategies/index.d.ts +0 -5
  250. package/packages/cache/dist/strategies/index.d.ts.map +0 -1
  251. package/packages/cache/dist/strategies/network-first.d.ts +0 -3
  252. package/packages/cache/dist/strategies/network-first.d.ts.map +0 -1
  253. package/packages/cache/dist/strategies/network-only.d.ts +0 -3
  254. package/packages/cache/dist/strategies/network-only.d.ts.map +0 -1
  255. package/packages/cache/dist/strategies/stale-while-revalidate.d.ts +0 -3
  256. package/packages/cache/dist/strategies/stale-while-revalidate.d.ts.map +0 -1
  257. package/packages/cache/dist/types/index.d.ts +0 -6
  258. package/packages/cache/dist/types/index.d.ts.map +0 -1
  259. package/packages/cache/dist/types/keq-cache-key.d.ts +0 -4
  260. package/packages/cache/dist/types/keq-cache-key.d.ts.map +0 -1
  261. package/packages/cache/dist/types/keq-cache-pattern.d.ts +0 -3
  262. package/packages/cache/dist/types/keq-cache-pattern.d.ts.map +0 -1
  263. package/packages/cache/dist/types/keq-cache-rule.d.ts +0 -6
  264. package/packages/cache/dist/types/keq-cache-rule.d.ts.map +0 -1
  265. package/packages/cache/dist/types/keq-cache-strategy.d.ts +0 -6
  266. package/packages/cache/dist/types/keq-cache-strategy.d.ts.map +0 -1
  267. package/packages/cache/dist/types/request-cache-options.d.ts +0 -34
  268. package/packages/cache/dist/types/request-cache-options.d.ts.map +0 -1
  269. package/packages/cache/dist/utils/get-response-bytes.d.ts +0 -2
  270. package/packages/cache/dist/utils/get-response-bytes.d.ts.map +0 -1
  271. package/packages/cache/dist/utils/index.d.ts +0 -4
  272. package/packages/cache/dist/utils/index.d.ts.map +0 -1
  273. package/packages/cache/dist/utils/logger.d.ts +0 -5
  274. package/packages/cache/dist/utils/logger.d.ts.map +0 -1
  275. package/packages/cache/dist/utils/random.d.ts +0 -2
  276. package/packages/cache/dist/utils/random.d.ts.map +0 -1
  277. package/packages/cli/dist/cli.d.ts +0 -3
  278. package/packages/cli/dist/cli.d.ts.map +0 -1
  279. package/packages/cli/dist/cli.js +0 -2899
  280. package/packages/cli/dist/cli.js.map +0 -1
  281. package/packages/cli/dist/compiler/compiler.d.ts +0 -17
  282. package/packages/cli/dist/compiler/compiler.d.ts.map +0 -1
  283. package/packages/cli/dist/compiler/index.d.ts +0 -4
  284. package/packages/cli/dist/compiler/index.d.ts.map +0 -1
  285. package/packages/cli/dist/compiler/intercepter/index.d.ts +0 -3
  286. package/packages/cli/dist/compiler/intercepter/index.d.ts.map +0 -1
  287. package/packages/cli/dist/compiler/intercepter/perfect-error-message.d.ts +0 -3
  288. package/packages/cli/dist/compiler/intercepter/perfect-error-message.d.ts.map +0 -1
  289. package/packages/cli/dist/compiler/intercepter/print-information.d.ts +0 -5
  290. package/packages/cli/dist/compiler/intercepter/print-information.d.ts.map +0 -1
  291. package/packages/cli/dist/compiler/tasks/compile/index.d.ts +0 -6
  292. package/packages/cli/dist/compiler/tasks/compile/index.d.ts.map +0 -1
  293. package/packages/cli/dist/compiler/tasks/download/index.d.ts +0 -10
  294. package/packages/cli/dist/compiler/tasks/download/index.d.ts.map +0 -1
  295. package/packages/cli/dist/compiler/tasks/index.d.ts +0 -6
  296. package/packages/cli/dist/compiler/tasks/index.d.ts.map +0 -1
  297. package/packages/cli/dist/compiler/tasks/persist/index.d.ts +0 -5
  298. package/packages/cli/dist/compiler/tasks/persist/index.d.ts.map +0 -1
  299. package/packages/cli/dist/compiler/tasks/setup/index.d.ts +0 -15
  300. package/packages/cli/dist/compiler/tasks/setup/index.d.ts.map +0 -1
  301. package/packages/cli/dist/compiler/tasks/setup/utils/find-nearest-package-json.d.ts +0 -6
  302. package/packages/cli/dist/compiler/tasks/setup/utils/find-nearest-package-json.d.ts.map +0 -1
  303. package/packages/cli/dist/compiler/tasks/setup/utils/get-project-module-system.d.ts +0 -5
  304. package/packages/cli/dist/compiler/tasks/setup/utils/get-project-module-system.d.ts.map +0 -1
  305. package/packages/cli/dist/compiler/tasks/setup/utils/index.d.ts +0 -4
  306. package/packages/cli/dist/compiler/tasks/setup/utils/index.d.ts.map +0 -1
  307. package/packages/cli/dist/compiler/tasks/setup/utils/validate-modules.d.ts +0 -2
  308. package/packages/cli/dist/compiler/tasks/setup/utils/validate-modules.d.ts.map +0 -1
  309. package/packages/cli/dist/compiler/tasks/types/base-task-options.d.ts +0 -6
  310. package/packages/cli/dist/compiler/tasks/types/base-task-options.d.ts.map +0 -1
  311. package/packages/cli/dist/compiler/tasks/types/index.d.ts +0 -3
  312. package/packages/cli/dist/compiler/tasks/types/index.d.ts.map +0 -1
  313. package/packages/cli/dist/compiler/tasks/types/task-wrapper.d.ts +0 -4
  314. package/packages/cli/dist/compiler/tasks/types/task-wrapper.d.ts.map +0 -1
  315. package/packages/cli/dist/compiler/types/compiler-context.d.ts +0 -11
  316. package/packages/cli/dist/compiler/types/compiler-context.d.ts.map +0 -1
  317. package/packages/cli/dist/compiler/types/compiler-hooks.d.ts +0 -18
  318. package/packages/cli/dist/compiler/types/compiler-hooks.d.ts.map +0 -1
  319. package/packages/cli/dist/compiler/types/index.d.ts +0 -3
  320. package/packages/cli/dist/compiler/types/index.d.ts.map +0 -1
  321. package/packages/cli/dist/constants/file-naming-style.d.ts +0 -14
  322. package/packages/cli/dist/constants/file-naming-style.d.ts.map +0 -1
  323. package/packages/cli/dist/constants/index.d.ts +0 -4
  324. package/packages/cli/dist/constants/index.d.ts.map +0 -1
  325. package/packages/cli/dist/constants/qs-array-format.d.ts +0 -9
  326. package/packages/cli/dist/constants/qs-array-format.d.ts.map +0 -1
  327. package/packages/cli/dist/constants/supported-methods.d.ts +0 -2
  328. package/packages/cli/dist/constants/supported-methods.d.ts.map +0 -1
  329. package/packages/cli/dist/define-keq-config.d.ts +0 -3
  330. package/packages/cli/dist/define-keq-config.d.ts.map +0 -1
  331. package/packages/cli/dist/exception.d.ts +0 -6
  332. package/packages/cli/dist/exception.d.ts.map +0 -1
  333. package/packages/cli/dist/generators/index.d.ts +0 -2
  334. package/packages/cli/dist/generators/index.d.ts.map +0 -1
  335. package/packages/cli/dist/index.d.ts +0 -6
  336. package/packages/cli/dist/index.d.ts.map +0 -1
  337. package/packages/cli/dist/index.js +0 -2808
  338. package/packages/cli/dist/index.js.map +0 -1
  339. package/packages/cli/dist/models/anchor.d.ts +0 -20
  340. package/packages/cli/dist/models/anchor.d.ts.map +0 -1
  341. package/packages/cli/dist/models/api-document_v3_1.d.ts +0 -16
  342. package/packages/cli/dist/models/api-document_v3_1.d.ts.map +0 -1
  343. package/packages/cli/dist/models/artifact.d.ts +0 -17
  344. package/packages/cli/dist/models/artifact.d.ts.map +0 -1
  345. package/packages/cli/dist/models/asset.d.ts +0 -5
  346. package/packages/cli/dist/models/asset.d.ts.map +0 -1
  347. package/packages/cli/dist/models/index.d.ts +0 -8
  348. package/packages/cli/dist/models/index.d.ts.map +0 -1
  349. package/packages/cli/dist/models/module-definition.d.ts +0 -7
  350. package/packages/cli/dist/models/module-definition.d.ts.map +0 -1
  351. package/packages/cli/dist/models/operation-definition.d.ts +0 -23
  352. package/packages/cli/dist/models/operation-definition.d.ts.map +0 -1
  353. package/packages/cli/dist/models/schema-definition.d.ts +0 -20
  354. package/packages/cli/dist/models/schema-definition.d.ts.map +0 -1
  355. package/packages/cli/dist/models/utils/to-comment.d.ts +0 -2
  356. package/packages/cli/dist/models/utils/to-comment.d.ts.map +0 -1
  357. package/packages/cli/dist/plugins/body-fallback/index.d.ts +0 -6
  358. package/packages/cli/dist/plugins/body-fallback/index.d.ts.map +0 -1
  359. package/packages/cli/dist/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.d.ts +0 -5
  360. package/packages/cli/dist/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.d.ts.map +0 -1
  361. package/packages/cli/dist/plugins/chinese-to-pinyin/index.d.ts +0 -2
  362. package/packages/cli/dist/plugins/chinese-to-pinyin/index.d.ts.map +0 -1
  363. package/packages/cli/dist/plugins/download-http-file/download-http-file.plugin.d.ts +0 -8
  364. package/packages/cli/dist/plugins/download-http-file/download-http-file.plugin.d.ts.map +0 -1
  365. package/packages/cli/dist/plugins/download-http-file/index.d.ts +0 -2
  366. package/packages/cli/dist/plugins/download-http-file/index.d.ts.map +0 -1
  367. package/packages/cli/dist/plugins/download-local-file/download-local-file.plugin.d.ts +0 -6
  368. package/packages/cli/dist/plugins/download-local-file/download-local-file.plugin.d.ts.map +0 -1
  369. package/packages/cli/dist/plugins/download-local-file/index.d.ts +0 -2
  370. package/packages/cli/dist/plugins/download-local-file/index.d.ts.map +0 -1
  371. package/packages/cli/dist/plugins/eslint/index.d.ts +0 -15
  372. package/packages/cli/dist/plugins/eslint/index.d.ts.map +0 -1
  373. package/packages/cli/dist/plugins/generate-declaration/constants/index.d.ts +0 -2
  374. package/packages/cli/dist/plugins/generate-declaration/constants/index.d.ts.map +0 -1
  375. package/packages/cli/dist/plugins/generate-declaration/constants/metadata-storage.d.ts +0 -12
  376. package/packages/cli/dist/plugins/generate-declaration/constants/metadata-storage.d.ts.map +0 -1
  377. package/packages/cli/dist/plugins/generate-declaration/generate-declaration.plugin.d.ts +0 -15
  378. package/packages/cli/dist/plugins/generate-declaration/generate-declaration.plugin.d.ts.map +0 -1
  379. package/packages/cli/dist/plugins/generate-declaration/generators/index.d.ts +0 -3
  380. package/packages/cli/dist/plugins/generate-declaration/generators/index.d.ts.map +0 -1
  381. package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/index.d.ts +0 -2
  382. package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/index.d.ts.map +0 -1
  383. package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/operation.generator.d.ts +0 -15
  384. package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/operation.generator.d.ts.map +0 -1
  385. package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/index.d.ts +0 -2
  386. package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/index.d.ts.map +0 -1
  387. package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/schema.generator.d.ts +0 -15
  388. package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/schema.generator.d.ts.map +0 -1
  389. package/packages/cli/dist/plugins/generate-declaration/index.d.ts +0 -3
  390. package/packages/cli/dist/plugins/generate-declaration/index.d.ts.map +0 -1
  391. package/packages/cli/dist/plugins/generate-micro-function/constants/index.d.ts +0 -2
  392. package/packages/cli/dist/plugins/generate-micro-function/constants/index.d.ts.map +0 -1
  393. package/packages/cli/dist/plugins/generate-micro-function/constants/metadata-storage.d.ts +0 -11
  394. package/packages/cli/dist/plugins/generate-micro-function/constants/metadata-storage.d.ts.map +0 -1
  395. package/packages/cli/dist/plugins/generate-micro-function/generate-micro-function.plugin.d.ts +0 -11
  396. package/packages/cli/dist/plugins/generate-micro-function/generate-micro-function.plugin.d.ts.map +0 -1
  397. package/packages/cli/dist/plugins/generate-micro-function/generators/index.d.ts +0 -3
  398. package/packages/cli/dist/plugins/generate-micro-function/generators/index.d.ts.map +0 -1
  399. package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/index.d.ts +0 -2
  400. package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/index.d.ts.map +0 -1
  401. package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/micro-function.generator.d.ts +0 -15
  402. package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/micro-function.generator.d.ts.map +0 -1
  403. package/packages/cli/dist/plugins/generate-micro-function/generators/request/index.d.ts +0 -2
  404. package/packages/cli/dist/plugins/generate-micro-function/generators/request/index.d.ts.map +0 -1
  405. package/packages/cli/dist/plugins/generate-micro-function/generators/request/request.generator.d.ts +0 -11
  406. package/packages/cli/dist/plugins/generate-micro-function/generators/request/request.generator.d.ts.map +0 -1
  407. package/packages/cli/dist/plugins/generate-micro-function/index.d.ts +0 -3
  408. package/packages/cli/dist/plugins/generate-micro-function/index.d.ts.map +0 -1
  409. package/packages/cli/dist/plugins/generate-nestjs-module/constants/index.d.ts +0 -2
  410. package/packages/cli/dist/plugins/generate-nestjs-module/constants/index.d.ts.map +0 -1
  411. package/packages/cli/dist/plugins/generate-nestjs-module/constants/metadata-storage.d.ts +0 -10
  412. package/packages/cli/dist/plugins/generate-nestjs-module/constants/metadata-storage.d.ts.map +0 -1
  413. package/packages/cli/dist/plugins/generate-nestjs-module/generate-nestjs-module.d.ts +0 -10
  414. package/packages/cli/dist/plugins/generate-nestjs-module/generate-nestjs-module.d.ts.map +0 -1
  415. package/packages/cli/dist/plugins/generate-nestjs-module/generators/index.d.ts +0 -2
  416. package/packages/cli/dist/plugins/generate-nestjs-module/generators/index.d.ts.map +0 -1
  417. package/packages/cli/dist/plugins/generate-nestjs-module/generators/nestjs-module.generator.d.ts +0 -14
  418. package/packages/cli/dist/plugins/generate-nestjs-module/generators/nestjs-module.generator.d.ts.map +0 -1
  419. package/packages/cli/dist/plugins/generate-nestjs-module/index.d.ts +0 -3
  420. package/packages/cli/dist/plugins/generate-nestjs-module/index.d.ts.map +0 -1
  421. package/packages/cli/dist/plugins/index.d.ts +0 -15
  422. package/packages/cli/dist/plugins/index.d.ts.map +0 -1
  423. package/packages/cli/dist/plugins/initialize/index.d.ts +0 -2
  424. package/packages/cli/dist/plugins/initialize/index.d.ts.map +0 -1
  425. package/packages/cli/dist/plugins/initialize/initialize.plugin.d.ts +0 -15
  426. package/packages/cli/dist/plugins/initialize/initialize.plugin.d.ts.map +0 -1
  427. package/packages/cli/dist/plugins/overwrite-operation-id/index.d.ts +0 -2
  428. package/packages/cli/dist/plugins/overwrite-operation-id/index.d.ts.map +0 -1
  429. package/packages/cli/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts +0 -20
  430. package/packages/cli/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts.map +0 -1
  431. package/packages/cli/dist/plugins/overwrite-query-options/index.d.ts +0 -2
  432. package/packages/cli/dist/plugins/overwrite-query-options/index.d.ts.map +0 -1
  433. package/packages/cli/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts +0 -18
  434. package/packages/cli/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts.map +0 -1
  435. package/packages/cli/dist/plugins/prettier/index.d.ts +0 -2
  436. package/packages/cli/dist/plugins/prettier/index.d.ts.map +0 -1
  437. package/packages/cli/dist/plugins/prettier/prettier.plugin.d.ts +0 -6
  438. package/packages/cli/dist/plugins/prettier/prettier.plugin.d.ts.map +0 -1
  439. package/packages/cli/dist/plugins/shaking/index.d.ts +0 -2
  440. package/packages/cli/dist/plugins/shaking/index.d.ts.map +0 -1
  441. package/packages/cli/dist/plugins/shaking/shaking.plugin.d.ts +0 -8
  442. package/packages/cli/dist/plugins/shaking/shaking.plugin.d.ts.map +0 -1
  443. package/packages/cli/dist/plugins/terminal-select/index.d.ts +0 -2
  444. package/packages/cli/dist/plugins/terminal-select/index.d.ts.map +0 -1
  445. package/packages/cli/dist/plugins/terminal-select/terminal-select.plugin.d.ts +0 -18
  446. package/packages/cli/dist/plugins/terminal-select/terminal-select.plugin.d.ts.map +0 -1
  447. package/packages/cli/dist/plugins/terminal-select/types/ignore-mode.d.ts +0 -2
  448. package/packages/cli/dist/plugins/terminal-select/types/ignore-mode.d.ts.map +0 -1
  449. package/packages/cli/dist/plugins/terminal-select/types/index.d.ts +0 -2
  450. package/packages/cli/dist/plugins/terminal-select/types/index.d.ts.map +0 -1
  451. package/packages/cli/dist/plugins/terminal-select/utils/index.d.ts +0 -2
  452. package/packages/cli/dist/plugins/terminal-select/utils/index.d.ts.map +0 -1
  453. package/packages/cli/dist/plugins/terminal-select/utils/select-operation-definitions.d.ts +0 -5
  454. package/packages/cli/dist/plugins/terminal-select/utils/select-operation-definitions.d.ts.map +0 -1
  455. package/packages/cli/dist/plugins.cjs.map +0 -1
  456. package/packages/cli/dist/plugins.js +0 -2365
  457. package/packages/cli/dist/plugins.js.map +0 -1
  458. package/packages/cli/dist/transformers/api-document/api-document.transformer.d.ts +0 -8
  459. package/packages/cli/dist/transformers/api-document/api-document.transformer.d.ts.map +0 -1
  460. package/packages/cli/dist/transformers/api-document/index.d.ts +0 -2
  461. package/packages/cli/dist/transformers/api-document/index.d.ts.map +0 -1
  462. package/packages/cli/dist/transformers/api-document/nestjs-client.renderer.d.ts +0 -14
  463. package/packages/cli/dist/transformers/api-document/nestjs-client.renderer.d.ts.map +0 -1
  464. package/packages/cli/dist/transformers/api-document/nestjs-module.renderer.d.ts +0 -12
  465. package/packages/cli/dist/transformers/api-document/nestjs-module.renderer.d.ts.map +0 -1
  466. package/packages/cli/dist/transformers/entrypoint/entrypoint.transformer.d.ts +0 -10
  467. package/packages/cli/dist/transformers/entrypoint/entrypoint.transformer.d.ts.map +0 -1
  468. package/packages/cli/dist/transformers/entrypoint/index.d.ts +0 -2
  469. package/packages/cli/dist/transformers/entrypoint/index.d.ts.map +0 -1
  470. package/packages/cli/dist/transformers/index.d.ts +0 -6
  471. package/packages/cli/dist/transformers/index.d.ts.map +0 -1
  472. package/packages/cli/dist/transformers/json-schema/comment.renderer.d.ts +0 -8
  473. package/packages/cli/dist/transformers/json-schema/comment.renderer.d.ts.map +0 -1
  474. package/packages/cli/dist/transformers/json-schema/declaration.renderer.d.ts +0 -26
  475. package/packages/cli/dist/transformers/json-schema/declaration.renderer.d.ts.map +0 -1
  476. package/packages/cli/dist/transformers/json-schema/index.d.ts +0 -4
  477. package/packages/cli/dist/transformers/json-schema/index.d.ts.map +0 -1
  478. package/packages/cli/dist/transformers/json-schema/json-schema.transformer.d.ts +0 -7
  479. package/packages/cli/dist/transformers/json-schema/json-schema.transformer.d.ts.map +0 -1
  480. package/packages/cli/dist/transformers/json-schema/reference.transformer.d.ts +0 -5
  481. package/packages/cli/dist/transformers/json-schema/reference.transformer.d.ts.map +0 -1
  482. package/packages/cli/dist/transformers/json-schema/types/any-other-attribute.d.ts +0 -5
  483. package/packages/cli/dist/transformers/json-schema/types/any-other-attribute.d.ts.map +0 -1
  484. package/packages/cli/dist/transformers/json-schema/types/index.d.ts +0 -3
  485. package/packages/cli/dist/transformers/json-schema/types/index.d.ts.map +0 -1
  486. package/packages/cli/dist/transformers/json-schema/types/mixed-schema-object.d.ts +0 -7
  487. package/packages/cli/dist/transformers/json-schema/types/mixed-schema-object.d.ts.map +0 -1
  488. package/packages/cli/dist/transformers/operation-definition/comment.renderer.d.ts +0 -8
  489. package/packages/cli/dist/transformers/operation-definition/comment.renderer.d.ts.map +0 -1
  490. package/packages/cli/dist/transformers/operation-definition/declaration.renderer.d.ts +0 -20
  491. package/packages/cli/dist/transformers/operation-definition/declaration.renderer.d.ts.map +0 -1
  492. package/packages/cli/dist/transformers/operation-definition/index.d.ts +0 -3
  493. package/packages/cli/dist/transformers/operation-definition/index.d.ts.map +0 -1
  494. package/packages/cli/dist/transformers/operation-definition/micro-function.renderer.d.ts +0 -19
  495. package/packages/cli/dist/transformers/operation-definition/micro-function.renderer.d.ts.map +0 -1
  496. package/packages/cli/dist/transformers/operation-definition/nestjs-method.renderer.d.ts +0 -15
  497. package/packages/cli/dist/transformers/operation-definition/nestjs-method.renderer.d.ts.map +0 -1
  498. package/packages/cli/dist/transformers/operation-definition/operation-definition.transformer.d.ts +0 -11
  499. package/packages/cli/dist/transformers/operation-definition/operation-definition.transformer.d.ts.map +0 -1
  500. package/packages/cli/dist/transformers/operation-definition/typescript-snippet.d.ts +0 -22
  501. package/packages/cli/dist/transformers/operation-definition/typescript-snippet.d.ts.map +0 -1
  502. package/packages/cli/dist/transformers/operation-definition/utils/index.d.ts +0 -2
  503. package/packages/cli/dist/transformers/operation-definition/utils/index.d.ts.map +0 -1
  504. package/packages/cli/dist/transformers/operation-definition/utils/type-name-factory.d.ts +0 -4
  505. package/packages/cli/dist/transformers/operation-definition/utils/type-name-factory.d.ts.map +0 -1
  506. package/packages/cli/dist/transformers/schema-definition/index.d.ts +0 -2
  507. package/packages/cli/dist/transformers/schema-definition/index.d.ts.map +0 -1
  508. package/packages/cli/dist/transformers/schema-definition/schema-definition.transformer.d.ts +0 -10
  509. package/packages/cli/dist/transformers/schema-definition/schema-definition.transformer.d.ts.map +0 -1
  510. package/packages/cli/dist/transformers/types/renderer.d.ts +0 -4
  511. package/packages/cli/dist/transformers/types/renderer.d.ts.map +0 -1
  512. package/packages/cli/dist/types/build-cli-options.d.ts +0 -19
  513. package/packages/cli/dist/types/build-cli-options.d.ts.map +0 -1
  514. package/packages/cli/dist/types/generator.d.ts +0 -7
  515. package/packages/cli/dist/types/generator.d.ts.map +0 -1
  516. package/packages/cli/dist/types/index.d.ts +0 -6
  517. package/packages/cli/dist/types/index.d.ts.map +0 -1
  518. package/packages/cli/dist/types/plugin.d.ts +0 -5
  519. package/packages/cli/dist/types/plugin.d.ts.map +0 -1
  520. package/packages/cli/dist/types/runtime-config.d.ts +0 -32
  521. package/packages/cli/dist/types/runtime-config.d.ts.map +0 -1
  522. package/packages/cli/dist/types/to-code-options.d.ts +0 -4
  523. package/packages/cli/dist/types/to-code-options.d.ts.map +0 -1
  524. package/packages/cli/dist/utils/debugger.d.ts +0 -7
  525. package/packages/cli/dist/utils/debugger.d.ts.map +0 -1
  526. package/packages/cli/dist/utils/ignore-matcher.d.ts +0 -18
  527. package/packages/cli/dist/utils/ignore-matcher.d.ts.map +0 -1
  528. package/packages/cli/dist/utils/indent.d.ts +0 -2
  529. package/packages/cli/dist/utils/indent.d.ts.map +0 -1
  530. package/packages/cli/dist/utils/is-keywords.d.ts +0 -2
  531. package/packages/cli/dist/utils/is-keywords.d.ts.map +0 -1
  532. package/packages/cli/dist/utils/is-reserved-word.d.ts +0 -2
  533. package/packages/cli/dist/utils/is-reserved-word.d.ts.map +0 -1
  534. package/packages/cli/dist/utils/json-schema-utils/index.d.ts +0 -11
  535. package/packages/cli/dist/utils/json-schema-utils/index.d.ts.map +0 -1
  536. package/packages/cli/dist/utils/json-schema-utils/is-array.d.ts +0 -3
  537. package/packages/cli/dist/utils/json-schema-utils/is-array.d.ts.map +0 -1
  538. package/packages/cli/dist/utils/json-schema-utils/is-mixed.d.ts +0 -4
  539. package/packages/cli/dist/utils/json-schema-utils/is-mixed.d.ts.map +0 -1
  540. package/packages/cli/dist/utils/json-schema-utils/is-non-array.d.ts +0 -3
  541. package/packages/cli/dist/utils/json-schema-utils/is-non-array.d.ts.map +0 -1
  542. package/packages/cli/dist/utils/json-schema-utils/is-ref.d.ts +0 -3
  543. package/packages/cli/dist/utils/json-schema-utils/is-ref.d.ts.map +0 -1
  544. package/packages/cli/dist/utils/json-schema-utils/types/any-other-attribute.d.ts +0 -5
  545. package/packages/cli/dist/utils/json-schema-utils/types/any-other-attribute.d.ts.map +0 -1
  546. package/packages/cli/dist/utils/json-schema-utils/types/mixed-schema-object.d.ts +0 -7
  547. package/packages/cli/dist/utils/json-schema-utils/types/mixed-schema-object.d.ts.map +0 -1
  548. package/packages/cli/dist/utils/logger.d.ts +0 -6
  549. package/packages/cli/dist/utils/logger.d.ts.map +0 -1
  550. package/packages/cli/dist/utils/openapi-utils/dereference-deep.d.ts +0 -3
  551. package/packages/cli/dist/utils/openapi-utils/dereference-deep.d.ts.map +0 -1
  552. package/packages/cli/dist/utils/openapi-utils/dereference-operation.d.ts +0 -4
  553. package/packages/cli/dist/utils/openapi-utils/dereference-operation.d.ts.map +0 -1
  554. package/packages/cli/dist/utils/openapi-utils/dereference.d.ts +0 -3
  555. package/packages/cli/dist/utils/openapi-utils/dereference.d.ts.map +0 -1
  556. package/packages/cli/dist/utils/openapi-utils/index.d.ts +0 -19
  557. package/packages/cli/dist/utils/openapi-utils/index.d.ts.map +0 -1
  558. package/packages/cli/dist/utils/openapi-utils/is-ref-defined.d.ts +0 -3
  559. package/packages/cli/dist/utils/openapi-utils/is-ref-defined.d.ts.map +0 -1
  560. package/packages/cli/dist/utils/openapi-utils/map-operation.d.ts +0 -4
  561. package/packages/cli/dist/utils/openapi-utils/map-operation.d.ts.map +0 -1
  562. package/packages/cli/dist/utils/openapi-utils/map-parameter.d.ts +0 -4
  563. package/packages/cli/dist/utils/openapi-utils/map-parameter.d.ts.map +0 -1
  564. package/packages/cli/dist/utils/openapi-utils/remove-undefined-ref.d.ts +0 -3
  565. package/packages/cli/dist/utils/openapi-utils/remove-undefined-ref.d.ts.map +0 -1
  566. package/packages/cli/dist/utils/openapi-utils/to-3_1.d.ts +0 -3
  567. package/packages/cli/dist/utils/openapi-utils/to-3_1.d.ts.map +0 -1
  568. package/packages/exception/dist/plugins/index.d.mts +0 -12
  569. package/packages/exception/dist/plugins/index.d.ts +0 -12
  570. package/packages/exception/dist/plugins/index.js +0 -95
  571. package/packages/exception/dist/plugins/index.mjs +0 -68
  572. package/packages/exception/node_modules/.bin/keq +0 -21
  573. package/packages/keq/dist/context/execution-context.d.ts +0 -26
  574. package/packages/keq/dist/context/execution-context.d.ts.map +0 -1
  575. package/packages/keq/dist/context/index.d.ts +0 -5
  576. package/packages/keq/dist/context/index.d.ts.map +0 -1
  577. package/packages/keq/dist/context/middleware-context.d.ts +0 -11
  578. package/packages/keq/dist/context/middleware-context.d.ts.map +0 -1
  579. package/packages/keq/dist/context/orchestrator-context.d.ts +0 -18
  580. package/packages/keq/dist/context/orchestrator-context.d.ts.map +0 -1
  581. package/packages/keq/dist/context/shared-context.d.ts +0 -43
  582. package/packages/keq/dist/context/shared-context.d.ts.map +0 -1
  583. package/packages/keq/dist/context/types/index.d.ts +0 -6
  584. package/packages/keq/dist/context/types/index.d.ts.map +0 -1
  585. package/packages/keq/dist/context/types/keq-context-data.d.ts +0 -7
  586. package/packages/keq/dist/context/types/keq-context-data.d.ts.map +0 -1
  587. package/packages/keq/dist/context/types/keq-context-emitter.d.ts +0 -35
  588. package/packages/keq/dist/context/types/keq-context-emitter.d.ts.map +0 -1
  589. package/packages/keq/dist/context/types/keq-context-options/index.d.ts +0 -6
  590. package/packages/keq/dist/context/types/keq-context-options/index.d.ts.map +0 -1
  591. package/packages/keq/dist/context/types/keq-context-options/keq-context-options.d.ts +0 -5
  592. package/packages/keq/dist/context/types/keq-context-options/keq-context-options.d.ts.map +0 -1
  593. package/packages/keq/dist/context/types/keq-context-options/keq-middleware-options.d.ts +0 -33
  594. package/packages/keq/dist/context/types/keq-context-options/keq-middleware-options.d.ts.map +0 -1
  595. package/packages/keq/dist/context/types/keq-context-options/keq-module-options.d.ts +0 -5
  596. package/packages/keq/dist/context/types/keq-context-options/keq-module-options.d.ts.map +0 -1
  597. package/packages/keq/dist/context/types/keq-context-options/keq-resolve-with-mode.d.ts +0 -2
  598. package/packages/keq/dist/context/types/keq-context-options/keq-resolve-with-mode.d.ts.map +0 -1
  599. package/packages/keq/dist/context/types/keq-context-options/keq-retry-options.d.ts +0 -9
  600. package/packages/keq/dist/context/types/keq-context-options/keq-retry-options.d.ts.map +0 -1
  601. package/packages/keq/dist/context/types/keq-context.d.ts +0 -17
  602. package/packages/keq/dist/context/types/keq-context.d.ts.map +0 -1
  603. package/packages/keq/dist/context/types/keq-global.d.ts +0 -7
  604. package/packages/keq/dist/context/types/keq-global.d.ts.map +0 -1
  605. package/packages/keq/dist/context/utils/assign-shared-context.d.ts +0 -3
  606. package/packages/keq/dist/context/utils/assign-shared-context.d.ts.map +0 -1
  607. package/packages/keq/dist/context/utils/clone-shared-context.d.ts +0 -3
  608. package/packages/keq/dist/context/utils/clone-shared-context.d.ts.map +0 -1
  609. package/packages/keq/dist/context/utils/create-proxy-response.d.ts +0 -2
  610. package/packages/keq/dist/context/utils/create-proxy-response.d.ts.map +0 -1
  611. package/packages/keq/dist/context/utils/fork.d.ts +0 -6
  612. package/packages/keq/dist/context/utils/fork.d.ts.map +0 -1
  613. package/packages/keq/dist/context/utils/index.d.ts +0 -5
  614. package/packages/keq/dist/context/utils/index.d.ts.map +0 -1
  615. package/packages/keq/dist/context/utils/watch-object.d.ts +0 -5
  616. package/packages/keq/dist/context/utils/watch-object.d.ts.map +0 -1
  617. package/packages/keq/dist/exception/abort.exception.d.ts +0 -4
  618. package/packages/keq/dist/exception/abort.exception.d.ts.map +0 -1
  619. package/packages/keq/dist/exception/exception.d.ts +0 -5
  620. package/packages/keq/dist/exception/exception.d.ts.map +0 -1
  621. package/packages/keq/dist/exception/http-exceptions/bad-gateway.exception.d.ts +0 -5
  622. package/packages/keq/dist/exception/http-exceptions/bad-gateway.exception.d.ts.map +0 -1
  623. package/packages/keq/dist/exception/http-exceptions/bad-request.exception.d.ts +0 -5
  624. package/packages/keq/dist/exception/http-exceptions/bad-request.exception.d.ts.map +0 -1
  625. package/packages/keq/dist/exception/http-exceptions/conflict.exception.d.ts +0 -5
  626. package/packages/keq/dist/exception/http-exceptions/conflict.exception.d.ts.map +0 -1
  627. package/packages/keq/dist/exception/http-exceptions/content-too-large.exception.d.ts +0 -5
  628. package/packages/keq/dist/exception/http-exceptions/content-too-large.exception.d.ts.map +0 -1
  629. package/packages/keq/dist/exception/http-exceptions/forbidden.exception.d.ts +0 -5
  630. package/packages/keq/dist/exception/http-exceptions/forbidden.exception.d.ts.map +0 -1
  631. package/packages/keq/dist/exception/http-exceptions/gateway-timeout.exception.d.ts +0 -5
  632. package/packages/keq/dist/exception/http-exceptions/gateway-timeout.exception.d.ts.map +0 -1
  633. package/packages/keq/dist/exception/http-exceptions/http-version-not-supported.exception.d.ts +0 -5
  634. package/packages/keq/dist/exception/http-exceptions/http-version-not-supported.exception.d.ts.map +0 -1
  635. package/packages/keq/dist/exception/http-exceptions/im-a-teapot.exception.d.ts +0 -5
  636. package/packages/keq/dist/exception/http-exceptions/im-a-teapot.exception.d.ts.map +0 -1
  637. package/packages/keq/dist/exception/http-exceptions/index.d.ts +0 -22
  638. package/packages/keq/dist/exception/http-exceptions/index.d.ts.map +0 -1
  639. package/packages/keq/dist/exception/http-exceptions/internal-server-error.exception.d.ts +0 -5
  640. package/packages/keq/dist/exception/http-exceptions/internal-server-error.exception.d.ts.map +0 -1
  641. package/packages/keq/dist/exception/http-exceptions/method-not-allowed.exception.d.ts +0 -5
  642. package/packages/keq/dist/exception/http-exceptions/method-not-allowed.exception.d.ts.map +0 -1
  643. package/packages/keq/dist/exception/http-exceptions/not-acceptable.exception.d.ts +0 -5
  644. package/packages/keq/dist/exception/http-exceptions/not-acceptable.exception.d.ts.map +0 -1
  645. package/packages/keq/dist/exception/http-exceptions/not-founded.exception.d.ts +0 -5
  646. package/packages/keq/dist/exception/http-exceptions/not-founded.exception.d.ts.map +0 -1
  647. package/packages/keq/dist/exception/http-exceptions/not-implemented.exception.d.ts +0 -5
  648. package/packages/keq/dist/exception/http-exceptions/not-implemented.exception.d.ts.map +0 -1
  649. package/packages/keq/dist/exception/http-exceptions/precondition-failed.exception.d.ts +0 -5
  650. package/packages/keq/dist/exception/http-exceptions/precondition-failed.exception.d.ts.map +0 -1
  651. package/packages/keq/dist/exception/http-exceptions/proxy-authentication-required.exception.d.ts +0 -5
  652. package/packages/keq/dist/exception/http-exceptions/proxy-authentication-required.exception.d.ts.map +0 -1
  653. package/packages/keq/dist/exception/http-exceptions/request-timeout.exception.d.ts +0 -5
  654. package/packages/keq/dist/exception/http-exceptions/request-timeout.exception.d.ts.map +0 -1
  655. package/packages/keq/dist/exception/http-exceptions/request.exception.d.ts +0 -12
  656. package/packages/keq/dist/exception/http-exceptions/request.exception.d.ts.map +0 -1
  657. package/packages/keq/dist/exception/http-exceptions/service-unavailable.exception.d.ts +0 -5
  658. package/packages/keq/dist/exception/http-exceptions/service-unavailable.exception.d.ts.map +0 -1
  659. package/packages/keq/dist/exception/http-exceptions/too-many-requests.exception.d.ts +0 -5
  660. package/packages/keq/dist/exception/http-exceptions/too-many-requests.exception.d.ts.map +0 -1
  661. package/packages/keq/dist/exception/http-exceptions/unauthorized.exception.d.ts +0 -5
  662. package/packages/keq/dist/exception/http-exceptions/unauthorized.exception.d.ts.map +0 -1
  663. package/packages/keq/dist/exception/http-exceptions/unsupported-media-type.exception.d.ts +0 -5
  664. package/packages/keq/dist/exception/http-exceptions/unsupported-media-type.exception.d.ts.map +0 -1
  665. package/packages/keq/dist/exception/http-exceptions/uri-too-long.exception.d.ts +0 -5
  666. package/packages/keq/dist/exception/http-exceptions/uri-too-long.exception.d.ts.map +0 -1
  667. package/packages/keq/dist/exception/index.d.ts +0 -6
  668. package/packages/keq/dist/exception/index.d.ts.map +0 -1
  669. package/packages/keq/dist/exception/timeout.exception.d.ts +0 -5
  670. package/packages/keq/dist/exception/timeout.exception.d.ts.map +0 -1
  671. package/packages/keq/dist/exception/type.exception.d.ts +0 -5
  672. package/packages/keq/dist/exception/type.exception.d.ts.map +0 -1
  673. package/packages/keq/dist/middleware/index.d.ts +0 -3
  674. package/packages/keq/dist/middleware/index.d.ts.map +0 -1
  675. package/packages/keq/dist/middleware/types/index.d.ts +0 -3
  676. package/packages/keq/dist/middleware/types/index.d.ts.map +0 -1
  677. package/packages/keq/dist/middleware/types/keq-middleware.d.ts +0 -8
  678. package/packages/keq/dist/middleware/types/keq-middleware.d.ts.map +0 -1
  679. package/packages/keq/dist/middleware/types/keq-next.d.ts +0 -2
  680. package/packages/keq/dist/middleware/types/keq-next.d.ts.map +0 -1
  681. package/packages/keq/dist/middleware/utils/compose-middleware.d.ts +0 -7
  682. package/packages/keq/dist/middleware/utils/compose-middleware.d.ts.map +0 -1
  683. package/packages/keq/dist/middleware/utils/get-middleware-name.d.ts +0 -3
  684. package/packages/keq/dist/middleware/utils/get-middleware-name.d.ts.map +0 -1
  685. package/packages/keq/dist/middleware/utils/index.d.ts +0 -3
  686. package/packages/keq/dist/middleware/utils/index.d.ts.map +0 -1
  687. package/packages/keq/dist/middlewares/fetch-middleware/index.d.ts +0 -6
  688. package/packages/keq/dist/middlewares/fetch-middleware/index.d.ts.map +0 -1
  689. package/packages/keq/dist/middlewares/flow-control-middleware/abort-flow-control-middleware.d.ts +0 -3
  690. package/packages/keq/dist/middlewares/flow-control-middleware/abort-flow-control-middleware.d.ts.map +0 -1
  691. package/packages/keq/dist/middlewares/flow-control-middleware/index.d.ts +0 -4
  692. package/packages/keq/dist/middlewares/flow-control-middleware/index.d.ts.map +0 -1
  693. package/packages/keq/dist/middlewares/flow-control-middleware/serial-flow-control-middleware.d.ts +0 -3
  694. package/packages/keq/dist/middlewares/flow-control-middleware/serial-flow-control-middleware.d.ts.map +0 -1
  695. package/packages/keq/dist/middlewares/flow-control-middleware/types/keq-flow-control.d.ts +0 -9
  696. package/packages/keq/dist/middlewares/flow-control-middleware/types/keq-flow-control.d.ts.map +0 -1
  697. package/packages/keq/dist/middlewares/index.d.ts +0 -4
  698. package/packages/keq/dist/middlewares/index.d.ts.map +0 -1
  699. package/packages/keq/dist/middlewares/timeout-middleware/index.d.ts +0 -6
  700. package/packages/keq/dist/middlewares/timeout-middleware/index.d.ts.map +0 -1
  701. package/packages/keq/dist/orchestrator/executor.d.ts +0 -13
  702. package/packages/keq/dist/orchestrator/executor.d.ts.map +0 -1
  703. package/packages/keq/dist/orchestrator/index.d.ts +0 -3
  704. package/packages/keq/dist/orchestrator/index.d.ts.map +0 -1
  705. package/packages/keq/dist/orchestrator/orchestrator.d.ts +0 -20
  706. package/packages/keq/dist/orchestrator/orchestrator.d.ts.map +0 -1
  707. package/packages/keq/dist/request/core.d.ts +0 -54
  708. package/packages/keq/dist/request/core.d.ts.map +0 -1
  709. package/packages/keq/dist/request/create-request.d.ts +0 -7
  710. package/packages/keq/dist/request/create-request.d.ts.map +0 -1
  711. package/packages/keq/dist/request/index.d.ts +0 -6
  712. package/packages/keq/dist/request/index.d.ts.map +0 -1
  713. package/packages/keq/dist/request/keq.d.ts +0 -120
  714. package/packages/keq/dist/request/keq.d.ts.map +0 -1
  715. package/packages/keq/dist/request/request.d.ts +0 -79
  716. package/packages/keq/dist/request/request.d.ts.map +0 -1
  717. package/packages/keq/dist/request/types/api-schema/api-schema-select.d.ts +0 -42
  718. package/packages/keq/dist/request/types/api-schema/api-schema-select.d.ts.map +0 -1
  719. package/packages/keq/dist/request/types/api-schema/api-schema.d.ts +0 -8
  720. package/packages/keq/dist/request/types/api-schema/api-schema.d.ts.map +0 -1
  721. package/packages/keq/dist/request/types/api-schema/default-operation.d.ts +0 -18
  722. package/packages/keq/dist/request/types/api-schema/default-operation.d.ts.map +0 -1
  723. package/packages/keq/dist/request/types/api-schema/extract-method-operations.d.ts +0 -31
  724. package/packages/keq/dist/request/types/api-schema/extract-method-operations.d.ts.map +0 -1
  725. package/packages/keq/dist/request/types/api-schema/index.d.ts +0 -6
  726. package/packages/keq/dist/request/types/api-schema/index.d.ts.map +0 -1
  727. package/packages/keq/dist/request/types/api-schema/operation.d.ts +0 -17
  728. package/packages/keq/dist/request/types/api-schema/operation.d.ts.map +0 -1
  729. package/packages/keq/dist/request/types/content-type.d.ts +0 -3
  730. package/packages/keq/dist/request/types/content-type.d.ts.map +0 -1
  731. package/packages/keq/dist/request/types/index.d.ts +0 -8
  732. package/packages/keq/dist/request/types/index.d.ts.map +0 -1
  733. package/packages/keq/dist/request/types/keq-attachable-file.d.ts +0 -2
  734. package/packages/keq/dist/request/types/keq-attachable-file.d.ts.map +0 -1
  735. package/packages/keq/dist/request/types/keq-param-value.d.ts +0 -3
  736. package/packages/keq/dist/request/types/keq-param-value.d.ts.map +0 -1
  737. package/packages/keq/dist/request/types/keq-query-options.d.ts +0 -7
  738. package/packages/keq/dist/request/types/keq-query-options.d.ts.map +0 -1
  739. package/packages/keq/dist/request/types/keq-query-value.d.ts +0 -8
  740. package/packages/keq/dist/request/types/keq-query-value.d.ts.map +0 -1
  741. package/packages/keq/dist/request/types/server-sent-event.d.ts +0 -3
  742. package/packages/keq/dist/request/types/server-sent-event.d.ts.map +0 -1
  743. package/packages/keq/dist/request/utils/fix-content-type.d.ts +0 -4
  744. package/packages/keq/dist/request/utils/fix-content-type.d.ts.map +0 -1
  745. package/packages/keq/dist/request/utils/get-location-id.d.ts +0 -2
  746. package/packages/keq/dist/request/utils/get-location-id.d.ts.map +0 -1
  747. package/packages/keq/dist/request/utils/index.d.ts +0 -7
  748. package/packages/keq/dist/request/utils/index.d.ts.map +0 -1
  749. package/packages/keq/dist/request/utils/intelligent-parse-response.d.ts +0 -2
  750. package/packages/keq/dist/request/utils/intelligent-parse-response.d.ts.map +0 -1
  751. package/packages/keq/dist/request/utils/merge-keq-request-body.d.ts +0 -3
  752. package/packages/keq/dist/request/utils/merge-keq-request-body.d.ts.map +0 -1
  753. package/packages/keq/dist/request/utils/query-stringify.d.ts +0 -3
  754. package/packages/keq/dist/request/utils/query-stringify.d.ts.map +0 -1
  755. package/packages/keq/dist/request/utils/resolve-with.d.ts +0 -3
  756. package/packages/keq/dist/request/utils/resolve-with.d.ts.map +0 -1
  757. package/packages/keq/dist/request-init/index.d.ts +0 -4
  758. package/packages/keq/dist/request-init/index.d.ts.map +0 -1
  759. package/packages/keq/dist/request-init/request-init.d.ts +0 -42
  760. package/packages/keq/dist/request-init/request-init.d.ts.map +0 -1
  761. package/packages/keq/dist/request-init/types/index.d.ts +0 -3
  762. package/packages/keq/dist/request-init/types/index.d.ts.map +0 -1
  763. package/packages/keq/dist/request-init/types/keq-body-init.d.ts +0 -2
  764. package/packages/keq/dist/request-init/types/keq-body-init.d.ts.map +0 -1
  765. package/packages/keq/dist/request-init/types/keq-request-method.d.ts +0 -2
  766. package/packages/keq/dist/request-init/types/keq-request-method.d.ts.map +0 -1
  767. package/packages/keq/dist/request-init/utils/assign-request-init.d.ts +0 -3
  768. package/packages/keq/dist/request-init/utils/assign-request-init.d.ts.map +0 -1
  769. package/packages/keq/dist/request-init/utils/clone-body.d.ts +0 -2
  770. package/packages/keq/dist/request-init/utils/clone-body.d.ts.map +0 -1
  771. package/packages/keq/dist/request-init/utils/clone-headers.d.ts +0 -2
  772. package/packages/keq/dist/request-init/utils/clone-headers.d.ts.map +0 -1
  773. package/packages/keq/dist/request-init/utils/clone-request-init.d.ts +0 -3
  774. package/packages/keq/dist/request-init/utils/clone-request-init.d.ts.map +0 -1
  775. package/packages/keq/dist/request-init/utils/compile-url.d.ts +0 -3
  776. package/packages/keq/dist/request-init/utils/compile-url.d.ts.map +0 -1
  777. package/packages/keq/dist/request-init/utils/index.d.ts +0 -7
  778. package/packages/keq/dist/request-init/utils/index.d.ts.map +0 -1
  779. package/packages/keq/dist/request-init/utils/to-form-data.d.ts +0 -2
  780. package/packages/keq/dist/request-init/utils/to-form-data.d.ts.map +0 -1
  781. package/packages/keq/dist/request-init/utils/to-url-search-params.d.ts +0 -2
  782. package/packages/keq/dist/request-init/utils/to-url-search-params.d.ts.map +0 -1
  783. package/packages/keq/dist/router/index.d.ts +0 -4
  784. package/packages/keq/dist/router/index.d.ts.map +0 -1
  785. package/packages/keq/dist/router/keq-host-route.d.ts +0 -3
  786. package/packages/keq/dist/router/keq-host-route.d.ts.map +0 -1
  787. package/packages/keq/dist/router/keq-location-route.d.ts +0 -3
  788. package/packages/keq/dist/router/keq-location-route.d.ts.map +0 -1
  789. package/packages/keq/dist/router/keq-method-route.d.ts +0 -3
  790. package/packages/keq/dist/router/keq-method-route.d.ts.map +0 -1
  791. package/packages/keq/dist/router/keq-module-route.d.ts +0 -3
  792. package/packages/keq/dist/router/keq-module-route.d.ts.map +0 -1
  793. package/packages/keq/dist/router/keq-pathname-route.d.ts +0 -3
  794. package/packages/keq/dist/router/keq-pathname-route.d.ts.map +0 -1
  795. package/packages/keq/dist/router/keq-router.d.ts +0 -32
  796. package/packages/keq/dist/router/keq-router.d.ts.map +0 -1
  797. package/packages/keq/dist/router/types/index.d.ts +0 -2
  798. package/packages/keq/dist/router/types/index.d.ts.map +0 -1
  799. package/packages/keq/dist/router/types/keq-route.d.ts +0 -7
  800. package/packages/keq/dist/router/types/keq-route.d.ts.map +0 -1
  801. package/packages/keq/dist/router/utils/compose-route.d.ts +0 -3
  802. package/packages/keq/dist/router/utils/compose-route.d.ts.map +0 -1
  803. package/packages/keq/dist/router/utils/index.d.ts +0 -2
  804. package/packages/keq/dist/router/utils/index.d.ts.map +0 -1
  805. package/packages/keq/dist/types/enabled-if-string-index.d.ts +0 -24
  806. package/packages/keq/dist/types/enabled-if-string-index.d.ts.map +0 -1
  807. package/packages/keq/dist/types/exclude-unknown-properties.d.ts +0 -19
  808. package/packages/keq/dist/types/exclude-unknown-properties.d.ts.map +0 -1
  809. package/packages/keq/dist/types/index-keys.d.ts +0 -18
  810. package/packages/keq/dist/types/index-keys.d.ts.map +0 -1
  811. package/packages/keq/dist/types/index.d.ts +0 -7
  812. package/packages/keq/dist/types/index.d.ts.map +0 -1
  813. package/packages/keq/dist/types/literal-keys.d.ts +0 -18
  814. package/packages/keq/dist/types/literal-keys.d.ts.map +0 -1
  815. package/packages/keq/dist/types/loose-nested-like.d.ts +0 -11
  816. package/packages/keq/dist/types/loose-nested-like.d.ts.map +0 -1
  817. package/packages/keq/dist/types/string-index-value-of.d.ts +0 -18
  818. package/packages/keq/dist/types/string-index-value-of.d.ts.map +0 -1
  819. package/packages/keq/dist/utils/base64.d.ts +0 -3
  820. package/packages/keq/dist/utils/base64.d.ts.map +0 -1
  821. package/packages/keq/dist/utils/index.d.ts +0 -4
  822. package/packages/keq/dist/utils/index.d.ts.map +0 -1
  823. package/packages/keq/dist/utils/shallow-clone.d.ts +0 -5
  824. package/packages/keq/dist/utils/shallow-clone.d.ts.map +0 -1
  825. package/packages/keq/dist/utils/sleep.d.ts +0 -2
  826. package/packages/keq/dist/utils/sleep.d.ts.map +0 -1
  827. package/packages/keq/dist/validator/index.d.ts +0 -2
  828. package/packages/keq/dist/validator/index.d.ts.map +0 -1
  829. package/packages/keq/dist/validator/validator.d.ts +0 -65
  830. package/packages/keq/dist/validator/validator.d.ts.map +0 -1
  831. package/packages/keq/node_modules/.bin/tsc +0 -21
  832. package/packages/keq/node_modules/.bin/tsserver +0 -21
  833. package/packages/nestjs/dist/keq.module-definition.d.ts +0 -3
  834. package/packages/nestjs/dist/keq.module-definition.d.ts.map +0 -1
  835. package/packages/nestjs/dist/keq.module.d.ts +0 -7
  836. package/packages/nestjs/dist/keq.module.d.ts.map +0 -1
  837. package/packages/nestjs/dist/types/index.d.ts +0 -2
  838. package/packages/nestjs/dist/types/index.d.ts.map +0 -1
  839. package/packages/nestjs/dist/types/keq-module-options.d.ts +0 -5
  840. package/packages/nestjs/dist/types/keq-module-options.d.ts.map +0 -1
  841. package/packages/nestjs/node_modules/.bin/tsc +0 -21
  842. package/packages/nestjs/node_modules/.bin/tsserver +0 -21
@@ -0,0 +1,3280 @@
1
+ import { t as logger } from "./logger-QLBHySQ3.mjs";
2
+ import { AsyncSeriesWaterfallHook } from "tapable";
3
+ import fs from "fs-extra";
4
+ import * as path$1 from "path";
5
+ import * as R from "ramda";
6
+ import { ESLint } from "eslint";
7
+ import { exec } from "child_process";
8
+ import { promisify } from "util";
9
+ import * as changeCase from "change-case";
10
+ import { JSONPath } from "jsonpath-plus";
11
+ import jsonpointer from "jsonpointer";
12
+ import { upgrade } from "@scalar/openapi-parser";
13
+ import { CustomError } from "ts-custom-error";
14
+ import wrap from "word-wrap";
15
+ import { fixSwagger } from "swagger-fix";
16
+ import * as fs$1 from "fs/promises";
17
+ import * as yaml from "js-yaml";
18
+ import { fileURLToPath } from "url";
19
+ import { openapiShakingSync } from "@opendoc/openapi-shaking";
20
+ import { select } from "inquirer-select-pro";
21
+ import { ListrInquirerPromptAdapter } from "@listr2/prompt-adapter-inquirer";
22
+ import Ajv2020 from "ajv/dist/2020.js";
23
+ //#region src/constants/qs-array-format.ts
24
+ let QsArrayFormat = /* @__PURE__ */ function(QsArrayFormat) {
25
+ QsArrayFormat["brackets"] = "brackets";
26
+ QsArrayFormat["indices"] = "indices";
27
+ QsArrayFormat["repeat"] = "repeat";
28
+ QsArrayFormat["comma"] = "comma";
29
+ QsArrayFormat["space"] = "space";
30
+ QsArrayFormat["pipe"] = "pipe";
31
+ return QsArrayFormat;
32
+ }({});
33
+ //#endregion
34
+ //#region src/constants/supported-methods.ts
35
+ const SupportedMethods = [
36
+ "get",
37
+ "post",
38
+ "put",
39
+ "delete",
40
+ "patch",
41
+ "head",
42
+ "options"
43
+ ];
44
+ //#endregion
45
+ //#region src/models/plugin-metadata-storage.ts
46
+ /**
47
+ * A WeakMap-backed metadata storage for plugins.
48
+ *
49
+ * When a `key` is provided, the underlying WeakMap is stored in `globalThis` via
50
+ * `Symbol.for(key)`, ensuring the same instance is shared across CJS and ESM module
51
+ * boundaries. This is required for plugins that are imported by user config files
52
+ * (e.g. via `@keq-request/cli/plugins`) and need to interoperate with the CLI's
53
+ * internal plugins.
54
+ *
55
+ * When no `key` is provided, a plain `new WeakMap()` is used, which is sufficient
56
+ * for plugins that always run within the same module system.
57
+ */
58
+ var PluginMetadataStorage = class {
59
+ storage;
60
+ constructor(key) {
61
+ if (key !== void 0) {
62
+ const storageKey = Symbol.for(key);
63
+ const g = globalThis;
64
+ if (!g[storageKey]) g[storageKey] = /* @__PURE__ */ new WeakMap();
65
+ this.storage = g[storageKey];
66
+ } else this.storage = /* @__PURE__ */ new WeakMap();
67
+ }
68
+ has(key) {
69
+ return this.storage.has(key);
70
+ }
71
+ get(key) {
72
+ return this.storage.get(key);
73
+ }
74
+ set(key, value) {
75
+ this.storage.set(key, value);
76
+ return this;
77
+ }
78
+ delete(key) {
79
+ return this.storage.delete(key);
80
+ }
81
+ };
82
+ //#endregion
83
+ //#region src/plugins/eslint/constants/metadata-storage.ts
84
+ const MetadataStorage$12 = new PluginMetadataStorage("@keq-request/cli:EslintPlugin:MetadataStorage");
85
+ //#endregion
86
+ //#region src/plugins/eslint/eslint.plugin.ts
87
+ var EslintPlugin = class EslintPlugin {
88
+ constructor(options = {}) {
89
+ this.options = options;
90
+ }
91
+ apply(compiler) {
92
+ if (!compiler.options.build) return;
93
+ const metadata = EslintPlugin.register(compiler);
94
+ if (metadata.applied) return;
95
+ metadata.applied = true;
96
+ if (this.options.disable && this.options.disable.length > 0) {
97
+ const $rules = [...this.options.disable.map((rule) => `/* eslint-disable ${rule} */`)].join("\n");
98
+ compiler.hooks.afterCompile.tap(EslintPlugin.name, () => {
99
+ const artifacts = compiler.context.artifacts || [];
100
+ for (const artifact of artifacts) artifact.anchor.append("file:start", $rules);
101
+ });
102
+ }
103
+ compiler.hooks.afterPersist.tapPromise(EslintPlugin.name, async (task) => {
104
+ const files = compiler.context.assets || [];
105
+ if (files.length === 0) return;
106
+ const results = await new ESLint({ fix: true }).lintFiles(files.map((file) => file.path));
107
+ await ESLint.outputFixes(results);
108
+ });
109
+ }
110
+ static register(compiler) {
111
+ if (!MetadataStorage$12.has(compiler)) MetadataStorage$12.set(compiler, {
112
+ applied: false,
113
+ hooks: {}
114
+ });
115
+ return MetadataStorage$12.get(compiler);
116
+ }
117
+ static of(compiler) {
118
+ return this.register(compiler);
119
+ }
120
+ };
121
+ //#endregion
122
+ //#region src/plugins/prettier/constants/metadata-storage.ts
123
+ const MetadataStorage$11 = new PluginMetadataStorage("@keq-request/cli:PrettierPlugin:MetadataStorage");
124
+ //#endregion
125
+ //#region src/plugins/prettier/prettier.plugin.ts
126
+ const execAsync = promisify(exec);
127
+ var PrettierPlugin = class PrettierPlugin {
128
+ apply(compiler) {
129
+ if (!compiler.options.build) return;
130
+ const metadata = PrettierPlugin.register(compiler);
131
+ if (metadata.applied) return;
132
+ metadata.applied = true;
133
+ compiler.hooks.afterPersist.tapPromise(PrettierPlugin.name, async () => {
134
+ const files = compiler.context.assets || [];
135
+ if (files.length === 0) return;
136
+ await execAsync(`prettier --write ${files.map((file) => file.path).join(" ")}`);
137
+ });
138
+ }
139
+ static register(compiler) {
140
+ if (!MetadataStorage$11.has(compiler)) MetadataStorage$11.set(compiler, {
141
+ applied: false,
142
+ hooks: {}
143
+ });
144
+ return MetadataStorage$11.get(compiler);
145
+ }
146
+ static of(compiler) {
147
+ return this.register(compiler);
148
+ }
149
+ };
150
+ //#endregion
151
+ //#region src/utils/json-schema-utils/is-array.ts
152
+ function isArray(schema) {
153
+ return schema.type === "array";
154
+ }
155
+ //#endregion
156
+ //#region src/utils/json-schema-utils/is-mixed.ts
157
+ function isMixed(schema) {
158
+ return Array.isArray(schema.type);
159
+ }
160
+ //#endregion
161
+ //#region src/utils/json-schema-utils/is-non-array.ts
162
+ function isNonArray(schema) {
163
+ return typeof schema.type === "string" && schema.type !== "array";
164
+ }
165
+ //#endregion
166
+ //#region src/utils/json-schema-utils/is-ref.ts
167
+ function isRef(schema) {
168
+ return "$ref" in schema;
169
+ }
170
+ //#endregion
171
+ //#region src/utils/json-schema-utils/index.ts
172
+ var JsonSchemaUtils = class {
173
+ static isRef = isRef;
174
+ static isArray = isArray;
175
+ static isNonArray = isNonArray;
176
+ static isMixed = isMixed;
177
+ };
178
+ //#endregion
179
+ //#region src/plugins/generate-micro-function/constants/metadata-storage.ts
180
+ const MetadataStorage$10 = new PluginMetadataStorage("@keq-request/cli:GenerateMicroFunctionPlugin:MetadataStorage");
181
+ //#endregion
182
+ //#region src/models/anchor.ts
183
+ var AnchorBlock = class {
184
+ constructor(artifact) {
185
+ this.artifact = artifact;
186
+ }
187
+ /**
188
+ * Append content to the end of the anchor block.
189
+ */
190
+ append(anchorName, content) {
191
+ const lines = this.artifact.content.split("\n");
192
+ const anchor = `@anchor:${anchorName}:end`;
193
+ const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
194
+ if (anchorIndex === -1) throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
195
+ lines.splice(anchorIndex, 0, content);
196
+ this.artifact.content = lines.join("\n");
197
+ }
198
+ prepend(anchorName, content) {
199
+ const lines = this.artifact.content.split("\n");
200
+ const anchor = `@anchor:${anchorName}:start`;
201
+ const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
202
+ if (anchorIndex === -1) throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
203
+ lines.splice(anchorIndex + 1, 0, content);
204
+ this.artifact.content = lines.join("\n");
205
+ }
206
+ replace(anchorName, content) {
207
+ const lines = this.artifact.content.split("\n");
208
+ const startIndex = lines.findIndex((line) => line.includes(`/* @anchor:${anchorName}:start */`));
209
+ const endIndex = lines.findIndex((line) => line.includes(`/* @anchor:${anchorName}:end */`));
210
+ if (startIndex === -1 || endIndex === -1 || endIndex <= startIndex) throw new Error(`"@anchor:${anchorName}:start" or "@anchor:${anchorName}:end" not found in artifact "${this.artifact.filepath}".`);
211
+ lines.splice(startIndex + 1, endIndex - startIndex - 1, content);
212
+ this.artifact.content = lines.join("\n");
213
+ }
214
+ };
215
+ var Anchor = class {
216
+ block;
217
+ constructor(artifact) {
218
+ this.artifact = artifact;
219
+ this.block = new AnchorBlock(artifact);
220
+ }
221
+ append(anchorName, content) {
222
+ const lines = this.artifact.content.split("\n");
223
+ const anchor = `@anchor:${anchorName}`;
224
+ const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
225
+ if (anchorIndex === -1) throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
226
+ lines.splice(anchorIndex + 1, 0, content);
227
+ this.artifact.content = lines.join("\n");
228
+ }
229
+ prepend(anchorName, content) {
230
+ const lines = this.artifact.content.split("\n");
231
+ const anchor = `@anchor:${anchorName}`;
232
+ const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
233
+ if (anchorIndex === -1) throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
234
+ lines.splice(anchorIndex, 0, content);
235
+ this.artifact.content = lines.join("\n");
236
+ }
237
+ };
238
+ //#endregion
239
+ //#region src/models/artifact.ts
240
+ const HeaderComment = [
241
+ "// Code generated by @keq-request/cli. DO NOT EDIT.",
242
+ "// Code generated by @keq-request/cli. DO NOT EDIT.",
243
+ "// Code generated by @keq-request/cli. DO NOT EDIT.",
244
+ "",
245
+ ""
246
+ ].join("\n");
247
+ var Artifact = class {
248
+ id;
249
+ filepath;
250
+ content;
251
+ extensionName;
252
+ anchor = new Anchor(this);
253
+ constructor(options) {
254
+ this.id = options.id;
255
+ this.filepath = options.filepath;
256
+ this.extensionName = options.extensionName || path$1.extname(options.filepath);
257
+ this.content = options.content;
258
+ }
259
+ get dirname() {
260
+ return path$1.dirname(this.filepath);
261
+ }
262
+ renderer() {
263
+ return `${HeaderComment}${this.content}`;
264
+ }
265
+ };
266
+ //#endregion
267
+ //#region src/models/module-definition.ts
268
+ var ModuleDefinition = class ModuleDefinition {
269
+ name;
270
+ address;
271
+ constructor(name, address) {
272
+ this.name = name;
273
+ if (typeof address === "string") this.address = {
274
+ url: address,
275
+ headers: {},
276
+ encoding: "utf8"
277
+ };
278
+ else this.address = address;
279
+ }
280
+ static unknown() {
281
+ return new ModuleDefinition("", {
282
+ url: "",
283
+ headers: {},
284
+ encoding: "utf8"
285
+ });
286
+ }
287
+ };
288
+ //#endregion
289
+ //#region src/utils/is-keywords.ts
290
+ const keywords = [
291
+ "break",
292
+ "case",
293
+ "catch",
294
+ "continue",
295
+ "default",
296
+ "delete",
297
+ "do",
298
+ "else",
299
+ "finally",
300
+ "for",
301
+ "function",
302
+ "if",
303
+ "in",
304
+ "instanceof",
305
+ "new",
306
+ "return",
307
+ "switch",
308
+ "this",
309
+ "throw",
310
+ "try",
311
+ "typeof",
312
+ "var",
313
+ "void",
314
+ "while",
315
+ "with"
316
+ ];
317
+ function isKeywords(str) {
318
+ return keywords.includes(str);
319
+ }
320
+ //#endregion
321
+ //#region src/utils/is-reserved-word.ts
322
+ const reservedWords = [
323
+ "abstract",
324
+ "boolean",
325
+ "byte",
326
+ "char",
327
+ "class",
328
+ "const",
329
+ "debugger",
330
+ "double",
331
+ "enum",
332
+ "export",
333
+ "extends",
334
+ "final",
335
+ "float",
336
+ "goto",
337
+ "implements",
338
+ "import",
339
+ "int",
340
+ "interface",
341
+ "long",
342
+ "native",
343
+ "package",
344
+ "private",
345
+ "protected",
346
+ "public",
347
+ "short",
348
+ "static",
349
+ "super",
350
+ "synchronized",
351
+ "throws",
352
+ "transient",
353
+ "volatile"
354
+ ];
355
+ function isReservedWord(str) {
356
+ return reservedWords.includes(str);
357
+ }
358
+ //#endregion
359
+ //#region src/models/schema-definition.ts
360
+ var SchemaDefinition = class SchemaDefinition {
361
+ name;
362
+ schema;
363
+ module;
364
+ document;
365
+ get id() {
366
+ return `${this.module.address.url}#/components/schemas/${this.name}`;
367
+ }
368
+ constructor(args) {
369
+ this.module = args.module;
370
+ this.name = args.name;
371
+ this.schema = args.schema;
372
+ this.document = args.document;
373
+ }
374
+ getDependencies() {
375
+ return R.uniq(JSONPath({
376
+ path: "$..*['$ref']",
377
+ json: this.schema
378
+ })).filter((ref) => typeof ref === "string" && !!ref.trim()).map((ref) => {
379
+ const definition = this.document.dereference(ref);
380
+ if (definition instanceof SchemaDefinition) return definition;
381
+ return SchemaDefinition.unknown();
382
+ }).filter((dep) => dep.id !== this.id);
383
+ }
384
+ static unknown() {
385
+ return new SchemaDefinition({
386
+ name: "",
387
+ schema: {},
388
+ module: ModuleDefinition.unknown(),
389
+ document: ApiDocumentV3_1.unknown()
390
+ });
391
+ }
392
+ static isUnknown(definition) {
393
+ return definition.name === "";
394
+ }
395
+ };
396
+ //#endregion
397
+ //#region src/models/response-definition.ts
398
+ var ResponseDefinition = class ResponseDefinition {
399
+ name;
400
+ response;
401
+ module;
402
+ document;
403
+ get id() {
404
+ return `${this.module.address.url}#/components/responses/${this.name}`;
405
+ }
406
+ constructor(args) {
407
+ this.module = args.module;
408
+ this.name = args.name;
409
+ this.response = args.response;
410
+ this.document = args.document;
411
+ }
412
+ getDependencies() {
413
+ return R.uniq(JSONPath({
414
+ path: "$.content..schema..$['$ref']",
415
+ json: this.response
416
+ })).filter((ref) => typeof ref === "string" && !!ref.trim()).map((ref) => {
417
+ const definition = this.document.dereference(ref);
418
+ if (definition instanceof SchemaDefinition) return definition;
419
+ return SchemaDefinition.unknown();
420
+ }).filter((dep) => dep.id !== this.id);
421
+ }
422
+ static unknown() {
423
+ return new ResponseDefinition({
424
+ name: "",
425
+ response: { description: "" },
426
+ module: ModuleDefinition.unknown(),
427
+ document: ApiDocumentV3_1.unknown()
428
+ });
429
+ }
430
+ static isUnknown(definition) {
431
+ return definition.name === "";
432
+ }
433
+ };
434
+ //#endregion
435
+ //#region src/models/operation-definition.ts
436
+ var OperationDefinition = class {
437
+ module;
438
+ operationId;
439
+ method;
440
+ pathname;
441
+ operation;
442
+ document;
443
+ get id() {
444
+ return `${this.module.address.url}#/paths/${this.pathname}/${this.method}`;
445
+ }
446
+ constructor(args) {
447
+ this.module = args.module;
448
+ this.method = args.method.toLowerCase();
449
+ this.pathname = args.pathname;
450
+ this.document = args.document;
451
+ this.operationId = this.formatOperationId(args.method, args.pathname, args.operation);
452
+ this.operation = {
453
+ ...args.operation,
454
+ operationId: this.operationId
455
+ };
456
+ }
457
+ formatOperationId(method, pathname, operation) {
458
+ const operationId = operation.operationId;
459
+ if (operationId && operationId !== "index" && !isKeywords(operationId) && !isReservedWord(operationId)) return operationId;
460
+ return `${method}_${pathname}`.replace(/\//g, "_").replace(/-/g, "_").replace(/:/g, "$$").replace(/{(.+)}/, "$$$1");
461
+ }
462
+ getDependencies() {
463
+ return R.uniq([
464
+ ...JSONPath({
465
+ path: "$.requestBody.content..schema..$ref",
466
+ json: this.operation
467
+ }),
468
+ ...JSONPath({
469
+ path: "$.responses..content..schema..$ref",
470
+ json: this.operation
471
+ }),
472
+ ...JSONPath({
473
+ path: "$.parameters..schema..$ref",
474
+ json: this.operation
475
+ })
476
+ ]).filter((ref) => typeof ref === "string" && ref).map((ref) => {
477
+ const definition = this.document.dereference(ref);
478
+ if (definition instanceof SchemaDefinition) return definition;
479
+ return SchemaDefinition.unknown();
480
+ });
481
+ }
482
+ getResponseDependencies() {
483
+ const responses = this.operation.responses || {};
484
+ return R.uniqBy((dep) => dep.id, Object.values(responses).filter((response) => JsonSchemaUtils.isRef(response)).map((response) => {
485
+ const definition = this.document.dereference(response.$ref);
486
+ if (definition instanceof ResponseDefinition) return definition;
487
+ return ResponseDefinition.unknown();
488
+ }).filter((dep) => !ResponseDefinition.isUnknown(dep)));
489
+ }
490
+ };
491
+ //#endregion
492
+ //#region src/models/api-document_v3_1.ts
493
+ var ApiDocumentV3_1 = class ApiDocumentV3_1 {
494
+ module;
495
+ specification;
496
+ constructor(specification, module) {
497
+ this.module = module;
498
+ this.specification = specification;
499
+ }
500
+ get schemas() {
501
+ const module = this.module;
502
+ return Object.entries(this.specification.components?.schemas || {}).map(([name, schema]) => new SchemaDefinition({
503
+ name,
504
+ schema,
505
+ module,
506
+ document: this
507
+ }));
508
+ }
509
+ get responses() {
510
+ const module = this.module;
511
+ return Object.entries(this.specification.components?.responses || {}).filter((entry) => {
512
+ const [, response] = entry;
513
+ return typeof response === "object" && !("$ref" in response);
514
+ }).map(([name, response]) => new ResponseDefinition({
515
+ name,
516
+ response,
517
+ module,
518
+ document: this
519
+ }));
520
+ }
521
+ get operations() {
522
+ const module = this.module;
523
+ return Object.entries(this.specification.paths || {}).flatMap(([pathname, pathItem]) => Object.entries(pathItem || {}).filter(([method]) => SupportedMethods.includes(method.toLowerCase())).map(([method, operation]) => new OperationDefinition({
524
+ method,
525
+ pathname,
526
+ operation,
527
+ module,
528
+ document: this
529
+ })));
530
+ }
531
+ isEmpty() {
532
+ return R.isEmpty(this.specification.paths);
533
+ }
534
+ dereference($ref) {
535
+ if ($ref.startsWith("#/")) {
536
+ if ($ref.startsWith("#/components/responses/")) return this.responses.find((response) => response.id.endsWith($ref));
537
+ return this.schemas.find((schema) => schema.id.endsWith($ref));
538
+ }
539
+ logger.warn(`The $ref(${$ref}) is not defined in ${this.module.name} openapi/swagger.`);
540
+ }
541
+ isRefDefined($ref) {
542
+ if ($ref.startsWith("#/")) {
543
+ const path = $ref.replace("#/", "").split("/");
544
+ return R.path(path, this.specification) !== void 0;
545
+ }
546
+ return false;
547
+ }
548
+ static unknown() {
549
+ return new ApiDocumentV3_1({}, ModuleDefinition.unknown());
550
+ }
551
+ };
552
+ //#endregion
553
+ //#region src/models/asset.ts
554
+ var Asset = class {
555
+ path;
556
+ constructor(path) {
557
+ this.path = path;
558
+ }
559
+ };
560
+ //#endregion
561
+ //#region src/models/file-tracker.ts
562
+ /**
563
+ * Passive file change tracker based on mtime comparison.
564
+ * Instead of actively watching filesystem events, it checks for changes on demand,
565
+ * suitable for lazy reload of config files in long-lived processes.
566
+ */
567
+ var FileTracker = class {
568
+ files = [];
569
+ reloadPromise = null;
570
+ async track(filepath) {
571
+ let mtimeMs = 0;
572
+ try {
573
+ mtimeMs = (await fs.stat(filepath)).mtimeMs;
574
+ } catch {}
575
+ this.files.push({
576
+ filepath,
577
+ mtimeMs
578
+ });
579
+ }
580
+ async ensureFresh(reload) {
581
+ if (!await this.isChanged()) return;
582
+ if (this.reloadPromise) {
583
+ await this.reloadPromise;
584
+ return;
585
+ }
586
+ if (!await this.isChanged()) return;
587
+ this.reloadPromise = reload().finally(() => {
588
+ this.reloadPromise = null;
589
+ });
590
+ await this.reloadPromise;
591
+ }
592
+ async forceReload(reload) {
593
+ if (this.reloadPromise) await this.reloadPromise;
594
+ this.reloadPromise = reload().finally(() => {
595
+ this.reloadPromise = null;
596
+ });
597
+ await this.reloadPromise;
598
+ }
599
+ async snapshot() {
600
+ for (const file of this.files) try {
601
+ file.mtimeMs = (await fs.stat(file.filepath)).mtimeMs;
602
+ } catch {
603
+ file.mtimeMs = 0;
604
+ }
605
+ }
606
+ async isChanged() {
607
+ for (const file of this.files) try {
608
+ if ((await fs.stat(file.filepath)).mtimeMs !== file.mtimeMs) return true;
609
+ } catch {
610
+ if (file.mtimeMs !== 0) return true;
611
+ }
612
+ return false;
613
+ }
614
+ };
615
+ //#endregion
616
+ //#region src/transformers/json-schema/comment.renderer.ts
617
+ var CommentRenderer$1 = class {
618
+ constructor(schema) {
619
+ this.schema = schema;
620
+ }
621
+ render() {
622
+ const schema = this.schema;
623
+ const lines = ["/**"];
624
+ if (schema.description) {
625
+ const description = schema.description.replace("*/", "*\\/").replace(/\t/g, " ").replace(/\r\n?/g, "\n");
626
+ lines.push(...description.split("\n").map((line) => ` * ${line.trimEnd()}`));
627
+ }
628
+ if (schema.deprecated) lines.push(" * @deprecated");
629
+ if (schema.readOnly) lines.push(" * @readonly");
630
+ if (schema.format) lines.push(` * @format ${schema.format}`);
631
+ lines.push(" */");
632
+ if (lines.length === 2) return "";
633
+ return lines.join("\n");
634
+ }
635
+ };
636
+ //#endregion
637
+ //#region src/utils/indent.ts
638
+ function indent(space, text) {
639
+ if (text === "") return "";
640
+ const indentation = " ".repeat(space);
641
+ return text.split("\n").map((line) => line ? `${indentation}${line}` : line).join("\n");
642
+ }
643
+ //#endregion
644
+ //#region src/transformers/json-schema/reference.transformer.ts
645
+ var ReferenceTransformer = class {
646
+ static toDeclaration(schema, alias = R.identity) {
647
+ if (!schema.$ref || !schema.$ref.startsWith("#")) return `unknown /* ${schema.$ref.replace("*/", "*\\/")} */`;
648
+ const parts = schema.$ref.split("/");
649
+ return alias(parts[parts.length - 1]) || "unknown";
650
+ }
651
+ /**
652
+ * Render the case where the $ref target does not exist
653
+ */
654
+ static toNotFoundDeclaration(schema, hint) {
655
+ const safeRef = schema.$ref.replace("*/", "*\\/");
656
+ return `unknown /* ${hint ? `Cannot find $ref "${safeRef}". ${hint}` : `Cannot find $ref "${safeRef}"`} */`;
657
+ }
658
+ /**
659
+ * Render the case where the $ref format is invalid
660
+ */
661
+ static toInvalidDeclaration(schema, hint) {
662
+ const safeRef = schema.$ref.replace("*/", "*\\/");
663
+ return `unknown /* ${hint ? `Invalid $ref "${safeRef}". ${hint}` : `Invalid $ref "${safeRef}"`} */`;
664
+ }
665
+ };
666
+ //#endregion
667
+ //#region src/transformers/json-schema/declaration.renderer.ts
668
+ var DeclarationRenderer$1 = class {
669
+ constructor(schema, options = {}) {
670
+ this.schema = schema;
671
+ this.options = options;
672
+ }
673
+ render() {
674
+ return this.renderSchema(this.schema);
675
+ }
676
+ renderSchema(schema) {
677
+ if (typeof schema === "boolean") return "unknown";
678
+ if (JsonSchemaUtils.isRef(schema)) return this.renderReference(schema);
679
+ if (JsonSchemaUtils.isMixed(schema)) return this.renderMixed(schema);
680
+ if (JsonSchemaUtils.isArray(schema)) return this.renderArray(schema);
681
+ if (schema.type === "object") return this.renderObject(schema);
682
+ if (schema.enum) return this.renderEnum(schema);
683
+ if (schema.oneOf) return this.renderOneOf(schema);
684
+ if (schema.anyOf) return this.renderAnyOf(schema);
685
+ if (schema.allOf) return this.renderAllOf(schema);
686
+ if (schema.type === "string") return this.renderString(schema);
687
+ if (schema.type === "number") return this.renderNumber(schema);
688
+ if (schema.type === "boolean") return this.renderBoolean(schema);
689
+ if (schema.type === "null") return this.renderNull(schema);
690
+ if (schema.type === "integer") return this.renderInteger(schema);
691
+ return "unknown";
692
+ }
693
+ renderMixed(schema) {
694
+ if (Array.isArray(schema.type)) return schema.type.map((type) => ({
695
+ ...schema,
696
+ type
697
+ })).map((schema) => this.renderSchema(schema)).join(" | ");
698
+ return "unknown";
699
+ }
700
+ renderReference(schema) {
701
+ if (!this.options.referenceTransformer) return ReferenceTransformer.toDeclaration(schema);
702
+ return this.options.referenceTransformer(schema);
703
+ }
704
+ renderArray(schema) {
705
+ if (schema.items && Array.isArray(schema.items)) return `[${schema.items.map((s) => this.renderSchema(s)).join(", ")}]`;
706
+ if (schema.items && typeof schema.items === "object") return `${this.renderSchema(schema.items)}[]`;
707
+ return "any[]";
708
+ }
709
+ renderObject(schema) {
710
+ const hasProperties = schema.properties && !R.isEmpty(schema.properties);
711
+ const apType = this.options.additionalPropertiesType ?? "unknown";
712
+ if (!hasProperties) {
713
+ if (schema.additionalProperties === false) return "Record<string, never>";
714
+ if (typeof schema.additionalProperties === "object") return `Record<string, ${this.renderSchema(schema.additionalProperties)}>`;
715
+ return `Record<string, ${apType}>`;
716
+ }
717
+ const $properties = Object.entries(schema.properties || {}).map(([propertyName, propertySchema]) => {
718
+ let $comment = new CommentRenderer$1(propertySchema).render();
719
+ if ($comment) $comment += "\n";
720
+ const $key = `"${propertyName}"${schema.required?.includes(propertyName) ? "" : "?"}`;
721
+ const $value = this.renderSchema(propertySchema);
722
+ return indent(2, `${$comment}${$key}: ${$value}`);
723
+ });
724
+ if (schema.additionalProperties !== false) if (typeof schema.additionalProperties === "object") $properties.push(indent(2, `[key: string]: ${this.renderSchema(schema.additionalProperties)}`));
725
+ else $properties.push(indent(2, `[key: string]: ${apType}`));
726
+ return [
727
+ "{",
728
+ ...$properties,
729
+ "}"
730
+ ].join("\n");
731
+ }
732
+ renderOneOf(schema) {
733
+ if (!schema.oneOf) return "unknown";
734
+ return schema.oneOf.map((s) => this.renderSchema(s)).join(" | ");
735
+ }
736
+ renderAnyOf(schema) {
737
+ if (!schema.anyOf) return "unknown";
738
+ return schema.anyOf.map((s) => this.renderSchema(s)).join(" | ");
739
+ }
740
+ renderAllOf(schema) {
741
+ if (!schema.allOf) return "unknown";
742
+ return schema.allOf.map((s) => this.renderSchema(s)).join(" & ");
743
+ }
744
+ renderEnum(schema) {
745
+ if (!schema.enum) return "unknown";
746
+ return `(${schema.enum.map((v) => JSON.stringify(v)).join(" | ")})`;
747
+ }
748
+ renderString(schema) {
749
+ if (schema.contentMediaType === "application/octet-stream") return "Blob | Buffer";
750
+ if (schema.format === "binary") return "Blob | Buffer";
751
+ return "string";
752
+ }
753
+ renderNumber(schema) {
754
+ return "number";
755
+ }
756
+ renderBoolean(schema) {
757
+ return "boolean";
758
+ }
759
+ renderNull(schema) {
760
+ return "null";
761
+ }
762
+ renderInteger(schema) {
763
+ return "number";
764
+ }
765
+ };
766
+ //#endregion
767
+ //#region src/transformers/json-schema/valibot.renderer.ts
768
+ var ValibotRenderer = class {
769
+ constructor(schema, options = {}) {
770
+ this.schema = schema;
771
+ this.options = options;
772
+ }
773
+ render() {
774
+ return this.renderSchema(this.schema);
775
+ }
776
+ renderSchema(schema) {
777
+ if (typeof schema === "boolean") return "v.unknown()";
778
+ if (JsonSchemaUtils.isRef(schema)) return this.renderReference(schema);
779
+ if (JsonSchemaUtils.isMixed(schema)) return this.renderMixed(schema);
780
+ if (JsonSchemaUtils.isArray(schema)) return this.renderArray(schema);
781
+ if (schema.type === "object") return this.renderObject(schema);
782
+ if (schema.enum) return this.renderEnum(schema);
783
+ if (schema.oneOf) return this.renderOneOf(schema);
784
+ if (schema.anyOf) return this.renderAnyOf(schema);
785
+ if (schema.allOf) return this.renderAllOf(schema);
786
+ if (schema.type === "string") return this.renderString(schema);
787
+ if (schema.type === "number") return this.renderNumber(schema);
788
+ if (schema.type === "boolean") return this.renderBoolean(schema);
789
+ if (schema.type === "null") return this.renderNull(schema);
790
+ if (schema.type === "integer") return this.renderInteger(schema);
791
+ return "v.unknown()";
792
+ }
793
+ renderMixed(schema) {
794
+ if (Array.isArray(schema.type)) return `v.union([${schema.type.map((type) => ({
795
+ ...schema,
796
+ type
797
+ })).map((schema) => this.renderSchema(schema)).join(", ")}])`;
798
+ return "v.unknown()";
799
+ }
800
+ renderReference(schema) {
801
+ if (!this.options.referenceTransformer) return ReferenceTransformer.toDeclaration(schema, (name) => `${name}Schema`);
802
+ return this.options.referenceTransformer(schema);
803
+ }
804
+ renderArray(schema) {
805
+ let result;
806
+ if (schema.items && Array.isArray(schema.items)) result = `v.tuple([${schema.items.map((s) => this.renderSchema(s)).join(", ")}])`;
807
+ else if (schema.items && typeof schema.items === "object") result = `v.array(${this.renderSchema(schema.items)})`;
808
+ else result = "v.array(v.any())";
809
+ const constraints = [];
810
+ if (schema.minItems !== void 0) constraints.push(`v.minLength(${schema.minItems})`);
811
+ if (schema.maxItems !== void 0) constraints.push(`v.maxLength(${schema.maxItems})`);
812
+ if (constraints.length > 0) result = `v.pipe(${result}, ${constraints.join(", ")})`;
813
+ return result;
814
+ }
815
+ renderObject(schema) {
816
+ const hasProperties = schema.properties && !R.isEmpty(schema.properties);
817
+ const apType = this.options.additionalPropertiesType ?? "unknown";
818
+ if (!hasProperties) {
819
+ if (schema.additionalProperties === false) return "v.object({})";
820
+ if (typeof schema.additionalProperties === "object") return `v.record(v.string(), ${this.renderSchema(schema.additionalProperties)})`;
821
+ return `v.record(v.string(), v.${apType}())`;
822
+ }
823
+ let result = [
824
+ "v.object({",
825
+ ...Object.entries(schema.properties || {}).map(([propertyName, propertySchema]) => {
826
+ let $comment = new CommentRenderer$1(propertySchema).render();
827
+ if ($comment) $comment += "\n";
828
+ const $key = `"${propertyName}"`;
829
+ let $value = this.renderSchema(propertySchema);
830
+ if (!schema.required?.includes(propertyName)) $value = `v.optional(${$value})`;
831
+ return indent(2, `${$comment}${$key}: ${$value},`);
832
+ }),
833
+ "})"
834
+ ].join("\n");
835
+ if (schema.additionalProperties !== false) if (typeof schema.additionalProperties === "object") {
836
+ const $value = this.renderSchema(schema.additionalProperties);
837
+ result = `v.intersect([${result}, v.record(v.string(), ${$value})])`;
838
+ } else result = result.replace("v.object({", "v.looseObject({");
839
+ return result;
840
+ }
841
+ renderOneOf(schema) {
842
+ if (!schema.oneOf) return "v.unknown()";
843
+ return `v.union([${schema.oneOf.map((s) => this.renderSchema(s)).join(", ")}])`;
844
+ }
845
+ renderAnyOf(schema) {
846
+ if (!schema.anyOf) return "v.unknown()";
847
+ return `v.union([${schema.anyOf.map((s) => this.renderSchema(s)).join(", ")}])`;
848
+ }
849
+ renderAllOf(schema) {
850
+ if (!schema.allOf || schema.allOf.length === 0) return "v.unknown()";
851
+ return `v.intersect([${schema.allOf.map((s) => this.renderSchema(s)).join(", ")}])`;
852
+ }
853
+ renderEnum(schema) {
854
+ if (!schema.enum || schema.enum.length === 0) return "v.unknown()";
855
+ if (schema.enum.length === 1) return `v.literal(${JSON.stringify(schema.enum[0])})`;
856
+ if (schema.enum.every((v) => typeof v === "string")) return `v.picklist([${schema.enum.map((v) => JSON.stringify(v)).join(", ")}])`;
857
+ return `v.union([${schema.enum.map((v) => `v.literal(${JSON.stringify(v)})`).join(", ")}])`;
858
+ }
859
+ renderString(schema) {
860
+ if (schema.contentMediaType === "application/octet-stream") return "v.union([v.instance(Blob), v.instance(Buffer)])";
861
+ if (schema.format === "binary") return "v.union([v.instance(Blob), v.instance(Buffer)])";
862
+ let result = "v.string()";
863
+ const constraints = [];
864
+ if (schema.format === "email") constraints.push("v.email()");
865
+ else if (schema.format === "uri" || schema.format === "url") constraints.push("v.url()");
866
+ else if (schema.format === "uuid") constraints.push("v.uuid()");
867
+ else if (schema.format === "date-time") constraints.push("v.isoDateTime()");
868
+ else if (schema.format === "date") constraints.push("v.isoDate()");
869
+ else if (schema.format === "time") constraints.push("v.isoTime()");
870
+ if (schema.minLength !== void 0) constraints.push(`v.minLength(${schema.minLength})`);
871
+ if (schema.maxLength !== void 0) constraints.push(`v.maxLength(${schema.maxLength})`);
872
+ if (schema.pattern) {
873
+ const escapedPattern = schema.pattern.replace(/\\/g, "\\\\");
874
+ constraints.push(`v.regex(/${escapedPattern}/)`);
875
+ }
876
+ if (constraints.length > 0) result = `v.pipe(${result}, ${constraints.join(", ")})`;
877
+ return result;
878
+ }
879
+ renderNumber(schema) {
880
+ let result = "v.number()";
881
+ const constraints = [];
882
+ if (schema.minimum !== void 0) if (schema.exclusiveMinimum) constraints.push(`v.minValue(${schema.minimum + Number.EPSILON})`);
883
+ else constraints.push(`v.minValue(${schema.minimum})`);
884
+ if (schema.maximum !== void 0) if (schema.exclusiveMaximum) constraints.push(`v.maxValue(${schema.maximum - Number.EPSILON})`);
885
+ else constraints.push(`v.maxValue(${schema.maximum})`);
886
+ if (schema.multipleOf !== void 0) constraints.push(`v.multipleOf(${schema.multipleOf})`);
887
+ if (constraints.length > 0) result = `v.pipe(${result}, ${constraints.join(", ")})`;
888
+ return result;
889
+ }
890
+ renderBoolean(schema) {
891
+ return "v.boolean()";
892
+ }
893
+ renderNull(schema) {
894
+ return "v.null()";
895
+ }
896
+ renderInteger(schema) {
897
+ let result = "v.number()";
898
+ const constraints = ["v.integer()"];
899
+ if (schema.minimum !== void 0) if (schema.exclusiveMinimum) constraints.push(`v.minValue(${schema.minimum + 1})`);
900
+ else constraints.push(`v.minValue(${schema.minimum})`);
901
+ if (schema.maximum !== void 0) if (schema.exclusiveMaximum) constraints.push(`v.maxValue(${schema.maximum - 1})`);
902
+ else constraints.push(`v.maxValue(${schema.maximum})`);
903
+ if (schema.multipleOf !== void 0) constraints.push(`v.multipleOf(${schema.multipleOf})`);
904
+ result = `v.pipe(${result}, ${constraints.join(", ")})`;
905
+ return result;
906
+ }
907
+ };
908
+ //#endregion
909
+ //#region src/transformers/json-schema/json-schema.transformer.ts
910
+ var JsonSchemaTransformer = class {
911
+ static toComment(schema) {
912
+ return new CommentRenderer$1(schema).render();
913
+ }
914
+ static toDeclaration(schema, options) {
915
+ return new DeclarationRenderer$1(schema, options).render();
916
+ }
917
+ static toValibot(schema, options) {
918
+ return new ValibotRenderer(schema, options).render();
919
+ }
920
+ };
921
+ //#endregion
922
+ //#region src/transformers/schema-definition/schema-definition.transformer.ts
923
+ var SchemaDefinitionTransformer = class {
924
+ static toDeclaration(schemaDefinition, options) {
925
+ const hint = `Referenced from schema definition "${schemaDefinition.name}".`;
926
+ const referenceTransformer = (schema) => {
927
+ if (!schema.$ref || !schema.$ref.startsWith("#")) return ReferenceTransformer.toInvalidDeclaration(schema, hint);
928
+ if (!schemaDefinition.document.isRefDefined(schema.$ref)) return ReferenceTransformer.toNotFoundDeclaration(schema, hint);
929
+ return ReferenceTransformer.toDeclaration(schema);
930
+ };
931
+ let $dependencies = schemaDefinition.getDependencies().filter((dep) => !SchemaDefinition.isUnknown(dep)).map((dep) => {
932
+ const filepath = options.getDependentSchemaDefinitionFilepath(dep);
933
+ return `import type { ${dep.name} } from "${filepath}"`;
934
+ }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, options.esm ? " from \"$1.js\"" : " from \"$1\"")).join("\n");
935
+ if ($dependencies) $dependencies += "\n";
936
+ let $comment = JsonSchemaTransformer.toComment(schemaDefinition.schema);
937
+ if ($comment) $comment += "\n";
938
+ if (typeof schemaDefinition.schema === "boolean") return [
939
+ "/* @anchor:file:start */",
940
+ "",
941
+ $dependencies,
942
+ $comment || void 0,
943
+ `type ${schemaDefinition.name} = unknown`,
944
+ "",
945
+ "/* @anchor:file:end */"
946
+ ].filter(R.isNotNil).join("\n");
947
+ if (JsonSchemaUtils.isNonArray(schemaDefinition.schema) && schemaDefinition.schema.type === "object") {
948
+ const $schema = JsonSchemaTransformer.toDeclaration(schemaDefinition.schema, {
949
+ referenceTransformer,
950
+ additionalPropertiesType: options.additionalPropertiesType
951
+ });
952
+ const $declaration = $schema.startsWith("{") ? `export interface ${schemaDefinition.name} ${$schema}` : `export type ${schemaDefinition.name} = ${$schema}`;
953
+ return [
954
+ "/* @anchor:file:start */",
955
+ "",
956
+ $dependencies,
957
+ $comment || void 0,
958
+ $declaration,
959
+ "",
960
+ "/* @anchor:file:end */"
961
+ ].filter(R.isNotNil).join("\n");
962
+ }
963
+ return [
964
+ "/* @anchor:file:start */",
965
+ "",
966
+ $dependencies,
967
+ $comment || void 0,
968
+ `export type ${schemaDefinition.name} = ${JsonSchemaTransformer.toDeclaration(schemaDefinition.schema, {
969
+ referenceTransformer,
970
+ additionalPropertiesType: options.additionalPropertiesType
971
+ })}`,
972
+ "",
973
+ "/* @anchor:file:end */"
974
+ ].filter(R.isNotNil).join("\n");
975
+ }
976
+ static toValibot(schemaDefinition, options) {
977
+ const hint = `Referenced from schema definition "${schemaDefinition.name}".`;
978
+ const referenceTransformer = (schema) => {
979
+ if (!schema.$ref || !schema.$ref.startsWith("#")) return ReferenceTransformer.toInvalidDeclaration(schema, hint).replace(/^unknown/, "v.unknown()");
980
+ if (!schemaDefinition.document.isRefDefined(schema.$ref)) return ReferenceTransformer.toNotFoundDeclaration(schema, hint).replace(/^unknown/, "v.unknown()");
981
+ return `v.lazy(() => ${ReferenceTransformer.toDeclaration(schema, (name) => `${name}Schema`)})`;
982
+ };
983
+ const declarationReferenceTransformer = (schema) => {
984
+ if (!schema.$ref || !schema.$ref.startsWith("#")) return ReferenceTransformer.toInvalidDeclaration(schema, hint);
985
+ if (!schemaDefinition.document.isRefDefined(schema.$ref)) return ReferenceTransformer.toNotFoundDeclaration(schema, hint);
986
+ return ReferenceTransformer.toDeclaration(schema);
987
+ };
988
+ let $dependencies = schemaDefinition.getDependencies().filter((dep) => !SchemaDefinition.isUnknown(dep)).map((dep) => {
989
+ const filepath = options.getDependentSchemaDefinitionFilepath(dep);
990
+ return `import { type ${dep.name}, ${dep.name}Schema } from "${filepath}"`;
991
+ }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, options.esm ? " from \"$1.js\"" : " from \"$1\"")).join("\n");
992
+ if ($dependencies) $dependencies += "\n";
993
+ let $comment = JsonSchemaTransformer.toComment(schemaDefinition.schema);
994
+ if ($comment) $comment += "\n";
995
+ const $valibotImport = "import * as v from 'valibot'\n";
996
+ if (typeof schemaDefinition.schema === "boolean") return [
997
+ "/* @anchor:file:start */",
998
+ "",
999
+ $valibotImport,
1000
+ $dependencies,
1001
+ $comment || void 0,
1002
+ `export const ${schemaDefinition.name}Schema = v.unknown()`,
1003
+ `export type ${schemaDefinition.name} = v.InferOutput<typeof ${schemaDefinition.name}Schema>`,
1004
+ "",
1005
+ "/* @anchor:file:end */"
1006
+ ].filter(R.isNotNil).join("\n");
1007
+ const $schema = JsonSchemaTransformer.toValibot(schemaDefinition.schema, {
1008
+ referenceTransformer,
1009
+ additionalPropertiesType: options.additionalPropertiesType
1010
+ });
1011
+ const $typeSchema = JsonSchemaTransformer.toDeclaration(schemaDefinition.schema, {
1012
+ referenceTransformer: declarationReferenceTransformer,
1013
+ additionalPropertiesType: options.additionalPropertiesType
1014
+ });
1015
+ const $typeDeclaration = $typeSchema.startsWith("{") ? `export interface ${schemaDefinition.name} ${$typeSchema}` : `export type ${schemaDefinition.name} = ${$typeSchema}`;
1016
+ return [
1017
+ "/* @anchor:file:start */",
1018
+ "",
1019
+ $valibotImport,
1020
+ $dependencies,
1021
+ $comment || void 0,
1022
+ $typeDeclaration,
1023
+ `export const ${schemaDefinition.name}Schema: v.GenericSchema<${schemaDefinition.name}> = ${$schema}`,
1024
+ "",
1025
+ "/* @anchor:file:end */"
1026
+ ].filter(R.isNotNil).join("\n");
1027
+ }
1028
+ };
1029
+ //#endregion
1030
+ //#region src/utils/import-alias-manager.ts
1031
+ /**
1032
+ * Manages import alias naming with collision detection for generated TypeScript files.
1033
+ *
1034
+ * When generating `import type { X as XSchema }` statements, the alias (e.g., `XSchema`)
1035
+ * may collide with fixed names already present in the generated file (e.g., the file's own
1036
+ * `export type` name). This class tracks all used names and automatically falls back to
1037
+ * numbered suffixes (e.g., `XSchema$1`) when a collision is detected.
1038
+ *
1039
+ * Usage: call `register()` during import generation, then `resolve()` in referenceTransformer.
1040
+ * `register()` must always be called before `resolve()` for the same dependency, because
1041
+ * the first `register()` call determines the alias name.
1042
+ */
1043
+ var ImportAliasManager = class {
1044
+ /** "category:originalName" → alias */
1045
+ aliasMap = /* @__PURE__ */ new Map();
1046
+ /** All alias names + reserved names currently in use */
1047
+ usedNames = /* @__PURE__ */ new Set();
1048
+ /**
1049
+ * @param reservedNames - Fixed names in the generated file that aliases must not collide with.
1050
+ * For example, the file's own export type name.
1051
+ */
1052
+ constructor(reservedNames = []) {
1053
+ for (const name of reservedNames) this.usedNames.add(name);
1054
+ }
1055
+ /**
1056
+ * Register a dependency and return its alias. Idempotent — calling with the same
1057
+ * category + originalName always returns the same alias.
1058
+ */
1059
+ register(category, originalName) {
1060
+ const key = `${category}:${originalName}`;
1061
+ const existing = this.aliasMap.get(key);
1062
+ if (existing) return existing;
1063
+ let candidate = `${originalName}${category === "schema" ? "Schema" : "Response"}`;
1064
+ if (this.usedNames.has(candidate)) {
1065
+ let i = 1;
1066
+ while (this.usedNames.has(`${candidate}$${i}`)) i++;
1067
+ candidate = `${candidate}$${i}`;
1068
+ }
1069
+ this.aliasMap.set(key, candidate);
1070
+ this.usedNames.add(candidate);
1071
+ return candidate;
1072
+ }
1073
+ /**
1074
+ * Look up alias for an already-registered dependency.
1075
+ * Returns undefined if not yet registered.
1076
+ */
1077
+ resolve(category, originalName) {
1078
+ return this.aliasMap.get(`${category}:${originalName}`);
1079
+ }
1080
+ };
1081
+ //#endregion
1082
+ //#region src/transformers/response-definition/response-definition.transformer.ts
1083
+ var ResponseDefinitionTransformer = class ResponseDefinitionTransformer {
1084
+ static toDeclaration(responseDefinition, options) {
1085
+ const hint = `Referenced from response definition "${responseDefinition.name}".`;
1086
+ const aliasManager = new ImportAliasManager([responseDefinition.name]);
1087
+ let $dependencies = responseDefinition.getDependencies().filter((dep) => !SchemaDefinition.isUnknown(dep)).map((dep) => {
1088
+ const filepath = options.getDependentSchemaDefinitionFilepath(dep);
1089
+ return `import type { ${dep.name} as ${aliasManager.register("schema", dep.name)} } from "${filepath}"`;
1090
+ }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, options.esm ? " from \"$1.js\"" : " from \"$1\"")).join("\n");
1091
+ if ($dependencies) $dependencies += "\n";
1092
+ const referenceTransformer = (schema) => {
1093
+ if (!schema.$ref || !schema.$ref.startsWith("#")) return ReferenceTransformer.toInvalidDeclaration(schema, hint);
1094
+ if (!responseDefinition.document.isRefDefined(schema.$ref)) return ReferenceTransformer.toNotFoundDeclaration(schema, hint);
1095
+ return ReferenceTransformer.toDeclaration(schema, (name) => aliasManager.resolve("schema", name) ?? `${name}Schema`);
1096
+ };
1097
+ const $type = ResponseDefinitionTransformer.renderContentType(responseDefinition.response, {
1098
+ referenceTransformer,
1099
+ additionalPropertiesType: options.additionalPropertiesType
1100
+ });
1101
+ return [
1102
+ "/* @anchor:file:start */",
1103
+ "",
1104
+ $dependencies,
1105
+ `export type ${responseDefinition.name} = ${$type}`,
1106
+ "",
1107
+ "/* @anchor:file:end */"
1108
+ ].filter(R.isNotNil).join("\n");
1109
+ }
1110
+ static renderContentType(response, options) {
1111
+ const content = response.content;
1112
+ if (!content || R.isEmpty(content)) return "void";
1113
+ return Object.entries(content).map(([mediaType, mediaTypeObject]) => {
1114
+ if (mediaType.includes("text/event-stream")) return "ReadableStream<ServerSentEvent>";
1115
+ if (mediaType.includes("multipart/form-data")) return "FormData";
1116
+ if (!mediaTypeObject.schema) return "unknown";
1117
+ return JsonSchemaTransformer.toDeclaration(mediaTypeObject.schema, options);
1118
+ }).join(" | ") || "void";
1119
+ }
1120
+ };
1121
+ //#endregion
1122
+ //#region src/transformers/operation-definition/comment.renderer.ts
1123
+ var CommentRenderer = class {
1124
+ constructor(operationDefinition) {
1125
+ this.operationDefinition = operationDefinition;
1126
+ }
1127
+ render() {
1128
+ const operation = this.operationDefinition.operation;
1129
+ if (!operation.summary && !operation.description) return "";
1130
+ const lines = ["/**"];
1131
+ if (operation.summary && typeof operation.summary === "string") {
1132
+ const summary = R.trim(operation.summary).replace(/\t/g, " ").replace(/\r\n?/g, "\n");
1133
+ lines.push(...summary.split("\n").map((line) => ` * ${line.trimEnd()}`));
1134
+ lines.push(" *");
1135
+ }
1136
+ if (operation.description && typeof operation.description === "string") {
1137
+ const descriptionLines = R.trim(operation.description).replace(/\t/g, " ").replace(/\r\n?/g, "\n").split("\n").map((line) => line.trimEnd());
1138
+ lines.push(` * @description ${descriptionLines[0]}`);
1139
+ lines.push(...descriptionLines.slice(1).map((line) => ` * ${line}`));
1140
+ }
1141
+ lines.push(" */");
1142
+ return lines.join("\n");
1143
+ }
1144
+ };
1145
+ //#endregion
1146
+ //#region src/transformers/operation-definition/utils/type-name-factory.ts
1147
+ function typeNameFactory(operationDefinition) {
1148
+ const pascalCaseOperationId = changeCase.pascalCase(operationDefinition.operationId);
1149
+ return (name) => `${pascalCaseOperationId}${name}`;
1150
+ }
1151
+ //#endregion
1152
+ //#region src/transformers/operation-definition/utils/rewrite-additional-properties-for-parameter.ts
1153
+ const PARAMETER_AP_SCHEMAS = {
1154
+ query: { oneOf: [
1155
+ { type: "string" },
1156
+ { type: "number" },
1157
+ { type: "integer" },
1158
+ { type: "null" }
1159
+ ] },
1160
+ path: { oneOf: [
1161
+ { type: "string" },
1162
+ { type: "number" },
1163
+ { type: "integer" },
1164
+ { type: "boolean" },
1165
+ { type: "null" }
1166
+ ] },
1167
+ header: { oneOf: [
1168
+ { type: "string" },
1169
+ { type: "number" },
1170
+ { type: "integer" }
1171
+ ] }
1172
+ };
1173
+ /**
1174
+ * Recursively rewrite `additionalProperties` in object schemas for parameter types.
1175
+ * When additionalProperties is `true` or `undefined`, replace it with a keq-compatible schema
1176
+ * based on the parameter location (query/path/header).
1177
+ */
1178
+ function rewriteAdditionalPropertiesForParameter(schema, parameterIn) {
1179
+ if (JsonSchemaUtils.isRef(schema)) return schema;
1180
+ if (typeof schema === "boolean") return schema;
1181
+ const replacement = PARAMETER_AP_SCHEMAS[parameterIn];
1182
+ if (!replacement) return schema;
1183
+ const cloned = { ...schema };
1184
+ if (cloned.type === "object" || cloned.properties) {
1185
+ if (cloned.additionalProperties === true || cloned.additionalProperties === void 0) cloned.additionalProperties = replacement;
1186
+ else if (typeof cloned.additionalProperties === "object" && !JsonSchemaUtils.isRef(cloned.additionalProperties)) cloned.additionalProperties = rewriteAdditionalPropertiesForParameter(cloned.additionalProperties, parameterIn);
1187
+ }
1188
+ if (cloned.properties) cloned.properties = Object.fromEntries(Object.entries(cloned.properties).map(([key, value]) => [key, rewriteAdditionalPropertiesForParameter(value, parameterIn)]));
1189
+ if (cloned.items && typeof cloned.items === "object" && !Array.isArray(cloned.items)) cloned.items = rewriteAdditionalPropertiesForParameter(cloned.items, parameterIn);
1190
+ for (const keyword of [
1191
+ "allOf",
1192
+ "oneOf",
1193
+ "anyOf"
1194
+ ]) if (cloned[keyword]) cloned[keyword] = cloned[keyword].map((s) => rewriteAdditionalPropertiesForParameter(s, parameterIn));
1195
+ return cloned;
1196
+ }
1197
+ //#endregion
1198
+ //#region src/utils/openapi-utils/dereference.ts
1199
+ function dereference($ref, swagger) {
1200
+ let value;
1201
+ for (const key of $ref.split("/")) {
1202
+ if (key === "#") value = swagger;
1203
+ else value = value[key];
1204
+ if (!value) break;
1205
+ }
1206
+ return value;
1207
+ }
1208
+ //#endregion
1209
+ //#region src/utils/openapi-utils/is-ref-defined.ts
1210
+ function isRefDefined($ref, swagger) {
1211
+ if ($ref.startsWith("#/")) {
1212
+ const path = $ref.replace("#/", "").split("/");
1213
+ return R.path(path, swagger) !== void 0;
1214
+ }
1215
+ return false;
1216
+ }
1217
+ //#endregion
1218
+ //#region src/utils/openapi-utils/remove-undefined-ref.ts
1219
+ function removeUndefinedRef(swagger) {
1220
+ const shadow = R.clone(swagger);
1221
+ const matches = JSONPath({
1222
+ path: "$..*['$ref']^",
1223
+ json: swagger,
1224
+ resultType: "all"
1225
+ });
1226
+ for (const match of matches) if (match.value.$ref && !isRefDefined(match.value.$ref, swagger)) jsonpointer.set(shadow, match.pointer, R.omit(["$ref"], match.value));
1227
+ return shadow;
1228
+ }
1229
+ //#endregion
1230
+ //#region src/utils/openapi-utils/dereference-operation.ts
1231
+ function dereferencePathObject(swagger) {
1232
+ const matches = JSONPath({
1233
+ path: "$.paths.*.$ref^",
1234
+ json: swagger,
1235
+ resultType: "all"
1236
+ });
1237
+ for (const match of matches) {
1238
+ const value = dereference(match.value.$ref, swagger);
1239
+ jsonpointer.set(swagger, match.pointer, value);
1240
+ }
1241
+ }
1242
+ function dereferenceRequestBody(swagger) {
1243
+ const matches = JSONPath({
1244
+ path: "$.paths.*.*.requestBody.$ref^",
1245
+ json: swagger,
1246
+ resultType: "all"
1247
+ });
1248
+ for (const match of matches) {
1249
+ const value = dereference(match.value.$ref, swagger);
1250
+ jsonpointer.set(swagger, match.pointer, value);
1251
+ }
1252
+ }
1253
+ function dereferenceResponses(swagger) {
1254
+ const responseMatches = JSONPath({
1255
+ path: "$.paths.*.*.responses.*.$ref^",
1256
+ json: swagger,
1257
+ resultType: "all"
1258
+ });
1259
+ for (const match of responseMatches) if (match.value.$ref && !match.value.$ref.startsWith("#/components/responses/")) {
1260
+ const value = dereference(match.value.$ref, swagger);
1261
+ jsonpointer.set(swagger, match.pointer, value);
1262
+ }
1263
+ const headerMatches = JSONPath({
1264
+ path: "$.paths.*.*.responses.*.headers.*.$ref^",
1265
+ json: swagger,
1266
+ resultType: "all"
1267
+ });
1268
+ for (const match of headerMatches) {
1269
+ const value = dereference(match.value.$ref, swagger);
1270
+ jsonpointer.set(swagger, match.pointer, value);
1271
+ }
1272
+ }
1273
+ function dereferenceParameters(swagger) {
1274
+ const matches = JSONPath({
1275
+ path: "$.paths.*.*.parameters.*.$ref^",
1276
+ json: swagger,
1277
+ resultType: "all"
1278
+ });
1279
+ for (const match of matches) {
1280
+ const value = dereference(match.value.$ref, swagger);
1281
+ jsonpointer.set(swagger, match.pointer, value);
1282
+ }
1283
+ }
1284
+ function dereferenceOperation(swagger) {
1285
+ const shadow = R.clone(swagger);
1286
+ dereferencePathObject(shadow);
1287
+ dereferenceRequestBody(shadow);
1288
+ dereferenceResponses(shadow);
1289
+ dereferenceParameters(shadow);
1290
+ return removeUndefinedRef(shadow);
1291
+ }
1292
+ //#endregion
1293
+ //#region src/utils/openapi-utils/dereference-deep.ts
1294
+ function dereferenceDeep($ref, swagger) {
1295
+ const stack = [$ref];
1296
+ let value;
1297
+ while (true) {
1298
+ const last = stack[stack.length - 1];
1299
+ value = dereference(last, swagger);
1300
+ if (JsonSchemaUtils.isRef(value)) if (!stack.includes(value.$ref)) {
1301
+ stack.push(value.$ref);
1302
+ continue;
1303
+ } else throw new Error(`Circular reference detected: ${stack.join(" -> ")} -> ${value.$ref}`);
1304
+ break;
1305
+ }
1306
+ return value;
1307
+ }
1308
+ //#endregion
1309
+ //#region src/utils/openapi-utils/to-3_1.ts
1310
+ function To3_1(openapi) {
1311
+ const { specification } = upgrade(openapi);
1312
+ return specification;
1313
+ }
1314
+ //#endregion
1315
+ //#region src/utils/openapi-utils/map-operation.ts
1316
+ function mapOperation(specification, mapper) {
1317
+ const shadow = R.clone(specification);
1318
+ for (const [pathname, pathItem] of Object.entries(shadow.paths || {})) for (const m in pathItem) {
1319
+ const method = m.toLowerCase();
1320
+ if (!SupportedMethods.includes(method)) continue;
1321
+ if (typeof pathItem[m] !== "object" || Array.isArray(pathItem[m]) || pathItem[m] === null) continue;
1322
+ const operation = pathItem[m];
1323
+ pathItem[m] = mapper(method, pathname, operation);
1324
+ }
1325
+ return shadow;
1326
+ }
1327
+ //#endregion
1328
+ //#region src/utils/openapi-utils/map-parameter.ts
1329
+ function mapParameter(specification, mapper) {
1330
+ return mapOperation(specification, (method, pathname, operation) => {
1331
+ if (!operation.parameters) return operation;
1332
+ operation.parameters = operation.parameters.map((parameter) => mapper(method, pathname, operation, parameter));
1333
+ return operation;
1334
+ });
1335
+ }
1336
+ //#endregion
1337
+ //#region src/utils/openapi-utils/map-schema.ts
1338
+ function walkSchema(schema, mapper) {
1339
+ if (!schema) return schema;
1340
+ if (typeof schema === "boolean") return schema;
1341
+ if ("$ref" in schema) return schema;
1342
+ let result = mapper(schema);
1343
+ if (result.properties) {
1344
+ const newProperties = {};
1345
+ for (const [key, value] of Object.entries(result.properties)) newProperties[key] = walkSchema(value, mapper);
1346
+ result = Object.assign({}, result, { properties: newProperties });
1347
+ }
1348
+ if (typeof result.additionalProperties === "object" && result.additionalProperties !== null && !("$ref" in result.additionalProperties)) result = Object.assign({}, result, { additionalProperties: walkSchema(result.additionalProperties, mapper) });
1349
+ if ("items" in result && result.items && typeof result.items === "object" && !Array.isArray(result.items)) result = Object.assign({}, result, { items: walkSchema(result.items, mapper) });
1350
+ for (const keyword of [
1351
+ "allOf",
1352
+ "oneOf",
1353
+ "anyOf"
1354
+ ]) if (result[keyword]) result = Object.assign({}, result, { [keyword]: result[keyword].map((s) => walkSchema(s, mapper)) });
1355
+ return result;
1356
+ }
1357
+ function walkMediaTypeSchemas(content, mapper) {
1358
+ if (!content) return;
1359
+ for (const mediaType of Object.values(content)) if (mediaType.schema) mediaType.schema = walkSchema(mediaType.schema, mapper);
1360
+ }
1361
+ /**
1362
+ * Recursively walk and transform every non-`$ref` schema in an OpenAPI 3.1 document.
1363
+ *
1364
+ * Returns a **deep clone** of the document — the original is never mutated.
1365
+ * The `mapper` is called on each `SchemaObject` (skipping `$ref` and `boolean` schemas),
1366
+ * and then `mapSchema` continues into the mapper's return value to process nested schemas
1367
+ * (`properties`, `additionalProperties`, `items`, `allOf`/`oneOf`/`anyOf`).
1368
+ *
1369
+ * Traversal covers:
1370
+ * - `components.schemas`
1371
+ * - Inline schemas in operation parameters, request bodies, and responses
1372
+ *
1373
+ * @example
1374
+ * // Set `additionalProperties: false` on every object schema that doesn't define it
1375
+ * const patched = mapSchema(doc, (schema) => {
1376
+ * if ((schema.type === 'object' || schema.properties) && schema.additionalProperties === undefined) {
1377
+ * return Object.assign({}, schema, { additionalProperties: false })
1378
+ * }
1379
+ * return schema
1380
+ * })
1381
+ *
1382
+ * @example
1383
+ * // Add a `description` fallback to all string schemas
1384
+ * const annotated = mapSchema(doc, (schema) => {
1385
+ * if (schema.type === 'string' && !schema.description) {
1386
+ * return Object.assign({}, schema, { description: 'No description provided' })
1387
+ * }
1388
+ * return schema
1389
+ * })
1390
+ */
1391
+ function mapSchema(specification, mapper) {
1392
+ const shadow = R.clone(specification);
1393
+ if (shadow.components?.schemas) for (const [name, schema] of Object.entries(shadow.components.schemas)) shadow.components.schemas[name] = walkSchema(schema, mapper);
1394
+ for (const [, pathItem] of Object.entries(shadow.paths || {})) for (const m in pathItem) {
1395
+ const method = m.toLowerCase();
1396
+ if (!SupportedMethods.includes(method)) continue;
1397
+ if (typeof pathItem[m] !== "object" || Array.isArray(pathItem[m]) || pathItem[m] === null) continue;
1398
+ const operation = pathItem[m];
1399
+ if (operation.parameters) for (const param of operation.parameters) {
1400
+ if ("$ref" in param) continue;
1401
+ if (param.schema) param.schema = walkSchema(param.schema, mapper);
1402
+ }
1403
+ if (operation.requestBody && !("$ref" in operation.requestBody)) walkMediaTypeSchemas(operation.requestBody.content, mapper);
1404
+ if (operation.responses) for (const response of Object.values(operation.responses)) {
1405
+ if ("$ref" in response) continue;
1406
+ walkMediaTypeSchemas(response.content, mapper);
1407
+ }
1408
+ }
1409
+ return shadow;
1410
+ }
1411
+ //#endregion
1412
+ //#region src/utils/openapi-utils/index.ts
1413
+ var OpenapiUtils = class {
1414
+ static isRefDefined = isRefDefined;
1415
+ static dereference = dereference;
1416
+ static dereferenceDeep = dereferenceDeep;
1417
+ static removeUndefinedRef = removeUndefinedRef;
1418
+ static dereferenceOperation = dereferenceOperation;
1419
+ static mapOperation = mapOperation;
1420
+ static mapParameter = mapParameter;
1421
+ static mapSchema = mapSchema;
1422
+ static to3_1 = To3_1;
1423
+ };
1424
+ //#endregion
1425
+ //#region src/transformers/operation-definition/declaration.renderer.ts
1426
+ const alias = (name) => `${name}Schema`;
1427
+ const responseAlias = (name) => `${name}Response`;
1428
+ var DeclarationRenderer = class {
1429
+ typeName;
1430
+ constructor(operationDefinition, options) {
1431
+ this.operationDefinition = operationDefinition;
1432
+ this.options = options;
1433
+ this.typeName = typeNameFactory(operationDefinition);
1434
+ }
1435
+ renderResponseBodies(operation, options) {
1436
+ if (!operation.responses || R.isEmpty(operation.responses)) return `export interface ${this.typeName("ResponseBodies")} {}`;
1437
+ const $responses = Object.entries(operation.responses).map(([statusCode, response]) => {
1438
+ if (JsonSchemaUtils.isRef(response)) return indent(2, `${statusCode}: ${responseAlias(response.$ref.split("/").pop() || "")}`);
1439
+ return indent(2, `${statusCode}: ${Object.entries(response.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schema]) => {
1440
+ if (mediaType.includes("text/event-stream")) return "ReadableStream<ServerSentEvent>";
1441
+ if (mediaType.includes("multipart/form-data")) return "FormData";
1442
+ if (!schema) return "unknown";
1443
+ return JsonSchemaTransformer.toDeclaration(schema, options);
1444
+ }).join(" | ") || "void"}`);
1445
+ }).join("\n");
1446
+ return [
1447
+ `export interface ${this.typeName("ResponseBodies")} {`,
1448
+ $responses,
1449
+ "}"
1450
+ ].join("\n");
1451
+ }
1452
+ renderRequestBodies(operation, options) {
1453
+ let $requestBodies = `export interface ${this.typeName("RequestBodies")} {}`;
1454
+ if (operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody)) {
1455
+ const $mediaTypes = Object.entries(operation.requestBody.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schema]) => {
1456
+ if (!schema) return `${JSON.stringify(mediaType)}: unknown`;
1457
+ return `${JSON.stringify(mediaType)}: ${JsonSchemaTransformer.toDeclaration(schema, options)}`;
1458
+ }).map((pair) => indent(2, pair));
1459
+ $requestBodies = [
1460
+ `export interface ${this.typeName("RequestBodies")} {`,
1461
+ ...$mediaTypes,
1462
+ "}"
1463
+ ].join("\n");
1464
+ }
1465
+ return $requestBodies;
1466
+ }
1467
+ renderParameterBodies(operationDefinition, options) {
1468
+ const { operation } = operationDefinition;
1469
+ let parameterBodies = "";
1470
+ if (operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody)) {
1471
+ const $mediaTypes = Object.entries(operation.requestBody.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schemaOrRef]) => {
1472
+ if (!schemaOrRef) return `${JSON.stringify(mediaType)}: unknown`;
1473
+ const schema = JsonSchemaUtils.isRef(schemaOrRef) ? OpenapiUtils.dereferenceDeep(schemaOrRef.$ref, operationDefinition.document.specification) : schemaOrRef;
1474
+ if (schema.type === "object" || schema.properties) return `${JSON.stringify(mediaType)}: ${JsonSchemaTransformer.toDeclaration(schemaOrRef, options)} & { [key: string]: any }`;
1475
+ return `${JSON.stringify(mediaType)}: { [key: string]: any }`;
1476
+ }).map((pair) => indent(2, pair));
1477
+ parameterBodies = [
1478
+ `interface ${this.typeName("ParameterBodies")} {`,
1479
+ ...$mediaTypes,
1480
+ "}",
1481
+ ""
1482
+ ].join("\n");
1483
+ }
1484
+ return parameterBodies;
1485
+ }
1486
+ renderRequestParameters(operation, options) {
1487
+ const mediaTypes = operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody) ? Object.keys(operation.requestBody.content || {}) : [];
1488
+ const base = `${this.typeName("RequestQuery")} & ${this.typeName("RouteParameters")} & ${this.typeName("RequestHeaders")}`;
1489
+ if (mediaTypes.length === 1) return `export type ${this.typeName("RequestParameters")} = ${base} & ${this.typeName("RequestBodies")}[${JSON.stringify(mediaTypes[0])}]`;
1490
+ if (mediaTypes.length > 1) {
1491
+ const unions = mediaTypes.map((mediaType) => `(${base} & ${this.typeName("RequestBodies")}[${JSON.stringify(mediaType)}] & { "content-type": ${JSON.stringify(mediaType)} })`).join("\n| ");
1492
+ return `export type ${this.typeName("RequestParameters")} = ${unions}`;
1493
+ }
1494
+ return `export type ${this.typeName("RequestParameters")} = ${base}`;
1495
+ }
1496
+ rendererParameters(name, parameters, options) {
1497
+ if (parameters.length === 0) return `export type ${name} = {}`;
1498
+ const $parameters = parameters.map((parameter) => {
1499
+ const parameterName = `"${parameter.name}"`;
1500
+ const $key = parameter.required ? parameterName : `${parameterName}?`;
1501
+ const schema = parameter.schema ? rewriteAdditionalPropertiesForParameter(parameter.schema, parameter.in) : { type: "any" };
1502
+ return indent(2, `${$key}: ${JsonSchemaTransformer.toDeclaration(schema, options)}`);
1503
+ }).join("\n");
1504
+ return [
1505
+ `export type ${name} = {`,
1506
+ $parameters,
1507
+ "}"
1508
+ ].filter(Boolean).join("\n");
1509
+ }
1510
+ renderDependencies() {
1511
+ const $schemaDefinitions = this.operationDefinition.getDependencies().filter((schemaDefinition) => !SchemaDefinition.isUnknown(schemaDefinition)).map((schemaDefinition) => {
1512
+ const filepath = this.options.getDependentSchemaDefinitionFilepath(schemaDefinition);
1513
+ const schemaName = schemaDefinition.name;
1514
+ return `import type { ${schemaName} as ${alias(schemaName)} } from "${filepath}"`;
1515
+ }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? " from \"$1.js\"" : " from \"$1\""));
1516
+ const $responseDefinitions = this.operationDefinition.getResponseDependencies().filter((responseDefinition) => !ResponseDefinition.isUnknown(responseDefinition)).map((responseDefinition) => {
1517
+ const filepath = this.options.getDependentResponseDefinitionFilepath(responseDefinition);
1518
+ const responseName = responseDefinition.name;
1519
+ return `import type { ${responseName} as ${responseAlias(responseName)} } from "${filepath}"`;
1520
+ }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? " from \"$1.js\"" : " from \"$1\""));
1521
+ return [
1522
+ "import type { KeqOperation, KeqPathParameterInit, KeqQueryInit, ServerSentEvent } from \"keq\"",
1523
+ ...$schemaDefinitions,
1524
+ ...$responseDefinitions
1525
+ ].join("\n");
1526
+ }
1527
+ render() {
1528
+ const { operation } = this.operationDefinition;
1529
+ if (!operation.responses) return "";
1530
+ const hint = `Referenced from operation "${this.operationDefinition.method.toUpperCase()} ${this.operationDefinition.pathname}".`;
1531
+ const jsonSchemaDeclarationRendererOptions = {
1532
+ referenceTransformer: (schema) => {
1533
+ if (schema.$ref && schema.$ref.startsWith("#") && !this.operationDefinition.document.isRefDefined(schema.$ref)) return ReferenceTransformer.toNotFoundDeclaration(schema, hint);
1534
+ return ReferenceTransformer.toDeclaration(schema, alias);
1535
+ },
1536
+ additionalPropertiesType: this.options.additionalPropertiesType
1537
+ };
1538
+ const $dependencies = this.renderDependencies();
1539
+ const $responseBodies = this.renderResponseBodies(operation, jsonSchemaDeclarationRendererOptions);
1540
+ const $requestBodies = this.renderRequestBodies(operation, jsonSchemaDeclarationRendererOptions);
1541
+ const $parameterBodies = this.renderParameterBodies(this.operationDefinition, jsonSchemaDeclarationRendererOptions);
1542
+ const $requestParameters = this.renderRequestParameters(operation, jsonSchemaDeclarationRendererOptions);
1543
+ return [
1544
+ "/* @anchor:file:start */",
1545
+ "",
1546
+ $dependencies,
1547
+ "",
1548
+ $responseBodies,
1549
+ "",
1550
+ $requestBodies,
1551
+ "",
1552
+ this.rendererParameters(`${this.typeName("RequestQuery")}`, operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "query") || [], jsonSchemaDeclarationRendererOptions),
1553
+ "",
1554
+ this.rendererParameters(`${this.typeName("RouteParameters")}`, operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "path") || [], jsonSchemaDeclarationRendererOptions),
1555
+ "",
1556
+ this.rendererParameters(`${this.typeName("RequestHeaders")}`, operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "header") || [], jsonSchemaDeclarationRendererOptions),
1557
+ "",
1558
+ $parameterBodies || void 0,
1559
+ $requestParameters,
1560
+ "",
1561
+ `export interface ${this.typeName("Operation")}<STATUS extends keyof ${this.typeName("ResponseBodies")}, CONTENT_TYPE extends ${$parameterBodies ? `keyof ${this.typeName("ParameterBodies")}` : "string"} > extends KeqOperation {`,
1562
+ ` requestParams: ${this.typeName("RouteParameters")} & { [key: string]: KeqPathParameterInit }`,
1563
+ ` requestQuery: ${this.typeName("RequestQuery")} & { [key: string]: KeqQueryInit }`,
1564
+ ` requestHeaders: ${this.typeName("RequestHeaders")} & { [key: string]: string | number }`,
1565
+ ` requestBody: ${$parameterBodies ? `${this.typeName("ParameterBodies")}[CONTENT_TYPE] | ` : "object | "}BodyInit`,
1566
+ ` responseBody: ${this.typeName("ResponseBodies")}[STATUS]`,
1567
+ "}",
1568
+ "",
1569
+ "/* @anchor:file:end */"
1570
+ ].filter(R.isNotNil).join("\n");
1571
+ }
1572
+ };
1573
+ //#endregion
1574
+ //#region src/utils/to-safe-identifier.ts
1575
+ /**
1576
+ * Check if a string is a valid JavaScript/TypeScript identifier.
1577
+ */
1578
+ function isValidIdentifier(str) {
1579
+ return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(str);
1580
+ }
1581
+ /**
1582
+ * Convert a string to a valid JavaScript/TypeScript identifier.
1583
+ * If the string is already a valid identifier, return it as-is.
1584
+ * Otherwise, convert it to camelCase and ensure it starts with a valid character.
1585
+ */
1586
+ function toSafeIdentifier(str) {
1587
+ if (isValidIdentifier(str)) return str;
1588
+ const camelCased = changeCase.camelCase(str);
1589
+ if (!camelCased) return `_${str.replace(/[^a-zA-Z0-9_$]/g, "_")}`;
1590
+ if (/^[0-9]/.test(camelCased)) return `_${camelCased}`;
1591
+ if (!isValidIdentifier(camelCased)) return `_${camelCased.replace(/[^a-zA-Z0-9_$]/g, "_")}`;
1592
+ return camelCased;
1593
+ }
1594
+ //#endregion
1595
+ //#region src/exception.ts
1596
+ var Exception = class extends CustomError {
1597
+ constructor(module, message) {
1598
+ const moduleName = typeof module === "string" ? module : module.name;
1599
+ const msg = wrap(message, {
1600
+ width: 60,
1601
+ indent: " "
1602
+ });
1603
+ super(`${moduleName} module failed to compile:\n${msg}`);
1604
+ Object.defineProperty(this, "name", { value: "KeqCLI_Exception" });
1605
+ }
1606
+ };
1607
+ //#endregion
1608
+ //#region src/transformers/operation-definition/typescript-snippet.ts
1609
+ var OperationDefinitionSnippet = class {
1610
+ typeName;
1611
+ constructor(operationDefinition, options) {
1612
+ this.operationDefinition = operationDefinition;
1613
+ this.options = options;
1614
+ this.typeName = typeNameFactory(operationDefinition);
1615
+ }
1616
+ getQsParameters(parameter) {
1617
+ let arrayFormat;
1618
+ let allowDots;
1619
+ let indices;
1620
+ const style = parameter.style || "form";
1621
+ const explode = parameter.explode ?? true;
1622
+ if ("x-qs-array-format" in parameter) arrayFormat = parameter["x-qs-array-format"];
1623
+ else if (style === "deepObject") arrayFormat = "brackets";
1624
+ else if (explode) arrayFormat = "repeat";
1625
+ else if (style === "form") arrayFormat = "comma";
1626
+ else if (style === "spaceDelimited") arrayFormat = "space";
1627
+ else if (style === "pipeDelimited") arrayFormat = "pipe";
1628
+ if ("x-qs-allow-dots" in parameter) allowDots = Boolean(parameter["x-qs-allow-dots"]);
1629
+ if ("x-qs-indices" in parameter) indices = Boolean(parameter["x-qs-indices"]);
1630
+ if (arrayFormat || allowDots !== void 0 || indices !== void 0) return {
1631
+ ...arrayFormat ? { arrayFormat } : {},
1632
+ ...allowDots !== void 0 ? { allowDots } : {},
1633
+ ...indices !== void 0 ? { indices } : {}
1634
+ };
1635
+ }
1636
+ renderRequestHeaders() {
1637
+ const { operation } = this.operationDefinition;
1638
+ return (operation.parameters || []).filter((p) => !JsonSchemaUtils.isRef(p)).filter((p) => p.in === "header").map((p) => `if (args && ${JSON.stringify(p.name)} in args) req.header(${JSON.stringify(p.name)}, args[${JSON.stringify(p.name)}])`).join("\n");
1639
+ }
1640
+ renderRequestQuery() {
1641
+ const { operation } = this.operationDefinition;
1642
+ return (operation.parameters || []).filter((p) => !JsonSchemaUtils.isRef(p)).filter((p) => p.in === "query").map((p) => {
1643
+ const option = this.getQsParameters(p);
1644
+ const $option = !option || R.isEmpty(option) ? "" : `, ${JSON.stringify(option)}`;
1645
+ return `if (args && ${JSON.stringify(p.name)} in args) req.query(${JSON.stringify(p.name)}, args[${JSON.stringify(p.name)}]${$option})`;
1646
+ }).join("\n");
1647
+ }
1648
+ renderRequestPathParameters() {
1649
+ const { operation } = this.operationDefinition;
1650
+ return (operation.parameters || []).filter((p) => !JsonSchemaUtils.isRef(p)).filter((p) => p.in === "path").map((p) => `if (args && ${JSON.stringify(p.name)} in args) req.params(${JSON.stringify(p.name)}, args[${JSON.stringify(p.name)}])`).join("\n");
1651
+ }
1652
+ getRequestMediaTypes() {
1653
+ const { operation } = this.operationDefinition;
1654
+ const requestBodyContent = operation.requestBody?.content || {};
1655
+ return Object.keys(requestBodyContent);
1656
+ }
1657
+ renderMediaType() {
1658
+ const mediaTypes = this.getRequestMediaTypes();
1659
+ if (mediaTypes.length === 1 && !mediaTypes[0].endsWith("/*")) return `req.type("${mediaTypes[0]}")\n`;
1660
+ else if (mediaTypes.some((mediaType) => mediaType === "*/*")) {} else if (mediaTypes.some((mediaType) => mediaType.endsWith("/*"))) return "if(args?.[\"content-type\"]) req.type(args[\"content-type\"])\n";
1661
+ else if (mediaTypes.length > 1) return "if(args?.[\"content-type\"]) req.type(args[\"content-type\"])\n";
1662
+ return "";
1663
+ }
1664
+ requestBodyFormDataPropertyRenderer(propertyName, propertySchema, mediaType) {
1665
+ try {
1666
+ const $propertyName = JSON.stringify(propertyName);
1667
+ const schema = JsonSchemaUtils.isRef(propertySchema) ? OpenapiUtils.dereferenceDeep(propertySchema.$ref, this.operationDefinition.document.specification) : propertySchema;
1668
+ if (schema.type === "string" && schema.format === "binary" || schema.contentMediaType === "application/octet-stream") return `if (args && ${$propertyName} in args && args[${$propertyName}]) req.attach(${$propertyName}, args[${$propertyName}])`;
1669
+ else if (schema.type === "string" || schema.type === "array" && schema.items && schema.items.type === "string") return `if (args && ${$propertyName} in args && args[${$propertyName}] !== undefined) req.field(${$propertyName}, args[${$propertyName}])`;
1670
+ else if (schema.type === "number" || schema.type === "integer") return `if (args && ${$propertyName} in args && args[${$propertyName}] !== undefined) req.field(${$propertyName}, String(args[${$propertyName}]))`;
1671
+ return `if (args && ${$propertyName} in args && args[${$propertyName}] !== undefined) req.field(${$propertyName}, String(args[${$propertyName}]) /* type is non-string in schema; triggers type coercion here */)`;
1672
+ } catch (err) {
1673
+ return this.renderErrorComment(err, mediaType);
1674
+ }
1675
+ }
1676
+ requestBodyPropertyRenderer(propertyName, propertySchema, mediaType) {
1677
+ if (mediaType === "application/json") {
1678
+ const $propertyName = JSON.stringify(propertyName);
1679
+ return `if (args && ${$propertyName} in args) req.send({ ${$propertyName}: args[${$propertyName}] })`;
1680
+ } else if (mediaType === "multipart/form-data") return this.requestBodyFormDataPropertyRenderer(propertyName, propertySchema, mediaType);
1681
+ else throw new Error(`Unsupported media type: ${mediaType}`);
1682
+ }
1683
+ renderRequestBody() {
1684
+ const { operation } = this.operationDefinition;
1685
+ const requestBodyContent = operation.requestBody?.content || {};
1686
+ return Object.entries(requestBodyContent).map(([mediaType, mediaTypeObject]) => {
1687
+ if (!mediaTypeObject.schema) return;
1688
+ try {
1689
+ const schema = JsonSchemaUtils.isRef(mediaTypeObject.schema) ? OpenapiUtils.dereferenceDeep(mediaTypeObject.schema.$ref, this.operationDefinition.document.specification) : mediaTypeObject.schema;
1690
+ if (schema.type !== "object") return;
1691
+ const properties = schema.properties || {};
1692
+ return Object.entries(properties).map(([propertyName, propertySchema]) => this.requestBodyPropertyRenderer(propertyName, propertySchema, mediaType)).join("\n");
1693
+ } catch (err) {
1694
+ return this.renderErrorComment(err, mediaType);
1695
+ }
1696
+ }).filter(R.isNotNil).join("\n");
1697
+ }
1698
+ renderErrorComment(err, mediaType) {
1699
+ const $err = String(err).split("\n").map(((line) => ` * ${line}`)).join("\n");
1700
+ return [
1701
+ "/**",
1702
+ ` * Unable to dereference schema for media type ${mediaType}`,
1703
+ $err,
1704
+ " */"
1705
+ ].join("\n");
1706
+ }
1707
+ };
1708
+ //#endregion
1709
+ //#region src/transformers/operation-definition/micro-function.renderer.ts
1710
+ var OperationDefinitionMicroFunctionRenderer = class {
1711
+ helper;
1712
+ typeName;
1713
+ constructor(operationDefinition, options) {
1714
+ this.operationDefinition = operationDefinition;
1715
+ this.options = options;
1716
+ this.typeName = typeNameFactory(operationDefinition);
1717
+ this.helper = new OperationDefinitionSnippet(operationDefinition, options);
1718
+ }
1719
+ get operationId() {
1720
+ return toSafeIdentifier(this.operationDefinition.operationId);
1721
+ }
1722
+ render() {
1723
+ const { operation, method, pathname } = this.operationDefinition;
1724
+ if (!operation.responses) return "";
1725
+ const operationId = this.operationId;
1726
+ const $dependencies = this.renderDependencies();
1727
+ const $comment = new CommentRenderer(this.operationDefinition).render();
1728
+ const $method = method.toLowerCase();
1729
+ const $queryParameters = this.helper.renderRequestQuery();
1730
+ const $headerParameters = this.helper.renderRequestHeaders();
1731
+ const $pathParameters = this.helper.renderRequestPathParameters();
1732
+ const $mediaType = this.helper.renderMediaType();
1733
+ const $requestBody = this.helper.renderRequestBody();
1734
+ const $operationDeclaration = this.renderOperationDeclaration();
1735
+ return [
1736
+ "/* @anchor:file:start */",
1737
+ "",
1738
+ $dependencies,
1739
+ "",
1740
+ `const method = "${method}"`,
1741
+ `const pathname = "${pathname}"`,
1742
+ "",
1743
+ $comment || void 0,
1744
+ `export ${$operationDeclaration} {`,
1745
+ ` const req = request.${$method}<${this.typeName("ResponseBodies")}[STATUS]>("${pathname}")`,
1746
+ "",
1747
+ $mediaType ? indent(2, $mediaType) : void 0,
1748
+ " /* @anchor:query:start */",
1749
+ $queryParameters ? indent(2, $queryParameters) : void 0,
1750
+ " /* @anchor:query:end */",
1751
+ "",
1752
+ " /* @anchor:headers:start */",
1753
+ $headerParameters ? indent(2, $headerParameters) : void 0,
1754
+ " /* @anchor:headers:end */",
1755
+ "",
1756
+ " /* @anchor:path-parameters:start */",
1757
+ $pathParameters ? indent(2, $pathParameters) : void 0,
1758
+ " /* @anchor:path-parameters:end */",
1759
+ "",
1760
+ " /* @anchor:body:start */",
1761
+ $requestBody ? indent(2, $requestBody) : void 0,
1762
+ " /* @anchor:body:end */",
1763
+ "",
1764
+ " /* @anchor:operation-return */",
1765
+ ` return req as ReturnType<typeof ${operationId}<STATUS${$operationDeclaration.includes("CONTENT_TYPE") ? ", CONTENT_TYPE" : ""}>>`,
1766
+ "}",
1767
+ "",
1768
+ `${operationId}.pathname = pathname`,
1769
+ `${operationId}.method = method`,
1770
+ "/* @anchor:file:end */"
1771
+ ].filter(R.isNotNil).join("\n");
1772
+ }
1773
+ renderDependencies() {
1774
+ const declarationFilepath = this.options.getOperationDefinitionDeclarationFilepath(this.operationDefinition);
1775
+ return [
1776
+ "import { Keq } from \"keq\"",
1777
+ `import { request } from "${this.options.getRequestFilepath()}"`,
1778
+ `import type { ${this.typeName("Operation")}, ${this.typeName("ResponseBodies")}, ${this.typeName("RequestParameters")} } from "${declarationFilepath}"`,
1779
+ `export type { ${this.typeName("RequestQuery")}, ${this.typeName("RequestHeaders")}, ${this.typeName("RequestBodies")} } from "${declarationFilepath}"`
1780
+ ].map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? " from \"$1.js\"" : " from \"$1\"")).join("\n");
1781
+ }
1782
+ renderOperationDeclaration() {
1783
+ const operationId = this.operationId;
1784
+ const mediaTypes = this.helper.getRequestMediaTypes();
1785
+ if (mediaTypes.length === 0) return `function ${operationId}<STATUS extends keyof ${this.typeName("ResponseBodies")}, CONTENT_TYPE extends never = never>(args?: ${this.typeName("RequestParameters")}): Keq<${this.typeName("Operation")}<STATUS, CONTENT_TYPE>>`;
1786
+ else if (mediaTypes.length === 1) return `function ${operationId}<STATUS extends keyof ${this.typeName("ResponseBodies")}, CONTENT_TYPE extends ${JSON.stringify(mediaTypes[0])} = ${JSON.stringify(mediaTypes[0])}>(args?: ${this.typeName("RequestParameters")}): Keq<${this.typeName("Operation")}<STATUS, CONTENT_TYPE>>`;
1787
+ else if (mediaTypes.length > 1) return `function ${operationId}<STATUS extends keyof ${this.typeName("ResponseBodies")}, CONTENT_TYPE extends ${this.typeName("RequestParameters")}["content-type"]>(args?: Extract<${this.typeName("RequestParameters")}, { "content-type": CONTENT_TYPE }>): Keq<${this.typeName("Operation")}<STATUS, CONTENT_TYPE>>`;
1788
+ throw new Exception(this.operationDefinition.module, "[operationDeclarationRenderer] Unreachable");
1789
+ }
1790
+ };
1791
+ //#endregion
1792
+ //#region src/transformers/operation-definition/nestjs-method.renderer.ts
1793
+ var OperationDefinitionNestjsMethodRenderer = class {
1794
+ helper;
1795
+ typeName;
1796
+ constructor(operationDefinition, options) {
1797
+ this.operationDefinition = operationDefinition;
1798
+ this.options = options;
1799
+ this.typeName = typeNameFactory(operationDefinition);
1800
+ this.helper = new OperationDefinitionSnippet(operationDefinition, options);
1801
+ }
1802
+ get operationId() {
1803
+ return toSafeIdentifier(this.operationDefinition.operationId);
1804
+ }
1805
+ render() {
1806
+ const pathname = this.operationDefinition.pathname;
1807
+ const $comment = new CommentRenderer(this.operationDefinition).render();
1808
+ const $method = this.operationDefinition.method.toLowerCase();
1809
+ const $mediaType = this.helper.renderMediaType();
1810
+ const $operationDeclaration = this.renderOperationDeclaration(this.operationDefinition);
1811
+ const $queryParameters = this.helper.renderRequestQuery();
1812
+ const $headerParameters = this.helper.renderRequestHeaders();
1813
+ const $pathParameters = this.helper.renderRequestPathParameters();
1814
+ const $requestBody = this.helper.renderRequestBody();
1815
+ return [
1816
+ $comment,
1817
+ `${$operationDeclaration} {`,
1818
+ ` const req = this.request.${$method}<${this.typeName("ResponseBodies")}[STATUS]>(${JSON.stringify(pathname)})`,
1819
+ "",
1820
+ $mediaType ? indent(2, $mediaType) : void 0,
1821
+ "",
1822
+ " /* @anchor:query:start */",
1823
+ $queryParameters ? indent(2, $queryParameters) : void 0,
1824
+ " /* @anchor:query:end */",
1825
+ "",
1826
+ " /* @anchor:headers:start */",
1827
+ $headerParameters ? indent(2, $headerParameters) : void 0,
1828
+ " /* @anchor:headers:end */",
1829
+ "",
1830
+ " /* @anchor:path-parameters:start */",
1831
+ $pathParameters ? indent(2, $pathParameters) : void 0,
1832
+ " /* @anchor:path-parameters:end */",
1833
+ "",
1834
+ " /* @anchor:body:start */",
1835
+ $requestBody ? indent(2, $requestBody) : void 0,
1836
+ " /* @anchor:body:end */",
1837
+ "",
1838
+ " return req",
1839
+ "}"
1840
+ ].filter(R.isNotNil).join("\n");
1841
+ }
1842
+ renderOperationDeclaration(operationDefinition) {
1843
+ const operationId = this.operationId;
1844
+ const typeName = typeNameFactory(operationDefinition);
1845
+ const mediaTypes = this.helper.getRequestMediaTypes();
1846
+ if (mediaTypes.length === 0) return `${operationId}<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends never = never>(args?: ${typeName("RequestParameters")}): Keq<${typeName("Operation")}<STATUS, CONTENT_TYPE>>`;
1847
+ else if (mediaTypes.length === 1) return `${operationId}<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends ${JSON.stringify(mediaTypes[0])} = ${JSON.stringify(mediaTypes[0])}>(args?: ${typeName("RequestParameters")}): Keq<${typeName("Operation")}<STATUS, CONTENT_TYPE>>`;
1848
+ else if (mediaTypes.length > 1) return `${operationId}<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends ${typeName("RequestParameters")}["content-type"]>(args?: Extract<${typeName("RequestParameters")}, { "content-type": CONTENT_TYPE }>): Keq<${typeName("Operation")}<STATUS, CONTENT_TYPE>>`;
1849
+ throw new Exception(operationDefinition.module, "[operationDeclarationRenderer] Unreachable");
1850
+ }
1851
+ };
1852
+ //#endregion
1853
+ //#region src/transformers/operation-definition/operation-definition.transformer.ts
1854
+ var OperationDefinitionTransformer = class {
1855
+ static toDeclaration(operationDefinition, options) {
1856
+ return new DeclarationRenderer(operationDefinition, options).render();
1857
+ }
1858
+ static toMicroFunction(operationDefinition, options) {
1859
+ return new OperationDefinitionMicroFunctionRenderer(operationDefinition, options).render();
1860
+ }
1861
+ static toNestjsMethod(operationDefinition, options) {
1862
+ return new OperationDefinitionNestjsMethodRenderer(operationDefinition, options).render();
1863
+ }
1864
+ static toComment(operationDefinition) {
1865
+ return new CommentRenderer(operationDefinition).render();
1866
+ }
1867
+ };
1868
+ //#endregion
1869
+ //#region src/transformers/entrypoint/entrypoint.transformer.ts
1870
+ var EntrypointTransformer = class {
1871
+ static toTypescript(exports, options) {
1872
+ return [
1873
+ "/* @anchor:file:start */",
1874
+ "",
1875
+ ...exports.map((exportArtifact) => {
1876
+ const relativePath = path$1.relative(options.dirpath, exportArtifact.filepath).replace(/(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?$/, options.esm ? ".js" : "");
1877
+ return relativePath.startsWith(".") ? `export * from '${relativePath}'` : `export * from './${relativePath}'`;
1878
+ }),
1879
+ "",
1880
+ "/* @anchor:file:end */"
1881
+ ].join("\n");
1882
+ }
1883
+ };
1884
+ //#endregion
1885
+ //#region src/transformers/api-document/nestjs-client.renderer.ts
1886
+ var NestjsClientRenderer = class {
1887
+ constructor(document, options) {
1888
+ this.document = document;
1889
+ this.options = options;
1890
+ }
1891
+ renderDependencies() {
1892
+ return [
1893
+ "import { Injectable, Logger } from \"@nestjs/common\"",
1894
+ "import { Keq, KeqRequest } from \"keq\"",
1895
+ ...this.document.operations.map((operationDefinition) => {
1896
+ const filepath = this.options.getOperationDefinitionDeclarationFilepath(operationDefinition);
1897
+ const typeName = typeNameFactory(operationDefinition);
1898
+ return `import type { ${typeName("Operation")}, ${typeName("ResponseBodies")}, ${typeName("RequestParameters")} } from "${filepath}"`;
1899
+ }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? " from \"$1.js\"" : " from \"$1\""))
1900
+ ].join("\n");
1901
+ }
1902
+ render() {
1903
+ const moduleName = changeCase.pascalCase(this.document.module.name);
1904
+ const $dependencies = this.renderDependencies();
1905
+ const $operations = this.document.operations.map((operation) => OperationDefinitionTransformer.toNestjsMethod(operation, { esm: this.options.esm })).join("\n\n");
1906
+ return [
1907
+ "/* @anchor:file:start */",
1908
+ "",
1909
+ $dependencies,
1910
+ "",
1911
+ "@Injectable()",
1912
+ `export class ${moduleName}Client {`,
1913
+ ` private readonly logger = new Logger(${moduleName}Client.name)`,
1914
+ "",
1915
+ " constructor(",
1916
+ " // @anchor:client-constructor-parameters:start",
1917
+ " private readonly request: KeqRequest,",
1918
+ " // @anchor:client-constructor-parameters:end",
1919
+ " ) {}",
1920
+ "",
1921
+ indent(2, $operations),
1922
+ "}",
1923
+ "",
1924
+ "/* @anchor:file:end */"
1925
+ ].filter(R.isNotNil).join("\n");
1926
+ }
1927
+ };
1928
+ //#endregion
1929
+ //#region src/transformers/api-document/nestjs-module.renderer.ts
1930
+ var NestjsModuleRenderer = class {
1931
+ constructor(document, options) {
1932
+ this.document = document;
1933
+ this.options = options;
1934
+ }
1935
+ render() {
1936
+ const moduleName = changeCase.pascalCase(this.document.module.name);
1937
+ return [
1938
+ "/* @anchor:file:start */",
1939
+ "import { Module, ConfigurableModuleBuilder, Provider } from \"@nestjs/common\"",
1940
+ "import { KeqRequest } from \"keq\"",
1941
+ "import { KeqModule, type KeqModuleOptions } from \"@keq-request/nestjs\"",
1942
+ `import { ${moduleName}Client } from "${this.options.getNestjsClientFilepath(this.document).replace(/(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?$/, this.options.esm ? ".js" : "")}"`,
1943
+ "",
1944
+ "",
1945
+ `export interface ${moduleName}ModuleOptions extends KeqModuleOptions {`,
1946
+ " /**",
1947
+ " * Whether to register the module globally.",
1948
+ " * @default false",
1949
+ " */",
1950
+ " isGlobal?: boolean",
1951
+ "}",
1952
+ "",
1953
+ `const KEQ_REQUEST_TOKEN = Symbol("${moduleName}KeqRequest")`,
1954
+ "",
1955
+ `const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN } = new ConfigurableModuleBuilder<${moduleName}ModuleOptions>()`,
1956
+ " .setExtras({ isGlobal: false }, (definition, extras) => ({",
1957
+ " ...definition,",
1958
+ " global: extras.isGlobal,",
1959
+ " }))",
1960
+ " .build()",
1961
+ "",
1962
+ "const REQUEST_PROVIDER: Provider = {",
1963
+ " provide: KEQ_REQUEST_TOKEN,",
1964
+ ` useFactory: (options: ${moduleName}ModuleOptions, globalRequest?: KeqRequest) => {`,
1965
+ "",
1966
+ " if (!options.isolate && !globalRequest) {",
1967
+ ` console.warn("${moduleName}Module: No global KeqRequest found, creating an isolated instance. Import KeqModule globally or set { isolate: true } to suppress this warning.")`,
1968
+ " }",
1969
+ "",
1970
+ " const request = (!options.isolate && globalRequest)",
1971
+ " ? globalRequest.fork()",
1972
+ " : new KeqRequest()",
1973
+ "",
1974
+ " if (options.middlewares) {",
1975
+ " for (const middleware of options.middlewares) {",
1976
+ " request.use(middleware)",
1977
+ " }",
1978
+ " }",
1979
+ "",
1980
+ " return request",
1981
+ " },",
1982
+ " inject: [",
1983
+ " MODULE_OPTIONS_TOKEN,",
1984
+ " { token: KeqRequest, optional: true },",
1985
+ " ],",
1986
+ "}",
1987
+ "",
1988
+ "const CLIENT_PROVIDER: Provider = {",
1989
+ ` provide: ${moduleName}Client,`,
1990
+ ` useFactory: (request: KeqRequest) => new ${moduleName}Client(request),`,
1991
+ " inject: [KEQ_REQUEST_TOKEN],",
1992
+ "}",
1993
+ "",
1994
+ "/**",
1995
+ ` * NestJS module that provides the {@link ${moduleName}Client} for dependency injection.`,
1996
+ " *",
1997
+ " * This module requires a `KeqRequest` instance, which can be provided in two ways:",
1998
+ " *",
1999
+ " * **Option 1: Use the global `KeqModule` (recommended)**",
2000
+ " *",
2001
+ " * Import `KeqModule` globally, then register this module.",
2002
+ " * The module will fork from the global KeqRequest and inherit its middlewares.",
2003
+ " *",
2004
+ " * ```typescript",
2005
+ " * // app.module.ts",
2006
+ " * import { KeqModule } from '@keq-request/nestjs'",
2007
+ " * ",
2008
+ " * @Module({",
2009
+ " * imports: [",
2010
+ " * KeqModule,",
2011
+ ` * ${moduleName}Module.register({`,
2012
+ " * isGlobal: true, // optional, default false",
2013
+ " * middlewares: [], // module-level middlewares",
2014
+ " * }),",
2015
+ " * ],",
2016
+ " * })",
2017
+ " * export class AppModule {}",
2018
+ " * ```",
2019
+ " *",
2020
+ " * **Option 2: Provide an isolated `KeqRequest` instance**",
2021
+ " *",
2022
+ " * ```typescript",
2023
+ " * @Module({",
2024
+ " * imports: [",
2025
+ ` * ${moduleName}Module.register({`,
2026
+ " * isolate: true, // no inherited middlewares",
2027
+ " * }),",
2028
+ " * ],",
2029
+ " * })",
2030
+ " * export class SomeFeatureModule {}",
2031
+ " * ```",
2032
+ " *",
2033
+ " * Then inject `" + moduleName + "Client` in your services:",
2034
+ " *",
2035
+ " * ```typescript",
2036
+ " * @Injectable()",
2037
+ " * export class SomeService {",
2038
+ ` * constructor(private readonly client: ${moduleName}Client) {}`,
2039
+ " * }",
2040
+ " * ```",
2041
+ " */",
2042
+ "@Module({",
2043
+ " imports: [KeqModule],",
2044
+ " providers: [REQUEST_PROVIDER, CLIENT_PROVIDER],",
2045
+ ` exports: [${moduleName}Client],`,
2046
+ "})",
2047
+ `export class ${moduleName}Module extends ConfigurableModuleClass {`,
2048
+ ` static readonly KEQ_REQUEST = KEQ_REQUEST_TOKEN`,
2049
+ "}",
2050
+ "",
2051
+ "/* @anchor:file:end */"
2052
+ ].join("\n");
2053
+ }
2054
+ };
2055
+ //#endregion
2056
+ //#region src/transformers/api-document/api-document.transformer.ts
2057
+ var ApiDocumentTransformer = class {
2058
+ static toNestjsModule(document, options) {
2059
+ return new NestjsModuleRenderer(document, options).render();
2060
+ }
2061
+ static toNestjsClient(document, options) {
2062
+ return new NestjsClientRenderer(document, options).render();
2063
+ }
2064
+ };
2065
+ //#endregion
2066
+ //#region src/plugins/generate-declaration/constants/metadata-storage.ts
2067
+ const MetadataStorage$9 = new PluginMetadataStorage("@keq-request/cli:GenerateDeclarationPlugin:MetadataStorage");
2068
+ //#endregion
2069
+ //#region src/plugins/generate-declaration/generators/schema-declaration/schema.generator.ts
2070
+ const SCHEMA_GENERATOR = "schemaGenerator";
2071
+ var SchemaDeclarationGenerator = class SchemaDeclarationGenerator {
2072
+ async compile(compiler, task) {
2073
+ const context = compiler.context;
2074
+ const metadata = MetadataStorage$9.get(compiler);
2075
+ const rc = context.rc;
2076
+ const schemaDefinitions = context.documents.flatMap((document) => document.schemas);
2077
+ const artifactMap = new Map(await Promise.all(schemaDefinitions.map(async (schemaDefinition) => [schemaDefinition, await metadata.hooks.afterSchemaDeclarationArtifactGenerated.promise(this.generateSchemaDefinitionsArtifact(schemaDefinition, rc), schemaDefinition, task)])));
2078
+ if (!rc.rendering.entrypoint) return [...artifactMap.values()];
2079
+ const entrypoints = R.collectBy((schemaDefinition) => schemaDefinition.module.name, schemaDefinitions).map((schemaDefinitions) => [schemaDefinitions[0].module, schemaDefinitions.map((schemaDefinition) => artifactMap.get(schemaDefinition)).filter((artifact) => Boolean(artifact))]).map(([moduleDefinition, artifacts]) => this.generateEntrypointArtifact(moduleDefinition, artifacts, rc));
2080
+ return [...artifactMap.values(), ...entrypoints];
2081
+ }
2082
+ generateSchemaDefinitionsArtifact(schemaDefinition, rc) {
2083
+ const filepath = SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(schemaDefinition, rc.rendering.fileNamingStyle);
2084
+ const dirpath = path$1.dirname(filepath);
2085
+ return new Artifact({
2086
+ id: SchemaDeclarationGenerator.getSchemaDefinitionArtifactId(schemaDefinition),
2087
+ filepath,
2088
+ content: SchemaDefinitionTransformer.toDeclaration(schemaDefinition, {
2089
+ esm: rc.rendering.esm,
2090
+ additionalPropertiesType: rc.rendering.additionalPropertiesType,
2091
+ getDependentSchemaDefinitionFilepath(dependentSchemaDefinition) {
2092
+ const relativePath = path$1.relative(dirpath, SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(dependentSchemaDefinition, rc.rendering.fileNamingStyle));
2093
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2094
+ }
2095
+ }),
2096
+ extensionName: ".schema.ts"
2097
+ });
2098
+ }
2099
+ generateEntrypointArtifact(moduleDefinition, exports, rc) {
2100
+ const filepath = SchemaDeclarationGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.rendering.fileNamingStyle);
2101
+ const dirpath = path$1.dirname(filepath);
2102
+ return new Artifact({
2103
+ id: SchemaDeclarationGenerator.getEntrypointArtifactId(moduleDefinition),
2104
+ filepath,
2105
+ content: EntrypointTransformer.toTypescript(exports, { dirpath })
2106
+ });
2107
+ }
2108
+ static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
2109
+ return [
2110
+ ".",
2111
+ changeCase[fileNamingStyle](moduleDefinition.name),
2112
+ "types",
2113
+ "components",
2114
+ "schemas",
2115
+ "index.ts"
2116
+ ].join("/");
2117
+ }
2118
+ static getEntrypointArtifactId(moduleDefinition) {
2119
+ return `${moduleDefinition.address.url}/components/schemas/entrypoint?generator=${SCHEMA_GENERATOR}`;
2120
+ }
2121
+ static getSchemaDefinitionArtifactFilepath(schemaDefinition, fileNamingStyle) {
2122
+ const filename = `${changeCase[fileNamingStyle](schemaDefinition.name)}.schema.ts`;
2123
+ return [
2124
+ ".",
2125
+ changeCase[fileNamingStyle](schemaDefinition.module.name),
2126
+ "types",
2127
+ "components",
2128
+ "schemas",
2129
+ filename
2130
+ ].join("/");
2131
+ }
2132
+ static getSchemaDefinitionArtifactId(schemaDefinition) {
2133
+ return `${schemaDefinition.id}?generator=${SCHEMA_GENERATOR}`;
2134
+ }
2135
+ };
2136
+ //#endregion
2137
+ //#region src/plugins/generate-declaration/generators/response-declaration/response.generator.ts
2138
+ const RESPONSE_GENERATOR = "responseGenerator";
2139
+ var ResponseDeclarationGenerator = class ResponseDeclarationGenerator {
2140
+ async compile(compiler, task) {
2141
+ const context = compiler.context;
2142
+ const metadata = MetadataStorage$9.get(compiler);
2143
+ const rc = context.rc;
2144
+ const responseDefinitions = context.documents.flatMap((document) => document.responses);
2145
+ if (responseDefinitions.length === 0) return [];
2146
+ const artifactMap = new Map(await Promise.all(responseDefinitions.map(async (responseDefinition) => [responseDefinition, await metadata.hooks.afterResponseDeclarationArtifactGenerated.promise(this.generateResponseDefinitionArtifact(responseDefinition, rc), responseDefinition, task)])));
2147
+ if (!rc.rendering.entrypoint) return [...artifactMap.values()];
2148
+ const entrypoints = R.collectBy((responseDefinition) => responseDefinition.module.name, responseDefinitions).map((responseDefinitions) => [responseDefinitions[0].module, responseDefinitions.map((responseDefinition) => artifactMap.get(responseDefinition)).filter((artifact) => Boolean(artifact))]).map(([moduleDefinition, artifacts]) => this.generateEntrypointArtifact(moduleDefinition, artifacts, rc));
2149
+ return [...artifactMap.values(), ...entrypoints];
2150
+ }
2151
+ generateResponseDefinitionArtifact(responseDefinition, rc) {
2152
+ const filepath = ResponseDeclarationGenerator.getResponseDefinitionArtifactFilepath(responseDefinition, rc.rendering.fileNamingStyle);
2153
+ const dirpath = path$1.dirname(filepath);
2154
+ return new Artifact({
2155
+ id: ResponseDeclarationGenerator.getResponseDefinitionArtifactId(responseDefinition),
2156
+ filepath,
2157
+ content: ResponseDefinitionTransformer.toDeclaration(responseDefinition, {
2158
+ esm: rc.rendering.esm,
2159
+ additionalPropertiesType: rc.rendering.additionalPropertiesType,
2160
+ getDependentSchemaDefinitionFilepath(dependentSchemaDefinition) {
2161
+ const relativePath = path$1.relative(dirpath, SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(dependentSchemaDefinition, rc.rendering.fileNamingStyle));
2162
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2163
+ }
2164
+ }),
2165
+ extensionName: ".response.ts"
2166
+ });
2167
+ }
2168
+ generateEntrypointArtifact(moduleDefinition, exports, rc) {
2169
+ const filepath = ResponseDeclarationGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.rendering.fileNamingStyle);
2170
+ const dirpath = path$1.dirname(filepath);
2171
+ return new Artifact({
2172
+ id: ResponseDeclarationGenerator.getEntrypointArtifactId(moduleDefinition),
2173
+ filepath,
2174
+ content: EntrypointTransformer.toTypescript(exports, { dirpath })
2175
+ });
2176
+ }
2177
+ static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
2178
+ return [
2179
+ ".",
2180
+ changeCase[fileNamingStyle](moduleDefinition.name),
2181
+ "types",
2182
+ "components",
2183
+ "responses",
2184
+ "index.ts"
2185
+ ].join("/");
2186
+ }
2187
+ static getEntrypointArtifactId(moduleDefinition) {
2188
+ return `${moduleDefinition.address.url}/components/responses/entrypoint?generator=${RESPONSE_GENERATOR}`;
2189
+ }
2190
+ static getResponseDefinitionArtifactFilepath(responseDefinition, fileNamingStyle) {
2191
+ const filename = `${changeCase[fileNamingStyle](responseDefinition.name)}.response.ts`;
2192
+ return [
2193
+ ".",
2194
+ changeCase[fileNamingStyle](responseDefinition.module.name),
2195
+ "types",
2196
+ "components",
2197
+ "responses",
2198
+ filename
2199
+ ].join("/");
2200
+ }
2201
+ static getResponseDefinitionArtifactId(responseDefinition) {
2202
+ return `${responseDefinition.id}?generator=${RESPONSE_GENERATOR}`;
2203
+ }
2204
+ };
2205
+ //#endregion
2206
+ //#region src/plugins/generate-declaration/generators/operation-declaration/operation.generator.ts
2207
+ const OPERATION_GENERATOR = "operationDeclarationGenerator";
2208
+ var OperationDeclarationGenerator = class OperationDeclarationGenerator {
2209
+ async compile(compiler, task) {
2210
+ const context = compiler.context;
2211
+ const metadata = MetadataStorage$9.get(compiler);
2212
+ const rc = context.rc;
2213
+ const operationDefinitions = context.documents.flatMap((document) => document.operations);
2214
+ const artifactMap = new Map(await Promise.all(operationDefinitions.map(async (operationDefinition) => [operationDefinition, await metadata.hooks.afterOperationDeclarationArtifactGenerated.promise(this.generateOperationDefinitionArtifact(operationDefinition, rc), operationDefinition, task)])));
2215
+ return Array.from(artifactMap.values());
2216
+ }
2217
+ generateOperationDefinitionArtifact(operationDefinition, rc) {
2218
+ const filepath = OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.rendering.fileNamingStyle);
2219
+ const dirpath = path$1.dirname(filepath);
2220
+ return new Artifact({
2221
+ id: OperationDeclarationGenerator.getOperationDefinitionArtifactId(operationDefinition),
2222
+ filepath,
2223
+ content: OperationDefinitionTransformer.toDeclaration(operationDefinition, {
2224
+ esm: rc.rendering.esm,
2225
+ additionalPropertiesType: rc.rendering.additionalPropertiesType,
2226
+ getDependentSchemaDefinitionFilepath(dependentSchemaDefinition) {
2227
+ const relativePath = path$1.relative(dirpath, SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(dependentSchemaDefinition, rc.rendering.fileNamingStyle));
2228
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2229
+ },
2230
+ getDependentResponseDefinitionFilepath(dependentResponseDefinition) {
2231
+ const relativePath = path$1.relative(dirpath, ResponseDeclarationGenerator.getResponseDefinitionArtifactFilepath(dependentResponseDefinition, rc.rendering.fileNamingStyle));
2232
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2233
+ }
2234
+ }),
2235
+ extensionName: ".type.ts"
2236
+ });
2237
+ }
2238
+ generateEntrypointArtifact(moduleDefinition, exports, rc) {
2239
+ const filepath = OperationDeclarationGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.rendering.fileNamingStyle);
2240
+ const dirpath = path$1.dirname(filepath);
2241
+ return new Artifact({
2242
+ id: OperationDeclarationGenerator.getEntrypointArtifactId(moduleDefinition),
2243
+ filepath,
2244
+ content: EntrypointTransformer.toTypescript(exports, { dirpath })
2245
+ });
2246
+ }
2247
+ static getOperationDefinitionArtifactFilepath(operationDefinition, fileNamingStyle) {
2248
+ const filename = `${changeCase[fileNamingStyle](operationDefinition.operationId)}.type.ts`;
2249
+ return [
2250
+ ".",
2251
+ changeCase[fileNamingStyle](operationDefinition.module.name),
2252
+ "types",
2253
+ "operations",
2254
+ filename
2255
+ ].join("/");
2256
+ }
2257
+ static getOperationDefinitionArtifactId(operationDefinition) {
2258
+ return `${operationDefinition.id}?generator=${OPERATION_GENERATOR}`;
2259
+ }
2260
+ static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
2261
+ return [
2262
+ ".",
2263
+ changeCase[fileNamingStyle](moduleDefinition.name),
2264
+ "types",
2265
+ "operations",
2266
+ "index.ts"
2267
+ ].join("/");
2268
+ }
2269
+ static getEntrypointArtifactId(moduleDefinition) {
2270
+ return `${moduleDefinition.address.url}/paths/entrypoint?generator=${OPERATION_GENERATOR}`;
2271
+ }
2272
+ };
2273
+ //#endregion
2274
+ //#region src/plugins/generate-declaration/generate-declaration.plugin.ts
2275
+ const DECLARATION_GENERATOR = "declarationGenerator";
2276
+ var GenerateDeclarationPlugin = class GenerateDeclarationPlugin {
2277
+ name = DECLARATION_GENERATOR;
2278
+ operationGenerator = new OperationDeclarationGenerator();
2279
+ schemaGenerator = new SchemaDeclarationGenerator();
2280
+ responseGenerator = new ResponseDeclarationGenerator();
2281
+ constructor() {}
2282
+ apply(compiler) {
2283
+ const metadata = GenerateDeclarationPlugin.register(compiler);
2284
+ if (metadata.applied) return;
2285
+ metadata.applied = true;
2286
+ compiler.hooks.compile.tapPromise(GenerateDeclarationPlugin.name, async (task) => {
2287
+ compiler.context.artifacts?.push(...await this.schemaGenerator.compile(compiler, task), ...await this.responseGenerator.compile(compiler, task), ...await this.operationGenerator.compile(compiler, task));
2288
+ });
2289
+ }
2290
+ static register(compiler) {
2291
+ if (!MetadataStorage$9.has(compiler)) MetadataStorage$9.set(compiler, {
2292
+ applied: false,
2293
+ hooks: {
2294
+ afterEntrypointArtifactGenerated: new AsyncSeriesWaterfallHook(["artifact", "task"]),
2295
+ afterSchemaDeclarationArtifactGenerated: new AsyncSeriesWaterfallHook([
2296
+ "artifact",
2297
+ "schemaDefinition",
2298
+ "task"
2299
+ ]),
2300
+ afterResponseDeclarationArtifactGenerated: new AsyncSeriesWaterfallHook([
2301
+ "artifact",
2302
+ "responseDefinition",
2303
+ "task"
2304
+ ]),
2305
+ afterOperationDeclarationArtifactGenerated: new AsyncSeriesWaterfallHook([
2306
+ "artifact",
2307
+ "operationDefinition",
2308
+ "task"
2309
+ ])
2310
+ }
2311
+ });
2312
+ return MetadataStorage$9.get(compiler);
2313
+ }
2314
+ static of(compiler) {
2315
+ return this.register(compiler);
2316
+ }
2317
+ };
2318
+ //#endregion
2319
+ //#region src/plugins/generate-micro-function/generators/request/request.generator.ts
2320
+ const MICRO_FUNCTION_REQUEST_GENERATOR = "microFunctionRequestGenerator";
2321
+ var RequestGenerator = class RequestGenerator {
2322
+ generateRequestArtifact(moduleName, fileNamingStyle) {
2323
+ const content = [
2324
+ "/* @anchor:file:start */",
2325
+ "",
2326
+ "import { KeqRequest } from \"keq\"",
2327
+ "",
2328
+ "/* @anchor:request-declaration */",
2329
+ "export const request = new KeqRequest()",
2330
+ "",
2331
+ "/* @anchor:file:end */"
2332
+ ].join("\n");
2333
+ return new Artifact({
2334
+ id: RequestGenerator.getRequestArtifactId(moduleName),
2335
+ filepath: RequestGenerator.getRequestArtifactFilepath(moduleName, fileNamingStyle),
2336
+ content
2337
+ });
2338
+ }
2339
+ async compile(compiler, task) {
2340
+ const context = compiler.context;
2341
+ const rc = context.rc;
2342
+ const documents = context.documents;
2343
+ return [...new Set(documents.flatMap((doc) => doc.operations.map((op) => op.module.name)))].map((moduleName) => this.generateRequestArtifact(moduleName, rc.rendering.fileNamingStyle));
2344
+ }
2345
+ static getRequestArtifactFilepath(moduleName, fileNamingStyle) {
2346
+ return `./${changeCase[fileNamingStyle](moduleName)}/request.ts`;
2347
+ }
2348
+ static getRequestArtifactId(moduleName) {
2349
+ return `request?module=${moduleName}&generator=${MICRO_FUNCTION_REQUEST_GENERATOR}`;
2350
+ }
2351
+ };
2352
+ //#endregion
2353
+ //#region src/plugins/generate-micro-function/generators/micro_function/micro-function.generator.ts
2354
+ const MICRO_FUNCTION_GENERATOR = "microFunctionGenerator";
2355
+ var MicroFunctionGenerator = class MicroFunctionGenerator {
2356
+ async compile(compiler, task) {
2357
+ const metadata = MetadataStorage$10.get(compiler);
2358
+ const context = compiler.context;
2359
+ const rc = context.rc;
2360
+ const operationDefinitions = context.documents.flatMap((document) => document.operations);
2361
+ const artifactMap = new Map(await Promise.all(operationDefinitions.map(async (operationDefinition) => [operationDefinition, await metadata.hooks.afterMicroFunctionArtifactGenerated.promise(this.generateOperationDefinitionArtifact(operationDefinition, rc), operationDefinition, task)])));
2362
+ if (!rc.rendering.entrypoint) return [...artifactMap.values()];
2363
+ return [...await Promise.all(R.collectBy((operationDefinition) => operationDefinition.module.name, operationDefinitions).map((operationDefinitions) => [operationDefinitions[0].module, operationDefinitions.map((operationDefinition) => artifactMap.get(operationDefinition)).filter((artifact) => Boolean(artifact))]).map(async ([moduleDefinition, artifacts]) => await metadata.hooks.afterEntrypointArtifactGenerated.promise(this.generateEntrypointArtifact(moduleDefinition, artifacts, rc), task))), ...artifactMap.values()];
2364
+ }
2365
+ generateOperationDefinitionArtifact(operationDefinition, rc) {
2366
+ const filepath = MicroFunctionGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.rendering.fileNamingStyle);
2367
+ const dirpath = path$1.dirname(filepath);
2368
+ return new Artifact({
2369
+ id: MicroFunctionGenerator.getOperationDefinitionArtifactId(operationDefinition),
2370
+ filepath,
2371
+ content: OperationDefinitionTransformer.toMicroFunction(operationDefinition, {
2372
+ esm: rc.rendering.esm,
2373
+ getOperationDefinitionDeclarationFilepath(operationDefinition) {
2374
+ const relativePath = path$1.relative(dirpath, OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.rendering.fileNamingStyle));
2375
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2376
+ },
2377
+ getRequestFilepath() {
2378
+ const relativePath = path$1.relative(dirpath, RequestGenerator.getRequestArtifactFilepath(operationDefinition.module.name, rc.rendering.fileNamingStyle));
2379
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2380
+ }
2381
+ }),
2382
+ extensionName: ".type.ts"
2383
+ });
2384
+ }
2385
+ generateEntrypointArtifact(moduleDefinition, exports, rc) {
2386
+ const filepath = MicroFunctionGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.rendering.fileNamingStyle);
2387
+ const dirpath = filepath.substring(0, filepath.lastIndexOf("/"));
2388
+ return new Artifact({
2389
+ id: MicroFunctionGenerator.getEntrypointArtifactId(moduleDefinition),
2390
+ filepath,
2391
+ content: EntrypointTransformer.toTypescript(exports, { dirpath })
2392
+ });
2393
+ }
2394
+ static getOperationDefinitionArtifactFilepath(operationDefinition, fileNamingStyle) {
2395
+ const filename = `${changeCase[fileNamingStyle](operationDefinition.operationId)}.fn.ts`;
2396
+ return [
2397
+ ".",
2398
+ changeCase[fileNamingStyle](operationDefinition.module.name),
2399
+ "operations",
2400
+ filename
2401
+ ].join("/");
2402
+ }
2403
+ static getOperationDefinitionArtifactId(operationDefinition) {
2404
+ return `${operationDefinition.id}?generator=${MICRO_FUNCTION_GENERATOR}`;
2405
+ }
2406
+ static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
2407
+ return [
2408
+ ".",
2409
+ changeCase[fileNamingStyle](moduleDefinition.name),
2410
+ "operations",
2411
+ "index.ts"
2412
+ ].join("/");
2413
+ }
2414
+ static getEntrypointArtifactId(moduleDefinition) {
2415
+ return `${moduleDefinition.address}/paths/entrypoint?generator=${MICRO_FUNCTION_GENERATOR}`;
2416
+ }
2417
+ };
2418
+ //#endregion
2419
+ //#region src/plugins/generate-micro-function/generate-micro-function.plugin.ts
2420
+ var GenerateMicroFunctionPlugin = class GenerateMicroFunctionPlugin {
2421
+ microFunctionGenerator = new MicroFunctionGenerator();
2422
+ requestGenerator = new RequestGenerator();
2423
+ apply(compiler) {
2424
+ const metadata = GenerateMicroFunctionPlugin.register(compiler);
2425
+ if (metadata.applied) return;
2426
+ metadata.applied = true;
2427
+ compiler.hooks.compile.tapPromise(GenerateMicroFunctionPlugin.name, async (task) => {
2428
+ const artifacts = [...await this.requestGenerator.compile(compiler, task), ...await this.microFunctionGenerator.compile(compiler, task)];
2429
+ compiler.context.artifacts.push(...artifacts);
2430
+ });
2431
+ }
2432
+ static register(compiler) {
2433
+ if (!MetadataStorage$10.has(compiler)) MetadataStorage$10.set(compiler, {
2434
+ applied: false,
2435
+ hooks: {
2436
+ afterEntrypointArtifactGenerated: new AsyncSeriesWaterfallHook(["artifact", "task"]),
2437
+ afterMicroFunctionArtifactGenerated: new AsyncSeriesWaterfallHook([
2438
+ "artifact",
2439
+ "operationDefinition",
2440
+ "task"
2441
+ ])
2442
+ }
2443
+ });
2444
+ return MetadataStorage$10.get(compiler);
2445
+ }
2446
+ static of(compiler) {
2447
+ return this.register(compiler);
2448
+ }
2449
+ };
2450
+ //#endregion
2451
+ //#region src/plugins/body-fallback/constants/metadata-storage.ts
2452
+ const MetadataStorage$8 = new PluginMetadataStorage("@keq-request/cli:BodyFallbackPlugin:MetadataStorage");
2453
+ //#endregion
2454
+ //#region src/plugins/body-fallback/index.ts
2455
+ var BodyFallbackPlugin = class BodyFallbackPlugin {
2456
+ apply(compiler) {
2457
+ const metadata = BodyFallbackPlugin.register(compiler);
2458
+ if (metadata.applied) return;
2459
+ metadata.applied = true;
2460
+ compiler.hooks.setup.tap(BodyFallbackPlugin.name, () => {
2461
+ const generateMicroFunctionPluginMetadata = GenerateMicroFunctionPlugin.of(compiler);
2462
+ if (!generateMicroFunctionPluginMetadata) throw new Error("BodyFallbackPlugin requires GenerateMicroFunctionPlugin to be applied first.");
2463
+ generateMicroFunctionPluginMetadata.hooks.afterMicroFunctionArtifactGenerated.tap(BodyFallbackPlugin.name, (artifact, operationDefinition) => {
2464
+ const keys = (operationDefinition.operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p)) || []).map((p) => p.name).filter(R.isNotNil);
2465
+ const $acc = !keys.length ? " acc[key] = args[key]" : [
2466
+ ` if (![${keys.map((k) => JSON.stringify(k)).join(", ")}].includes(key)) {`,
2467
+ " acc[key] = args[key]",
2468
+ " }"
2469
+ ].join("\n");
2470
+ artifact.anchor.block.replace("body", [
2471
+ " if (typeof args === \"object\" && args !== null && !Array.isArray(args)) {",
2472
+ " const requestBody = Object.keys(args)",
2473
+ " .reduce((acc, key) => {",
2474
+ $acc,
2475
+ " return acc",
2476
+ " }, {} as Record<string, unknown>)",
2477
+ "",
2478
+ " if (Object.keys(requestBody).length > 0) {",
2479
+ " req.send(requestBody)",
2480
+ " }",
2481
+ " }"
2482
+ ].filter(R.isNotNil).join("\n"));
2483
+ return artifact;
2484
+ });
2485
+ });
2486
+ }
2487
+ static register(compiler) {
2488
+ if (!MetadataStorage$8.has(compiler)) MetadataStorage$8.set(compiler, {
2489
+ applied: false,
2490
+ hooks: {}
2491
+ });
2492
+ return MetadataStorage$8.get(compiler);
2493
+ }
2494
+ static of(compiler) {
2495
+ return this.register(compiler);
2496
+ }
2497
+ };
2498
+ //#endregion
2499
+ //#region src/plugins/use-valibot/constants/metadata-storage.ts
2500
+ const MetadataStorage$7 = new PluginMetadataStorage("@keq-request/cli:UseValibotPlugin:MetadataStorage");
2501
+ //#endregion
2502
+ //#region src/plugins/use-valibot/use-valibot.plugin.ts
2503
+ const USE_VALIBOT = "useValibot";
2504
+ var UseValibotPlugin = class UseValibotPlugin {
2505
+ name = USE_VALIBOT;
2506
+ constructor() {}
2507
+ apply(compiler) {
2508
+ const metadata = UseValibotPlugin.register(compiler);
2509
+ if (metadata.applied) return;
2510
+ metadata.applied = true;
2511
+ const declarationMetadata = GenerateDeclarationPlugin.of(compiler);
2512
+ if (!declarationMetadata) throw new Error("UseValibotPlugin requires GenerateDeclarationPlugin to be registered first");
2513
+ declarationMetadata.hooks.afterSchemaDeclarationArtifactGenerated.tap(UseValibotPlugin.name, (artifact, schemaDefinition) => {
2514
+ const rc = compiler.context.rc;
2515
+ const filepath = artifact.filepath;
2516
+ const dirpath = path$1.dirname(filepath);
2517
+ const valibotContent = SchemaDefinitionTransformer.toValibot(schemaDefinition, {
2518
+ esm: rc.rendering.esm,
2519
+ additionalPropertiesType: rc.rendering.additionalPropertiesType,
2520
+ getDependentSchemaDefinitionFilepath(dependentSchemaDefinition) {
2521
+ const relativePath = path$1.relative(dirpath, SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(dependentSchemaDefinition, rc.rendering.fileNamingStyle));
2522
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2523
+ }
2524
+ });
2525
+ return new Artifact({
2526
+ ...artifact,
2527
+ content: valibotContent
2528
+ });
2529
+ });
2530
+ }
2531
+ static register(compiler) {
2532
+ if (!MetadataStorage$7.has(compiler)) MetadataStorage$7.set(compiler, { applied: false });
2533
+ return MetadataStorage$7.get(compiler);
2534
+ }
2535
+ static of(compiler) {
2536
+ return this.register(compiler);
2537
+ }
2538
+ };
2539
+ //#endregion
2540
+ //#region src/plugins/generate-nestjs-module/constants/metadata-storage.ts
2541
+ const MetadataStorage$6 = new PluginMetadataStorage("@keq-request/cli:GenerateNestjsModulePlugin:MetadataStorage");
2542
+ //#endregion
2543
+ //#region src/plugins/generate-nestjs-module/generators/nestjs-module.generator.ts
2544
+ const NESTJS_MODULE_GENERATOR = "nestjs-module-generator";
2545
+ var NestjsModuleGenerator = class NestjsModuleGenerator {
2546
+ generateNestjsModuleArtifact(document, rc) {
2547
+ const filepath = NestjsModuleGenerator.getNestjsModuleArtifactFilepath(document, rc.rendering.fileNamingStyle);
2548
+ const dirname = path$1.dirname(filepath);
2549
+ return new Artifact({
2550
+ id: NestjsModuleGenerator.getNestjsModuleArtifactId(document),
2551
+ filepath,
2552
+ content: ApiDocumentTransformer.toNestjsModule(document, {
2553
+ esm: rc.rendering.esm,
2554
+ getNestjsClientFilepath(document) {
2555
+ const relativePath = path$1.relative(dirname, NestjsModuleGenerator.getNestjsClientArtifactFilepath(document, rc.rendering.fileNamingStyle));
2556
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2557
+ }
2558
+ })
2559
+ });
2560
+ }
2561
+ generateNestjsClientArtifact(document, rc) {
2562
+ const filepath = NestjsModuleGenerator.getNestjsClientArtifactFilepath(document, rc.rendering.fileNamingStyle);
2563
+ const dirpath = path$1.dirname(filepath);
2564
+ return new Artifact({
2565
+ id: NestjsModuleGenerator.getNestjsClientArtifactId(document),
2566
+ filepath,
2567
+ content: ApiDocumentTransformer.toNestjsClient(document, {
2568
+ esm: rc.rendering.esm,
2569
+ getOperationDefinitionDeclarationFilepath(operationDefinition) {
2570
+ const relativePath = path$1.relative(dirpath, OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.rendering.fileNamingStyle));
2571
+ return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2572
+ }
2573
+ })
2574
+ });
2575
+ }
2576
+ async compile(compiler, task) {
2577
+ const metadata = MetadataStorage$6.get(compiler);
2578
+ const rc = compiler.context.rc;
2579
+ const documents = compiler.context.documents;
2580
+ const nestjsModuleArtifacts = await Promise.all(documents.map((document) => metadata.hooks.afterNestjsModuleArtifactGenerated.promise(this.generateNestjsModuleArtifact(document, rc), document, task)));
2581
+ const nestjsClientArtifacts = await Promise.all(documents.map((document) => metadata.hooks.afterNestjsModuleArtifactGenerated.promise(this.generateNestjsClientArtifact(document, rc), document, task)));
2582
+ return [...nestjsModuleArtifacts, ...nestjsClientArtifacts];
2583
+ }
2584
+ static getNestjsModuleArtifactFilepath(document, fileNamingStyle) {
2585
+ const filename = `${changeCase[fileNamingStyle](document.module.name)}.module.ts`;
2586
+ return [
2587
+ ".",
2588
+ changeCase[fileNamingStyle](document.module.name),
2589
+ filename
2590
+ ].join("/");
2591
+ }
2592
+ static getNestjsModuleArtifactId(document) {
2593
+ return `${document.module.address}?generate=${NESTJS_MODULE_GENERATOR}`;
2594
+ }
2595
+ static getNestjsClientArtifactFilepath(document, fileNamingStyle) {
2596
+ const filename = `${changeCase[fileNamingStyle](document.module.name)}.client.ts`;
2597
+ return [
2598
+ ".",
2599
+ changeCase[fileNamingStyle](document.module.name),
2600
+ filename
2601
+ ].join("/");
2602
+ }
2603
+ static getNestjsClientArtifactId(document) {
2604
+ return `${document.module.address}?generate=${NESTJS_MODULE_GENERATOR}-client`;
2605
+ }
2606
+ };
2607
+ //#endregion
2608
+ //#region src/plugins/generate-nestjs-module/generate-nestjs-module.ts
2609
+ var GenerateNestjsModulePlugin = class GenerateNestjsModulePlugin {
2610
+ nestjsModuleGenerator = new NestjsModuleGenerator();
2611
+ apply(compiler) {
2612
+ const metadata = GenerateNestjsModulePlugin.register(compiler);
2613
+ if (metadata.applied) return;
2614
+ metadata.applied = true;
2615
+ compiler.hooks.compile.tapPromise(GenerateNestjsModulePlugin.name, async (task) => {
2616
+ const artifacts = await this.nestjsModuleGenerator.compile(compiler, task);
2617
+ compiler.context.artifacts.push(...artifacts);
2618
+ });
2619
+ }
2620
+ static register(compiler) {
2621
+ if (!MetadataStorage$6.has(compiler)) MetadataStorage$6.set(compiler, {
2622
+ applied: false,
2623
+ hooks: { afterNestjsModuleArtifactGenerated: new AsyncSeriesWaterfallHook([
2624
+ "artifact",
2625
+ "document",
2626
+ "task"
2627
+ ]) }
2628
+ });
2629
+ return MetadataStorage$6.get(compiler);
2630
+ }
2631
+ static of(compiler) {
2632
+ return MetadataStorage$6.get(compiler);
2633
+ }
2634
+ };
2635
+ //#endregion
2636
+ //#region src/plugins/chinese-to-pinyin/constants/metadata-storage.ts
2637
+ const MetadataStorage$5 = new PluginMetadataStorage("@keq-request/cli:ChineseToPinyinPlugin:MetadataStorage");
2638
+ //#endregion
2639
+ //#region src/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.ts
2640
+ var ChineseToPinyinPlugin = class ChineseToPinyinPlugin {
2641
+ apply(compiler) {
2642
+ const metadata = ChineseToPinyinPlugin.register(compiler);
2643
+ if (metadata.applied) return;
2644
+ metadata.applied = true;
2645
+ compiler.hooks.afterDownload.tap(ChineseToPinyinPlugin.name, (task) => {
2646
+ const documents = compiler.context.documents;
2647
+ compiler.context.documents = documents.map((doc) => {
2648
+ return new ApiDocumentV3_1(fixSwagger(doc.specification), doc.module);
2649
+ });
2650
+ });
2651
+ }
2652
+ static register(compiler) {
2653
+ if (!MetadataStorage$5.has(compiler)) MetadataStorage$5.set(compiler, {
2654
+ applied: false,
2655
+ hooks: {}
2656
+ });
2657
+ return MetadataStorage$5.get(compiler);
2658
+ }
2659
+ static of(compiler) {
2660
+ return this.register(compiler);
2661
+ }
2662
+ };
2663
+ //#endregion
2664
+ //#region src/plugins/download-http-file/constants/metadata-storage.ts
2665
+ const MetadataStorage$4 = new PluginMetadataStorage("@keq-request/cli:DownloadHttpFilePlugin:MetadataStorage");
2666
+ //#endregion
2667
+ //#region src/plugins/download-http-file/download-http-file.plugin.ts
2668
+ var DownloadHttpFilePlugin = class DownloadHttpFilePlugin {
2669
+ apply(compiler) {
2670
+ const metadata = DownloadHttpFilePlugin.register(compiler);
2671
+ if (metadata.applied) return;
2672
+ metadata.applied = true;
2673
+ compiler.hooks.download.tapPromise(DownloadHttpFilePlugin.name, async (address, task) => {
2674
+ const { url } = address;
2675
+ if (!url.startsWith("http://") && !url.startsWith("https://")) return void 0;
2676
+ const content = await this.download(address);
2677
+ const spec = this.deserialize(content);
2678
+ return JSON.stringify(spec);
2679
+ });
2680
+ }
2681
+ async download(address) {
2682
+ const { url, headers } = address;
2683
+ try {
2684
+ const res = await fetch(url, { headers });
2685
+ if (res.status >= 400) {
2686
+ const body = await res.text().catch(() => "");
2687
+ const detail = body ? `\n Response Body: ${body}` : "";
2688
+ throw new Error(`failed with status code ${res.status}${detail}`);
2689
+ }
2690
+ return await res.text();
2691
+ } catch (e) {
2692
+ if (e instanceof Error) e.message = `Unable get the openapi/swagger file from ${url}: ${e.message}`;
2693
+ throw e;
2694
+ }
2695
+ }
2696
+ deserialize(content) {
2697
+ const json = JSON.parse(content);
2698
+ return OpenapiUtils.to3_1(json);
2699
+ }
2700
+ static register(compiler) {
2701
+ if (!MetadataStorage$4.has(compiler)) MetadataStorage$4.set(compiler, {
2702
+ applied: false,
2703
+ hooks: {}
2704
+ });
2705
+ return MetadataStorage$4.get(compiler);
2706
+ }
2707
+ static of(compiler) {
2708
+ return this.register(compiler);
2709
+ }
2710
+ };
2711
+ //#endregion
2712
+ //#region src/plugins/download-local-file/constants/metadata-storage.ts
2713
+ const MetadataStorage$3 = new PluginMetadataStorage("@keq-request/cli:DownloadLocalFilePlugin:MetadataStorage");
2714
+ //#endregion
2715
+ //#region src/plugins/download-local-file/download-local-file.plugin.ts
2716
+ var DownloadLocalFilePlugin = class DownloadLocalFilePlugin {
2717
+ apply(compiler) {
2718
+ const metadata = DownloadLocalFilePlugin.register(compiler);
2719
+ if (metadata.applied) return;
2720
+ metadata.applied = true;
2721
+ compiler.hooks.download.tapPromise(DownloadLocalFilePlugin.name, async (address, task) => {
2722
+ const { url, encoding } = address;
2723
+ if (!url.startsWith("file://")) return void 0;
2724
+ const filepath = fileURLToPath(url);
2725
+ const fileExt = path$1.extname(filepath);
2726
+ const content = await fs$1.readFile(filepath, encoding);
2727
+ const str = typeof content === "string" ? content : content.toString(encoding);
2728
+ if ([".yml", ".yaml"].includes(fileExt)) {
2729
+ const value = yaml.load(str);
2730
+ return JSON.stringify(OpenapiUtils.to3_1(value));
2731
+ } else if (fileExt === ".json") return JSON.stringify(OpenapiUtils.to3_1(JSON.parse(str)));
2732
+ });
2733
+ }
2734
+ static register(compiler) {
2735
+ if (!MetadataStorage$3.has(compiler)) MetadataStorage$3.set(compiler, {
2736
+ applied: false,
2737
+ hooks: {}
2738
+ });
2739
+ return MetadataStorage$3.get(compiler);
2740
+ }
2741
+ static of(compiler) {
2742
+ return this.register(compiler);
2743
+ }
2744
+ };
2745
+ //#endregion
2746
+ //#region src/plugins/shaking/constants/metadata-storage.ts
2747
+ const MetadataStorage$2 = new PluginMetadataStorage("@keq-request/cli:ShakingPlugin:MetadataStorage");
2748
+ //#endregion
2749
+ //#region src/plugins/shaking/shaking.plugin.ts
2750
+ var ShakingPlugin = class ShakingPlugin {
2751
+ apply(compiler) {
2752
+ const metadata = ShakingPlugin.register(compiler);
2753
+ if (metadata.applied) return;
2754
+ metadata.applied = true;
2755
+ compiler.hooks.beforeCompile.tap(ShakingPlugin.name, (task) => {
2756
+ const matcher = compiler.context.matcher;
2757
+ const documents = compiler.context.documents;
2758
+ compiler.context.documents = documents.map((document) => this.shaking(compiler, document)).filter((document) => !document.isEmpty()).filter((document) => !matcher.isModuleDenied(document.module));
2759
+ });
2760
+ }
2761
+ shaking(compiler, document) {
2762
+ const rc = compiler.context.rc;
2763
+ const matcher = compiler.context.matcher;
2764
+ const isAccepted = (pathname, method, operation) => {
2765
+ if (!SupportedMethods.includes(method)) return false;
2766
+ return !matcher.isOperationDenied(new OperationDefinition({
2767
+ method,
2768
+ pathname,
2769
+ operation,
2770
+ module: document.module,
2771
+ document
2772
+ }));
2773
+ };
2774
+ return new ApiDocumentV3_1(openapiShakingSync(document.specification, isAccepted, { tolerant: rc.tolerant }), new ModuleDefinition(document.module.name, {
2775
+ url: `memory://${document.module.name}.v3_1.sharked.json`,
2776
+ headers: {},
2777
+ encoding: "utf8"
2778
+ }));
2779
+ }
2780
+ static register(compiler) {
2781
+ if (!MetadataStorage$2.has(compiler)) MetadataStorage$2.set(compiler, {
2782
+ applied: false,
2783
+ hooks: {}
2784
+ });
2785
+ return MetadataStorage$2.get(compiler);
2786
+ }
2787
+ static of(compiler) {
2788
+ return this.register(compiler);
2789
+ }
2790
+ };
2791
+ //#endregion
2792
+ //#region src/plugins/terminal-select/utils/select-operation-definitions.ts
2793
+ async function selectOperationDefinitions(task, operationDefinitions) {
2794
+ return await task.prompt(ListrInquirerPromptAdapter).run(select, {
2795
+ message: "Select Pathname",
2796
+ defaultValue: [],
2797
+ options: (input) => {
2798
+ const items = operationDefinitions.map((op) => ({
2799
+ name: `${op.module.name} ${op.method.toUpperCase()} ${op.pathname}`,
2800
+ value: op
2801
+ }));
2802
+ if (!input) return items;
2803
+ const keys = input.trim().toLowerCase().split(/\s+/);
2804
+ return items.filter((i) => {
2805
+ const name = i.name.toLowerCase();
2806
+ return keys.every((q) => name.includes(q));
2807
+ });
2808
+ }
2809
+ });
2810
+ }
2811
+ //#endregion
2812
+ //#region src/plugins/terminal-select/constants/metadata-storage.ts
2813
+ const MetadataStorage$1 = new PluginMetadataStorage("@keq-request/cli:TerminalSelectPlugin:MetadataStorage");
2814
+ //#endregion
2815
+ //#region src/plugins/terminal-select/terminal-select.plugin.ts
2816
+ var TerminalSelectPlugin = class TerminalSelectPlugin {
2817
+ constructor(options) {
2818
+ this.options = options;
2819
+ }
2820
+ apply(compiler) {
2821
+ const metadata = TerminalSelectPlugin.register(compiler);
2822
+ if (metadata.applied) return;
2823
+ metadata.applied = true;
2824
+ compiler.hooks.afterDownload.tapPromise(TerminalSelectPlugin.name, async (task) => {
2825
+ const context = compiler.context;
2826
+ const matcher = context.matcher;
2827
+ const selectedOperationDefinitions = await selectOperationDefinitions(task, context.documents.flatMap((document) => document.operations));
2828
+ for (const op of selectedOperationDefinitions) matcher.append({
2829
+ persist: !!this.options.persist,
2830
+ deny: this.options.mode === "deny",
2831
+ moduleName: op.module.name,
2832
+ operationMethod: op.method,
2833
+ operationPathname: op.pathname
2834
+ });
2835
+ });
2836
+ }
2837
+ static register(compiler) {
2838
+ if (!MetadataStorage$1.has(compiler)) MetadataStorage$1.set(compiler, {
2839
+ applied: false,
2840
+ hooks: {}
2841
+ });
2842
+ return MetadataStorage$1.get(compiler);
2843
+ }
2844
+ static of(compiler) {
2845
+ return this.register(compiler);
2846
+ }
2847
+ };
2848
+ //#endregion
2849
+ //#region src/plugins/clean/clean.plugin.ts
2850
+ var CleanPlugin = class CleanPlugin {
2851
+ apply(compiler) {
2852
+ compiler.hooks.beforePersist.tapPromise(CleanPlugin.name, async () => {
2853
+ const rc = compiler.context.rc;
2854
+ if (!rc) throw new Error("Please run setup task first.");
2855
+ const outdir = rc.outdir;
2856
+ await fs.emptyDir(outdir);
2857
+ });
2858
+ }
2859
+ };
2860
+ //#endregion
2861
+ //#region src/plugins/initialize/initialize.plugin.ts
2862
+ var InitializePlugin = class InitializePlugin {
2863
+ constructor(options) {
2864
+ this.options = options;
2865
+ }
2866
+ apply(compiler) {
2867
+ compiler.hooks.setup.tap(InitializePlugin.name, (task) => {
2868
+ const plugins = [new DownloadHttpFilePlugin(), new DownloadLocalFilePlugin()];
2869
+ if (this.options.build) plugins.push(new ShakingPlugin());
2870
+ if (this.options.interactive) plugins.push(new TerminalSelectPlugin(typeof this.options.interactive === "object" ? this.options.interactive : { mode: "allow" }));
2871
+ const rc = compiler.context.rc;
2872
+ plugins.push(...R.unnest((rc.translators || []).map((translator) => {
2873
+ return translator.apply();
2874
+ })));
2875
+ if (this.options.fresh) plugins.push(new CleanPlugin());
2876
+ if (rc.plugins && rc.plugins.length) plugins.push(...rc.plugins);
2877
+ for (const plugin of plugins) plugin.apply(compiler);
2878
+ });
2879
+ }
2880
+ };
2881
+ //#endregion
2882
+ //#region src/plugins/overwrite-operation-id/overwrite-operation-id.plugin.ts
2883
+ var OverwriteOperationIdPlugin = class OverwriteOperationIdPlugin {
2884
+ constructor(factory) {
2885
+ this.factory = factory;
2886
+ }
2887
+ apply(compiler) {
2888
+ compiler.hooks.afterDownload.tap(OverwriteOperationIdPlugin.name, () => {
2889
+ const documents = compiler.context.documents;
2890
+ const factory = this.factory;
2891
+ compiler.context.documents = documents.map((document) => {
2892
+ return new ApiDocumentV3_1(OpenapiUtils.mapOperation(document.specification, (method, pathname, operation) => {
2893
+ const operationId = factory({
2894
+ method,
2895
+ pathname,
2896
+ operation,
2897
+ module: document.module
2898
+ });
2899
+ if (typeof operationId === "string") {
2900
+ if (operationId.length === 0) throw new Exception(document.module, `The generated operationId for [${method.toUpperCase()} ${pathname}] is an empty string.`);
2901
+ operation.operationId = operationId;
2902
+ return operation;
2903
+ }
2904
+ return operation;
2905
+ }), document.module);
2906
+ });
2907
+ });
2908
+ }
2909
+ };
2910
+ //#endregion
2911
+ //#region src/plugins/overwrite-schema-name/overwrite-schema-name.plugin.ts
2912
+ var OverwriteSchemaNamePlugin = class OverwriteSchemaNamePlugin {
2913
+ constructor(factory) {
2914
+ this.factory = factory;
2915
+ }
2916
+ apply(compiler) {
2917
+ compiler.hooks.beforeValidate.tap(OverwriteSchemaNamePlugin.name, (spec, moduleDefinition) => {
2918
+ const schemas = spec.components?.schemas;
2919
+ if (!schemas) return;
2920
+ const renameMap = /* @__PURE__ */ new Map();
2921
+ for (const name of Object.keys(schemas)) {
2922
+ const newName = this.factory({
2923
+ name,
2924
+ module: moduleDefinition
2925
+ });
2926
+ if (typeof newName === "string" && newName !== name) renameMap.set(name, newName);
2927
+ }
2928
+ if (renameMap.size === 0) return;
2929
+ for (const [oldName, newName] of renameMap) {
2930
+ schemas[newName] = schemas[oldName];
2931
+ delete schemas[oldName];
2932
+ }
2933
+ const refMap = /* @__PURE__ */ new Map();
2934
+ for (const [oldName, newName] of renameMap) refMap.set(`#/components/schemas/${oldName}`, `#/components/schemas/${newName}`);
2935
+ const matches = JSONPath({
2936
+ path: "$..*['$ref']^",
2937
+ json: spec,
2938
+ resultType: "all"
2939
+ });
2940
+ for (const match of matches) {
2941
+ const ref = match.value.$ref;
2942
+ if (typeof ref === "string" && refMap.has(ref)) match.value.$ref = refMap.get(ref);
2943
+ }
2944
+ });
2945
+ }
2946
+ };
2947
+ //#endregion
2948
+ //#region src/plugins/overwrite-query-options/overwrite-query-options.plugin.ts
2949
+ const QsArrayFormatUnion = Object.values(QsArrayFormat);
2950
+ var OverwriteQueryOptionsPlugin = class OverwriteQueryOptionsPlugin {
2951
+ constructor(factory) {
2952
+ this.factory = factory;
2953
+ }
2954
+ apply(compiler) {
2955
+ compiler.hooks.afterDownload.tap(OverwriteQueryOptionsPlugin.name, (task) => {
2956
+ const documents = compiler.context.documents;
2957
+ const factory = this.factory;
2958
+ compiler.context.documents = documents.map((document) => {
2959
+ return new ApiDocumentV3_1(OpenapiUtils.mapParameter(document.specification, (method, pathname, operation, parameter) => {
2960
+ const qsOptions = typeof factory === "function" ? factory({
2961
+ parameter,
2962
+ operation,
2963
+ pathname,
2964
+ method,
2965
+ module: document.module
2966
+ }) : factory;
2967
+ if (!qsOptions) return parameter;
2968
+ if (qsOptions.arrayFormat) {
2969
+ if (!QsArrayFormatUnion.includes(qsOptions.arrayFormat)) throw new Exception(document.module, `The 'arrayFormat' value '${qsOptions.arrayFormat}' for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] is invalid.`);
2970
+ parameter["x-qs-array-format"] = qsOptions.arrayFormat;
2971
+ }
2972
+ if (qsOptions.allowDots !== void 0) {
2973
+ if (typeof qsOptions.allowDots !== "boolean") throw new Exception(document.module, `The 'allowDots' value for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] must be a boolean.`);
2974
+ parameter["x-qs-allow-dots"] = Boolean(qsOptions.allowDots);
2975
+ }
2976
+ if (qsOptions.indices !== void 0) {
2977
+ if (typeof qsOptions.indices !== "boolean") throw new Exception(document.module, `The 'indices' value for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] must be a boolean.`);
2978
+ parameter["x-qs-indices"] = Boolean(qsOptions.indices);
2979
+ }
2980
+ return parameter;
2981
+ }), document.module);
2982
+ });
2983
+ });
2984
+ }
2985
+ };
2986
+ //#endregion
2987
+ //#region src/plugins/overwrite-additional-properties/constants/metadata-storage.ts
2988
+ const MetadataStorage = new PluginMetadataStorage("@keq-request/cli:OverwriteAdditionalPropertiesPlugin:MetadataStorage");
2989
+ //#endregion
2990
+ //#region src/plugins/overwrite-additional-properties/overwrite-additional-properties.plugin.ts
2991
+ var OverwriteAdditionalPropertiesPlugin = class OverwriteAdditionalPropertiesPlugin {
2992
+ constructor(options = {}) {
2993
+ this.options = options;
2994
+ }
2995
+ apply(compiler) {
2996
+ const metadata = OverwriteAdditionalPropertiesPlugin.register(compiler);
2997
+ if (metadata.applied) return;
2998
+ metadata.applied = true;
2999
+ const { disallowIfNotPresent = false } = this.options;
3000
+ if (!disallowIfNotPresent) return;
3001
+ compiler.hooks.afterDownload.tap(OverwriteAdditionalPropertiesPlugin.name, () => {
3002
+ const documents = compiler.context.documents;
3003
+ compiler.context.documents = documents.map((document) => {
3004
+ return new ApiDocumentV3_1(OpenapiUtils.mapSchema(document.specification, (schema) => {
3005
+ if (schema.type !== "object" && !schema.properties) return schema;
3006
+ if (schema.additionalProperties === void 0) return Object.assign({}, schema, { additionalProperties: false });
3007
+ return schema;
3008
+ }), document.module);
3009
+ });
3010
+ });
3011
+ }
3012
+ static register(compiler) {
3013
+ if (!MetadataStorage.has(compiler)) MetadataStorage.set(compiler, { applied: false });
3014
+ return MetadataStorage.get(compiler);
3015
+ }
3016
+ static of(compiler) {
3017
+ return this.register(compiler);
3018
+ }
3019
+ };
3020
+ //#endregion
3021
+ //#region src/plugins/lint-schema/lint-schema.plugin.ts
3022
+ var LintSchemaPlugin = class LintSchemaPlugin {
3023
+ constructor(options = {}) {
3024
+ this.options = options;
3025
+ }
3026
+ apply(compiler) {
3027
+ compiler.hooks.beforeCompile.tap(LintSchemaPlugin.name, () => {
3028
+ const documents = compiler.context.documents;
3029
+ const validate = new Ajv2020({
3030
+ allErrors: true,
3031
+ strict: false
3032
+ }).getSchema("https://json-schema.org/draft/2020-12/schema");
3033
+ if (!validate) {
3034
+ logger.warn("Failed to load JSON Schema Draft 2020-12 meta-schema for validation");
3035
+ return;
3036
+ }
3037
+ let hasErrors = false;
3038
+ for (const document of documents) {
3039
+ const spec = document.specification;
3040
+ const moduleName = document.module.name;
3041
+ if (spec.components?.schemas) for (const [name, schema] of Object.entries(spec.components.schemas)) {
3042
+ if (typeof schema === "boolean" || "$ref" in schema) continue;
3043
+ if (!validate(schema) && validate.errors) {
3044
+ hasErrors = true;
3045
+ for (const error of validate.errors) logger.warn(`[${moduleName}] components.schemas.${name}${error.instancePath}: ${error.message}`);
3046
+ }
3047
+ }
3048
+ for (const [path, pathItem] of Object.entries(spec.paths || {})) {
3049
+ if (!pathItem) continue;
3050
+ for (const method of SupportedMethods) {
3051
+ const operation = pathItem[method];
3052
+ if (!operation) continue;
3053
+ const operationId = operation.operationId || `${method.toUpperCase()} ${path}`;
3054
+ if (operation.parameters) for (const param of operation.parameters) {
3055
+ if ("$ref" in param || !param.schema) continue;
3056
+ if (typeof param.schema === "boolean" || "$ref" in param.schema) continue;
3057
+ if (!validate(param.schema) && validate.errors) {
3058
+ hasErrors = true;
3059
+ for (const error of validate.errors) logger.warn(`[${moduleName}] ${operationId} parameter "${param.name}" schema${error.instancePath}: ${error.message}`);
3060
+ }
3061
+ }
3062
+ if (operation.requestBody && !("$ref" in operation.requestBody)) {
3063
+ const content = operation.requestBody.content || {};
3064
+ for (const [mediaType, mediaTypeObj] of Object.entries(content)) {
3065
+ if (!mediaTypeObj.schema || typeof mediaTypeObj.schema === "boolean" || "$ref" in mediaTypeObj.schema) continue;
3066
+ if (!validate(mediaTypeObj.schema) && validate.errors) {
3067
+ hasErrors = true;
3068
+ for (const error of validate.errors) logger.warn(`[${moduleName}] ${operationId} requestBody ${mediaType} schema${error.instancePath}: ${error.message}`);
3069
+ }
3070
+ }
3071
+ }
3072
+ if (operation.responses) for (const [statusCode, response] of Object.entries(operation.responses)) {
3073
+ if ("$ref" in response) continue;
3074
+ const content = response.content || {};
3075
+ for (const [mediaType, mediaTypeObj] of Object.entries(content)) {
3076
+ if (!mediaTypeObj.schema || typeof mediaTypeObj.schema === "boolean" || "$ref" in mediaTypeObj.schema) continue;
3077
+ if (!validate(mediaTypeObj.schema) && validate.errors) {
3078
+ hasErrors = true;
3079
+ for (const error of validate.errors) logger.warn(`[${moduleName}] ${operationId} response ${statusCode} ${mediaType} schema${error.instancePath}: ${error.message}`);
3080
+ }
3081
+ }
3082
+ }
3083
+ }
3084
+ }
3085
+ }
3086
+ if (this.options.strict && hasErrors) throw new Error("Schema validation failed. Fix the errors above or set LintSchemaPlugin strict option to false.");
3087
+ this.lintDuplicateOperationId(compiler, documents);
3088
+ });
3089
+ }
3090
+ /**
3091
+ * Detect duplicate operationId across all operations within each API document.
3092
+ *
3093
+ * In tolerant mode, duplicates are auto-resolved by appending `__{method}_{pathname}` suffix
3094
+ * and the patched document replaces the original in the compiler context.
3095
+ * In strict mode (tolerant=false), an Exception is thrown immediately.
3096
+ */
3097
+ lintDuplicateOperationId(compiler, documents) {
3098
+ for (let i = 0; i < documents.length; i++) {
3099
+ const document = documents[i];
3100
+ const spec = document.specification;
3101
+ const moduleName = document.module.name;
3102
+ const operationIdMap = /* @__PURE__ */ new Map();
3103
+ for (const [pathname, pathItem] of Object.entries(spec.paths || {})) {
3104
+ if (!pathItem) continue;
3105
+ for (const method of SupportedMethods) {
3106
+ const operation = pathItem[method];
3107
+ if (!operation?.operationId) continue;
3108
+ const list = operationIdMap.get(operation.operationId) || [];
3109
+ list.push({
3110
+ method,
3111
+ pathname
3112
+ });
3113
+ operationIdMap.set(operation.operationId, list);
3114
+ }
3115
+ }
3116
+ const duplicates = [...operationIdMap.entries()].filter(([, ops]) => ops.length > 1);
3117
+ if (duplicates.length === 0) continue;
3118
+ if (!compiler.options.tolerant) {
3119
+ const messages = duplicates.map(([id, ops]) => ` - operationId "${id}" is used by: ${ops.map((o) => `[${o.method.toUpperCase()} ${o.pathname}]`).join(", ")}`);
3120
+ throw new Exception(document.module, `Duplicate operationId found:\n${messages.join("\n")}`);
3121
+ }
3122
+ const duplicateIds = new Set(duplicates.map(([id]) => id));
3123
+ for (const [id, ops] of duplicates) logger.warn(`[${moduleName}] Duplicate operationId "${id}" found in: ${ops.map((o) => `[${o.method.toUpperCase()} ${o.pathname}]`).join(", ")}`);
3124
+ const newSpec = OpenapiUtils.mapOperation(spec, (method, pathname, operation) => {
3125
+ if (operation.operationId && duplicateIds.has(operation.operationId)) {
3126
+ const sanitized = pathname.replace(/\//g, "_").replace(/-/g, "_").replace(/:/g, "$$").replace(/{(.+)}/, "$$$1");
3127
+ const newId = `${operation.operationId}__${method}${sanitized}`;
3128
+ logger.warn(`[${moduleName}] Renamed: "${operation.operationId}" -> "${newId}" for [${method.toUpperCase()} ${pathname}]`);
3129
+ operation.operationId = newId;
3130
+ }
3131
+ return operation;
3132
+ });
3133
+ compiler.context.documents[i] = new ApiDocumentV3_1(newSpec, document.module);
3134
+ }
3135
+ }
3136
+ };
3137
+ //#endregion
3138
+ //#region src/plugins/springdoc-compat/springdoc-compat.plugin.ts
3139
+ function flattenExtensions(obj) {
3140
+ if (typeof obj !== "object" || obj === null) return;
3141
+ if (Array.isArray(obj)) {
3142
+ for (const item of obj) flattenExtensions(item);
3143
+ return;
3144
+ }
3145
+ const record = obj;
3146
+ if ("extensions" in record && typeof record.extensions === "object" && record.extensions !== null) {
3147
+ const extensions = record.extensions;
3148
+ for (const [key, value] of Object.entries(extensions)) if (!(key in record)) record[key] = value;
3149
+ delete record.extensions;
3150
+ }
3151
+ for (const value of Object.values(record)) flattenExtensions(value);
3152
+ }
3153
+ /**
3154
+ * Springdoc (Java/Spring Boot) 生成的 OpenAPI 文档兼容插件。
3155
+ *
3156
+ * Springdoc 输出的文档存在若干不符合 OpenAPI 规范的结构,此插件在验证前进行修正。
3157
+ * 当前处理:
3158
+ * - 将嵌套的 `extensions` 对象展平为同级 x-* 属性
3159
+ */
3160
+ var SpringdocCompatPlugin = class SpringdocCompatPlugin {
3161
+ apply(compiler) {
3162
+ compiler.hooks.beforeValidate.tap(SpringdocCompatPlugin.name, (spec) => {
3163
+ flattenExtensions(spec);
3164
+ });
3165
+ }
3166
+ };
3167
+ //#endregion
3168
+ //#region src/plugins/mock/mock.plugin.ts
3169
+ function resolveRef(root, ref) {
3170
+ if (!ref.startsWith("#/")) return void 0;
3171
+ const parts = ref.slice(2).split("/");
3172
+ let current = root;
3173
+ for (const part of parts) {
3174
+ if (typeof current !== "object" || current === null) return void 0;
3175
+ current = current[part];
3176
+ }
3177
+ return typeof current === "object" && current !== null ? current : void 0;
3178
+ }
3179
+ function resolveSchemaNode(root, node) {
3180
+ if ("$ref" in node && typeof node["$ref"] === "string") return resolveRef(root, node["$ref"]);
3181
+ return node;
3182
+ }
3183
+ function hasExplicitValue(node) {
3184
+ return "example" in node || "examples" in node || "enum" in node || "const" in node || "x-faker" in node;
3185
+ }
3186
+ function matchesCondition(node, when) {
3187
+ if (when.type) {
3188
+ if (!(Array.isArray(when.type) ? when.type : [when.type]).includes(node.type)) return false;
3189
+ }
3190
+ if (when.format && node.format !== when.format) return false;
3191
+ return true;
3192
+ }
3193
+ function applyAction(node, then) {
3194
+ if ("example" in then) node.example = then.example;
3195
+ else if ("faker" in then) node["x-faker"] = then.args ? { [then.faker]: then.args } : then.faker;
3196
+ else if ("default" in then) node.default = then.default;
3197
+ }
3198
+ function extractPropertyTarget(given) {
3199
+ const match = given.match(/\.properties\.([^.[]+)$/);
3200
+ return match ? match[1] : void 0;
3201
+ }
3202
+ function extractSchemaEntryPath(given) {
3203
+ const idx = given.lastIndexOf(".properties.");
3204
+ if (idx === -1) return void 0;
3205
+ return given.slice(0, idx);
3206
+ }
3207
+ function walkSchemaProperties(schema, root, visitor, visited = /* @__PURE__ */ new Set()) {
3208
+ const resolved = resolveSchemaNode(root, schema);
3209
+ if (!resolved) return;
3210
+ if (visited.has(resolved)) return;
3211
+ visited.add(resolved);
3212
+ if (resolved.properties && typeof resolved.properties === "object") for (const [name, propValue] of Object.entries(resolved.properties)) {
3213
+ if (typeof propValue !== "object" || propValue === null) continue;
3214
+ const propSchema = propValue;
3215
+ visitor(name, propSchema);
3216
+ walkSchemaProperties(propSchema, root, visitor, visited);
3217
+ }
3218
+ if (resolved.items && typeof resolved.items === "object") walkSchemaProperties(resolved.items, root, visitor, visited);
3219
+ for (const key of [
3220
+ "allOf",
3221
+ "oneOf",
3222
+ "anyOf"
3223
+ ]) {
3224
+ const arr = resolved[key];
3225
+ if (Array.isArray(arr)) {
3226
+ for (const sub of arr) if (typeof sub === "object" && sub !== null) walkSchemaProperties(sub, root, visitor, visited);
3227
+ }
3228
+ }
3229
+ }
3230
+ var MockPlugin = class MockPlugin {
3231
+ rules;
3232
+ constructor(options) {
3233
+ this.rules = options.rules;
3234
+ }
3235
+ apply(compiler) {
3236
+ compiler.hooks.beforeValidate.tap(MockPlugin.name, (spec) => {
3237
+ for (const rule of this.rules) this.applyRule(spec, rule);
3238
+ });
3239
+ }
3240
+ applyRule(spec, rule) {
3241
+ const propertyTarget = extractPropertyTarget(rule.given);
3242
+ if (!propertyTarget) {
3243
+ const matches = JSONPath({
3244
+ path: rule.given,
3245
+ json: spec,
3246
+ resultType: "all"
3247
+ });
3248
+ for (const match of matches) {
3249
+ const node = match.value;
3250
+ if (typeof node !== "object" || node === null) continue;
3251
+ const schema = node;
3252
+ if (hasExplicitValue(schema)) continue;
3253
+ if (rule.when && !matchesCondition(schema, rule.when)) continue;
3254
+ applyAction(schema, rule.then);
3255
+ }
3256
+ return;
3257
+ }
3258
+ const schemaEntryPath = extractSchemaEntryPath(rule.given);
3259
+ if (!schemaEntryPath) return;
3260
+ const entries = JSONPath({
3261
+ path: schemaEntryPath,
3262
+ json: spec,
3263
+ resultType: "all"
3264
+ });
3265
+ for (const entry of entries) {
3266
+ if (typeof entry.value !== "object" || entry.value === null) continue;
3267
+ const schemaEntry = entry.value;
3268
+ walkSchemaProperties(schemaEntry, spec, (propName, propSchema) => {
3269
+ if (propName !== propertyTarget) return;
3270
+ if (hasExplicitValue(propSchema)) return;
3271
+ if (rule.when && !matchesCondition(propSchema, rule.when)) return;
3272
+ applyAction(propSchema, rule.then);
3273
+ });
3274
+ }
3275
+ }
3276
+ };
3277
+ //#endregion
3278
+ export { ResponseDeclarationGenerator as A, ModuleDefinition as B, MICRO_FUNCTION_REQUEST_GENERATOR as C, OPERATION_GENERATOR as D, GenerateDeclarationPlugin as E, FileTracker as F, QsArrayFormat as G, PrettierPlugin as H, Asset as I, ApiDocumentV3_1 as L, SchemaDeclarationGenerator as M, Exception as N, OperationDeclarationGenerator as O, OpenapiUtils as P, OperationDefinition as R, MicroFunctionGenerator as S, DECLARATION_GENERATOR as T, EslintPlugin as U, Artifact as V, SupportedMethods as W, USE_VALIBOT as _, OverwriteQueryOptionsPlugin as a, GenerateMicroFunctionPlugin as b, InitializePlugin as c, ShakingPlugin as d, DownloadLocalFilePlugin as f, NestjsModuleGenerator as g, GenerateNestjsModulePlugin as h, OverwriteAdditionalPropertiesPlugin as i, SCHEMA_GENERATOR as j, RESPONSE_GENERATOR as k, CleanPlugin as l, ChineseToPinyinPlugin as m, SpringdocCompatPlugin as n, OverwriteSchemaNamePlugin as o, DownloadHttpFilePlugin as p, LintSchemaPlugin as r, OverwriteOperationIdPlugin as s, MockPlugin as t, TerminalSelectPlugin as u, UseValibotPlugin as v, RequestGenerator as w, MICRO_FUNCTION_GENERATOR as x, BodyFallbackPlugin as y, SchemaDefinition as z };
3279
+
3280
+ //# sourceMappingURL=plugins-DCvJ8iHR.mjs.map