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
@@ -1,2365 +0,0 @@
1
- // src/plugins/eslint/index.ts
2
- import { ESLint } from "eslint";
3
- var EslintPlugin = class _EslintPlugin {
4
- constructor(options = {}) {
5
- this.options = options;
6
- }
7
- apply(compiler) {
8
- if (!compiler.options.build) return;
9
- if (this.options.disable && this.options.disable.length > 0) {
10
- const $rules = [
11
- ...this.options.disable.map((rule) => `/* eslint-disable ${rule} */`)
12
- ].join("\n");
13
- compiler.hooks.afterCompile.tap(_EslintPlugin.name, () => {
14
- const artifacts = compiler.context.artifacts || [];
15
- for (const artifact of artifacts) {
16
- artifact.anchor.append("file:start", $rules);
17
- }
18
- });
19
- }
20
- compiler.hooks.afterPersist.tapPromise(_EslintPlugin.name, async (task) => {
21
- const files = compiler.context.assets || [];
22
- if (files.length === 0) return;
23
- const eslint = new ESLint({ fix: true });
24
- const results = await eslint.lintFiles(files.map((file) => file.path));
25
- await ESLint.outputFixes(results);
26
- });
27
- }
28
- };
29
-
30
- // src/plugins/prettier/prettier.plugin.ts
31
- import { exec } from "child_process";
32
- import { promisify } from "util";
33
- var execAsync = promisify(exec);
34
- var PrettierPlugin = class _PrettierPlugin {
35
- apply(compiler) {
36
- if (!compiler.options.build) return;
37
- compiler.hooks.afterPersist.tapPromise(_PrettierPlugin.name, async () => {
38
- const files = compiler.context.assets || [];
39
- if (files.length === 0) return;
40
- const filePaths = files.map((file) => file.path).join(" ");
41
- await execAsync(`prettier --write ${filePaths}`);
42
- });
43
- }
44
- };
45
-
46
- // src/plugins/body-fallback/index.ts
47
- import * as R19 from "ramda";
48
-
49
- // src/utils/json-schema-utils/is-array.ts
50
- function isArray(schema) {
51
- return schema.type === "array";
52
- }
53
-
54
- // src/utils/json-schema-utils/is-mixed.ts
55
- function isMixed(schema) {
56
- return Array.isArray(schema.type);
57
- }
58
-
59
- // src/utils/json-schema-utils/is-non-array.ts
60
- function isNonArray(schema) {
61
- return typeof schema.type === "string" && schema.type !== "array";
62
- }
63
-
64
- // src/utils/json-schema-utils/is-ref.ts
65
- function isRef(schema) {
66
- return "$ref" in schema;
67
- }
68
-
69
- // src/utils/json-schema-utils/index.ts
70
- var JsonSchemaUtils = class {
71
- static isRef = isRef;
72
- static isArray = isArray;
73
- static isNonArray = isNonArray;
74
- static isMixed = isMixed;
75
- };
76
-
77
- // src/plugins/generate-micro-function/generate-micro-function.plugin.ts
78
- import { AsyncSeriesWaterfallHook as AsyncSeriesWaterfallHook2 } from "tapable";
79
-
80
- // src/plugins/generate-micro-function/constants/metadata-storage.ts
81
- var MetadataStorage = /* @__PURE__ */ new WeakMap();
82
-
83
- // src/plugins/generate-micro-function/generators/micro_function/micro-function.generator.ts
84
- import * as R18 from "ramda";
85
- import * as path7 from "path";
86
- import * as changeCase6 from "change-case";
87
-
88
- // src/models/artifact.ts
89
- import * as path from "path";
90
-
91
- // src/models/anchor.ts
92
- var AnchorBlock = class {
93
- constructor(artifact) {
94
- this.artifact = artifact;
95
- }
96
- /**
97
- * Append content to the end of the anchor block.
98
- */
99
- append(anchorName, content) {
100
- const lines = this.artifact.content.split("\n");
101
- const anchor = `@anchor:${anchorName}:end`;
102
- const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
103
- if (anchorIndex === -1) {
104
- throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
105
- }
106
- lines.splice(anchorIndex, 0, content);
107
- this.artifact.content = lines.join("\n");
108
- }
109
- prepend(anchorName, content) {
110
- const lines = this.artifact.content.split("\n");
111
- const anchor = `@anchor:${anchorName}:start`;
112
- const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
113
- if (anchorIndex === -1) {
114
- throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
115
- }
116
- lines.splice(anchorIndex + 1, 0, content);
117
- this.artifact.content = lines.join("\n");
118
- }
119
- replace(anchorName, content) {
120
- const lines = this.artifact.content.split("\n");
121
- const startIndex = lines.findIndex((line) => line.includes(`/* @anchor:${anchorName}:start */`));
122
- const endIndex = lines.findIndex((line) => line.includes(`/* @anchor:${anchorName}:end */`));
123
- if (startIndex === -1 || endIndex === -1 || endIndex <= startIndex) {
124
- throw new Error(`"@anchor:${anchorName}:start" or "@anchor:${anchorName}:end" not found in artifact "${this.artifact.filepath}".`);
125
- }
126
- lines.splice(startIndex + 1, endIndex - startIndex - 1, content);
127
- this.artifact.content = lines.join("\n");
128
- }
129
- };
130
- var Anchor = class {
131
- constructor(artifact) {
132
- this.artifact = artifact;
133
- this.block = new AnchorBlock(artifact);
134
- }
135
- block;
136
- append(anchorName, content) {
137
- const lines = this.artifact.content.split("\n");
138
- const anchor = `@anchor:${anchorName}`;
139
- const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
140
- if (anchorIndex === -1) {
141
- throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
142
- }
143
- lines.splice(anchorIndex + 1, 0, content);
144
- this.artifact.content = lines.join("\n");
145
- }
146
- prepend(anchorName, content) {
147
- const lines = this.artifact.content.split("\n");
148
- const anchor = `@anchor:${anchorName}`;
149
- const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
150
- if (anchorIndex === -1) {
151
- throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
152
- }
153
- lines.splice(anchorIndex, 0, content);
154
- this.artifact.content = lines.join("\n");
155
- }
156
- };
157
-
158
- // src/models/artifact.ts
159
- var HeaderComment = [
160
- "// Code generated by keq-cli. DO NOT EDIT.",
161
- "// Code generated by keq-cli. DO NOT EDIT.",
162
- "// Code generated by keq-cli. DO NOT EDIT.",
163
- "",
164
- ""
165
- ].join("\n");
166
- var Artifact = class {
167
- id;
168
- filepath;
169
- content;
170
- extensionName;
171
- anchor = new Anchor(this);
172
- constructor(options) {
173
- this.id = options.id;
174
- this.filepath = options.filepath;
175
- this.extensionName = options.extensionName || path.extname(options.filepath);
176
- this.content = options.content;
177
- }
178
- get dirname() {
179
- return path.dirname(this.filepath);
180
- }
181
- renderer() {
182
- return `${HeaderComment}${this.content}`;
183
- }
184
- };
185
-
186
- // src/models/api-document_v3_1.ts
187
- import * as R3 from "ramda";
188
-
189
- // src/models/module-definition.ts
190
- var ModuleDefinition = class _ModuleDefinition {
191
- name;
192
- address;
193
- constructor(name, address) {
194
- this.name = name;
195
- this.address = address;
196
- }
197
- static unknown() {
198
- return new _ModuleDefinition("", "");
199
- }
200
- };
201
-
202
- // src/constants/supported-methods.ts
203
- var SupportedMethods = [
204
- "get",
205
- "post",
206
- "put",
207
- "delete",
208
- "patch",
209
- "head",
210
- "options"
211
- ];
212
-
213
- // src/models/operation-definition.ts
214
- import * as R2 from "ramda";
215
-
216
- // src/utils/is-keywords.ts
217
- var keywords = [
218
- "break",
219
- "case",
220
- "catch",
221
- "continue",
222
- "default",
223
- "delete",
224
- "do",
225
- "else",
226
- "finally",
227
- "for",
228
- "function",
229
- "if",
230
- "in",
231
- "instanceof",
232
- "new",
233
- "return",
234
- "switch",
235
- "this",
236
- "throw",
237
- "try",
238
- "typeof",
239
- "var",
240
- "void",
241
- "while",
242
- "with"
243
- ];
244
- function isKeywords(str) {
245
- return keywords.includes(str);
246
- }
247
-
248
- // src/utils/is-reserved-word.ts
249
- var reservedWords = [
250
- "abstract",
251
- "boolean",
252
- "byte",
253
- "char",
254
- "class",
255
- "const",
256
- "debugger",
257
- "double",
258
- "enum",
259
- "export",
260
- "extends",
261
- "final",
262
- "float",
263
- "goto",
264
- "implements",
265
- "import",
266
- "int",
267
- "interface",
268
- "long",
269
- "native",
270
- "package",
271
- "private",
272
- "protected",
273
- "public",
274
- "short",
275
- "static",
276
- "super",
277
- "synchronized",
278
- "throws",
279
- "transient",
280
- "volatile"
281
- ];
282
- function isReservedWord(str) {
283
- return reservedWords.includes(str);
284
- }
285
-
286
- // src/models/operation-definition.ts
287
- import { JSONPath as JSONPath2 } from "jsonpath-plus";
288
-
289
- // src/models/schema-definition.ts
290
- import * as R from "ramda";
291
- import { JSONPath } from "jsonpath-plus";
292
- var SchemaDefinition = class _SchemaDefinition {
293
- name;
294
- schema;
295
- module;
296
- document;
297
- get id() {
298
- return `${this.module.address}#/components/schemas/${this.name}`;
299
- }
300
- constructor(args) {
301
- this.module = args.module;
302
- this.name = args.name;
303
- this.schema = args.schema;
304
- this.document = args.document;
305
- }
306
- getDependencies() {
307
- const refs = R.uniq(JSONPath({
308
- path: "$..*['$ref']",
309
- json: this.schema
310
- }));
311
- return refs.filter((ref) => typeof ref === "string" && !!ref.trim()).map((ref) => {
312
- const definition = this.document.dereference(ref);
313
- if (definition) return definition;
314
- return _SchemaDefinition.unknown();
315
- });
316
- }
317
- static unknown() {
318
- return new _SchemaDefinition({
319
- name: "",
320
- schema: {},
321
- module: ModuleDefinition.unknown(),
322
- document: ApiDocumentV3_1.unknown()
323
- });
324
- }
325
- static isUnknown(definition) {
326
- return definition.name === "";
327
- }
328
- };
329
-
330
- // src/models/operation-definition.ts
331
- var OperationDefinition = class {
332
- module;
333
- operationId;
334
- method;
335
- pathname;
336
- operation;
337
- document;
338
- get id() {
339
- return `${this.module.address}#/paths/${this.pathname}/${this.method}`;
340
- }
341
- constructor(args) {
342
- this.module = args.module;
343
- this.method = args.method.toLowerCase();
344
- this.pathname = args.pathname;
345
- this.document = args.document;
346
- this.operationId = this.formatOperationId(args.method, args.pathname, args.operation);
347
- this.operation = {
348
- ...args.operation,
349
- operationId: this.operationId
350
- };
351
- }
352
- formatOperationId(method, pathname, operation) {
353
- const operationId = operation.operationId;
354
- if (operationId && operationId !== "index" && !isKeywords(operationId) && !isReservedWord(operationId)) {
355
- return operationId;
356
- }
357
- return `${method}_${pathname}`.replace(/\//g, "_").replace(/-/g, "_").replace(/:/g, "$$").replace(/{(.+)}/, "$$$1");
358
- }
359
- getDependencies() {
360
- const refs = R2.uniq([
361
- ...JSONPath2({
362
- path: "$.requestBody.content..schema..$ref",
363
- json: this.operation
364
- }),
365
- ...JSONPath2({
366
- path: "$.responses..content..schema..$ref",
367
- json: this.operation
368
- }),
369
- ...JSONPath2({
370
- path: "$.parameters..schema..$ref",
371
- json: this.operation
372
- })
373
- ]);
374
- const dependencies = refs.filter((ref) => typeof ref === "string" && ref).map((ref) => {
375
- const schemaDefinition = this.document.dereference(ref);
376
- if (schemaDefinition) return schemaDefinition;
377
- return SchemaDefinition.unknown();
378
- });
379
- return dependencies;
380
- }
381
- };
382
-
383
- // src/utils/logger.ts
384
- import chalk from "chalk";
385
- var logger = {
386
- log: (str) => console.log(chalk.green(str)),
387
- warn: (str) => console.warn(chalk.yellow(str)),
388
- error: (str) => console.error(chalk.red(str))
389
- };
390
-
391
- // src/models/api-document_v3_1.ts
392
- var ApiDocumentV3_1 = class _ApiDocumentV3_1 {
393
- module;
394
- specification;
395
- constructor(specification, module) {
396
- this.module = module;
397
- this.specification = specification;
398
- }
399
- get schemas() {
400
- const module = this.module;
401
- return Object.entries(this.specification.components?.schemas || {}).map(([name, schema]) => new SchemaDefinition({
402
- name,
403
- schema,
404
- module,
405
- document: this
406
- }));
407
- }
408
- get operations() {
409
- const module = this.module;
410
- return Object.entries(this.specification.paths || {}).flatMap(([pathname, pathItem]) => Object.entries(pathItem || {}).filter(([method]) => SupportedMethods.includes(method.toLowerCase())).map(([method, operation]) => new OperationDefinition({
411
- method,
412
- pathname,
413
- operation,
414
- module,
415
- document: this
416
- })));
417
- }
418
- isEmpty() {
419
- return R3.isEmpty(this.specification.paths);
420
- }
421
- dereference($ref) {
422
- if ($ref.startsWith("#/")) {
423
- return this.schemas.find((schema) => schema.id.endsWith($ref));
424
- }
425
- logger.warn(`The $ref(${$ref}) is not defined in ${this.module.name} openapi/swagger.`);
426
- }
427
- isRefDefined($ref) {
428
- if ($ref.startsWith("#/")) {
429
- const path10 = $ref.replace("#/", "").split("/");
430
- return R3.path(path10, this.specification) !== void 0;
431
- }
432
- return false;
433
- }
434
- static unknown() {
435
- return new _ApiDocumentV3_1({}, ModuleDefinition.unknown());
436
- }
437
- };
438
-
439
- // src/plugins/generate-declaration/generate-declaration.plugin.ts
440
- import { AsyncSeriesWaterfallHook } from "tapable";
441
-
442
- // src/plugins/generate-declaration/generators/operation-declaration/operation.generator.ts
443
- import * as path6 from "path";
444
- import * as changeCase5 from "change-case";
445
-
446
- // src/transformers/json-schema/comment.renderer.ts
447
- var CommentRenderer = class {
448
- constructor(schema) {
449
- this.schema = schema;
450
- }
451
- render() {
452
- const schema = this.schema;
453
- const lines = ["/**"];
454
- if (schema.description) {
455
- const description = schema.description.replace("*/", "*\\/");
456
- lines.push(...description.split("\n").map((line) => ` * ${line}`));
457
- }
458
- if (schema.deprecated) {
459
- lines.push(" * @deprecated");
460
- }
461
- if (schema.readOnly) {
462
- lines.push(" * @readonly");
463
- }
464
- if (schema.format) {
465
- lines.push(` * @format ${schema.format}`);
466
- }
467
- lines.push(" */");
468
- if (lines.length === 2) return "";
469
- return lines.join("\n");
470
- }
471
- };
472
-
473
- // src/transformers/json-schema/declaration.renderer.ts
474
- import * as R5 from "ramda";
475
-
476
- // src/utils/indent.ts
477
- function indent(space, text) {
478
- if (text === "") return "";
479
- const indentation = " ".repeat(space);
480
- return text.split("\n").map((line) => line ? `${indentation}${line}` : line).join("\n");
481
- }
482
-
483
- // src/transformers/json-schema/reference.transformer.ts
484
- import * as R4 from "ramda";
485
- var ReferenceTransformer = class {
486
- static toDeclaration(schema, alias2 = R4.identity) {
487
- if (!schema.$ref || !schema.$ref.startsWith("#")) return `unknown /* ${schema.$ref.replace("*/", "*\\/")} */`;
488
- const parts = schema.$ref.split("/");
489
- return alias2(parts[parts.length - 1]) || "unknown";
490
- }
491
- };
492
-
493
- // src/transformers/json-schema/declaration.renderer.ts
494
- var DeclarationRenderer = class {
495
- constructor(schema, options = {}) {
496
- this.schema = schema;
497
- this.options = options;
498
- }
499
- render() {
500
- return this.renderSchema(this.schema);
501
- }
502
- renderSchema(schema) {
503
- if (typeof schema === "boolean") return "unknown";
504
- if (JsonSchemaUtils.isRef(schema)) return this.renderReference(schema);
505
- if (JsonSchemaUtils.isMixed(schema)) return this.renderMixed(schema);
506
- if (JsonSchemaUtils.isArray(schema)) return this.renderArray(schema);
507
- if (schema.type === "object") return this.renderObject(schema);
508
- if (schema.enum) return this.renderEnum(schema);
509
- if (schema.oneOf) return this.renderOneOf(schema);
510
- if (schema.anyOf) return this.renderAnyOf(schema);
511
- if (schema.allOf) return this.renderAllOf(schema);
512
- if (schema.type === "string") return this.renderString(schema);
513
- if (schema.type === "number") return this.renderNumber(schema);
514
- if (schema.type === "boolean") return this.renderBoolean(schema);
515
- if (schema.type === "null") return this.renderNull(schema);
516
- if (schema.type === "integer") return this.renderInteger(schema);
517
- return "unknown";
518
- }
519
- renderMixed(schema) {
520
- if (Array.isArray(schema.type)) {
521
- schema.type.map((type) => ({ ...schema, type })).map((schema2) => this.renderSchema(schema2)).join(" | ");
522
- }
523
- return "unknown";
524
- }
525
- renderReference(schema) {
526
- if (!this.options.referenceTransformer) {
527
- return ReferenceTransformer.toDeclaration(schema);
528
- }
529
- return this.options.referenceTransformer(schema);
530
- }
531
- renderArray(schema) {
532
- if (schema.items && Array.isArray(schema.items)) {
533
- const items = schema.items.map((s) => this.renderSchema(s)).join(", ");
534
- return `[${items}]`;
535
- }
536
- if (schema.items && typeof schema.items === "object") {
537
- return `${this.renderSchema(schema.items)}[]`;
538
- }
539
- return "any[]";
540
- }
541
- renderObject(schema) {
542
- if ((!schema.properties || R5.isEmpty(schema.properties)) && (!schema.additionalProperties || R5.isEmpty(schema.additionalProperties))) {
543
- return "object";
544
- }
545
- const $properties = Object.entries(schema.properties || {}).map(([propertyName, propertySchema]) => {
546
- let $comment = new CommentRenderer(propertySchema).render();
547
- if ($comment) $comment += "\n";
548
- const $key = `"${propertyName}"${schema.required?.includes(propertyName) ? "" : "?"}`;
549
- const $value = this.renderSchema(propertySchema);
550
- return indent(2, `${$comment}${$key}: ${$value}`);
551
- });
552
- if (schema.additionalProperties) {
553
- const $value = schema.additionalProperties === true ? "any" : this.renderSchema(schema.additionalProperties);
554
- $properties.push(indent(2, `[key: string]: ${$value}`));
555
- }
556
- return [
557
- "{",
558
- ...$properties,
559
- "}"
560
- ].join("\n");
561
- }
562
- renderOneOf(schema) {
563
- if (!schema.oneOf) return "unknown";
564
- return schema.oneOf.map((s) => this.renderSchema(s)).join(" | ");
565
- }
566
- renderAnyOf(schema) {
567
- if (!schema.anyOf) return "unknown";
568
- return schema.anyOf.map((s) => this.renderSchema(s)).join(" | ");
569
- }
570
- renderAllOf(schema) {
571
- if (!schema.allOf) return "unknown";
572
- return schema.allOf.map((s) => this.renderSchema(s)).join(" & ");
573
- }
574
- renderEnum(schema) {
575
- if (!schema.enum) return "unknown";
576
- return schema.enum.map((v) => JSON.stringify(v)).join(" | ");
577
- }
578
- renderString(schema) {
579
- if (schema.contentMediaType === "application/octet-stream") return "Blob | Buffer";
580
- if (schema.format === "binary") return "Blob | Buffer";
581
- return "string";
582
- }
583
- renderNumber(schema) {
584
- return "number";
585
- }
586
- renderBoolean(schema) {
587
- return "boolean";
588
- }
589
- renderNull(schema) {
590
- return "null";
591
- }
592
- renderInteger(schema) {
593
- return "number";
594
- }
595
- };
596
-
597
- // src/transformers/json-schema/json-schema.transformer.ts
598
- var JsonSchemaTransformer = class {
599
- static toComment(schema) {
600
- return new CommentRenderer(schema).render();
601
- }
602
- static toDeclaration(schema, options) {
603
- return new DeclarationRenderer(schema, options).render();
604
- }
605
- };
606
-
607
- // src/transformers/schema-definition/schema-definition.transformer.ts
608
- import * as R6 from "ramda";
609
- var SchemaDefinitionTransformer = class {
610
- static toDeclaration(schemaDefinition, options) {
611
- const dependencies = schemaDefinition.getDependencies();
612
- let $dependencies = dependencies.filter((dep) => !SchemaDefinition.isUnknown(dep)).map((dep) => {
613
- const filepath = options.getDependentSchemaDefinitionFilepath(dep);
614
- return `import type { ${dep.name} } from "${filepath}"`;
615
- }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, options.esm ? ' from "$1.js"' : ' from "$1"')).join("\n");
616
- if ($dependencies) $dependencies += "\n";
617
- let $comment = JsonSchemaTransformer.toComment(schemaDefinition.schema);
618
- if ($comment) $comment += "\n";
619
- if (typeof schemaDefinition.schema === "boolean") {
620
- return [
621
- "/* @anchor:file:start */",
622
- "",
623
- $dependencies,
624
- $comment || void 0,
625
- `type ${schemaDefinition.name} = unknown`,
626
- "",
627
- "/* @anchor:file:end */"
628
- ].filter(R6.isNotNil).join("\n");
629
- }
630
- if (JsonSchemaUtils.isNonArray(schemaDefinition.schema) && schemaDefinition.schema.type === "object") {
631
- const $schema = JsonSchemaTransformer.toDeclaration(schemaDefinition.schema);
632
- const $declaration = $schema.startsWith("{") ? `export interface ${schemaDefinition.name} ${$schema}` : `export type ${schemaDefinition.name} = ${$schema}`;
633
- return [
634
- "/* @anchor:file:start */",
635
- "",
636
- $dependencies,
637
- $comment || void 0,
638
- $declaration,
639
- "",
640
- "/* @anchor:file:end */"
641
- ].filter(R6.isNotNil).join("\n");
642
- }
643
- return [
644
- "/* @anchor:file:start */",
645
- "",
646
- $dependencies,
647
- $comment || void 0,
648
- `export type ${schemaDefinition.name} = ${JsonSchemaTransformer.toDeclaration(schemaDefinition.schema)}`,
649
- "",
650
- "/* @anchor:file:end */"
651
- ].filter(R6.isNotNil).join("\n");
652
- }
653
- };
654
-
655
- // src/transformers/operation-definition/comment.renderer.ts
656
- import * as R7 from "ramda";
657
- var CommentRenderer2 = class {
658
- constructor(operationDefinition) {
659
- this.operationDefinition = operationDefinition;
660
- }
661
- render() {
662
- const operation = this.operationDefinition.operation;
663
- if (!operation.summary && !operation.description) return "";
664
- const lines = ["/**"];
665
- if (operation.summary && typeof operation.summary === "string") {
666
- lines.push(` * ${R7.trim(operation.summary)}`);
667
- lines.push(" *");
668
- }
669
- if (operation.description && typeof operation.description === "string") {
670
- lines.push(` * @description ${R7.trim(operation.description)}`);
671
- }
672
- lines.push(" */");
673
- return lines.join("\n");
674
- }
675
- };
676
-
677
- // src/transformers/operation-definition/declaration.renderer.ts
678
- import * as R12 from "ramda";
679
-
680
- // src/transformers/operation-definition/utils/type-name-factory.ts
681
- import * as changeCase from "change-case";
682
- function typeNameFactory(operationDefinition) {
683
- const pascalCaseOperationId = changeCase.pascalCase(operationDefinition.operationId);
684
- return (name) => `${pascalCaseOperationId}${name}`;
685
- }
686
-
687
- // src/utils/openapi-utils/dereference.ts
688
- function dereference($ref, swagger) {
689
- let value;
690
- for (const key of $ref.split("/")) {
691
- if (key === "#") {
692
- value = swagger;
693
- } else {
694
- value = value[key];
695
- }
696
- if (!value) break;
697
- }
698
- return value;
699
- }
700
-
701
- // src/utils/openapi-utils/dereference-operation.ts
702
- import * as R10 from "ramda";
703
- import jsonpointer2 from "jsonpointer";
704
- import { JSONPath as JSONPath4 } from "jsonpath-plus";
705
-
706
- // src/utils/openapi-utils/remove-undefined-ref.ts
707
- import * as R9 from "ramda";
708
- import jsonpointer from "jsonpointer";
709
- import { JSONPath as JSONPath3 } from "jsonpath-plus";
710
-
711
- // src/utils/openapi-utils/is-ref-defined.ts
712
- import * as R8 from "ramda";
713
- function isRefDefined($ref, swagger) {
714
- if ($ref.startsWith("#/")) {
715
- const path10 = $ref.replace("#/", "").split("/");
716
- return R8.path(path10, swagger) !== void 0;
717
- }
718
- return false;
719
- }
720
-
721
- // src/utils/openapi-utils/remove-undefined-ref.ts
722
- function removeUndefinedRef(swagger) {
723
- const shadow = R9.clone(swagger);
724
- const matches = JSONPath3({
725
- path: "$..*['$ref']^",
726
- json: swagger,
727
- resultType: "all"
728
- });
729
- for (const match of matches) {
730
- if (match.value.$ref && !isRefDefined(match.value.$ref, swagger)) {
731
- jsonpointer.set(shadow, match.pointer, R9.omit(["$ref"], match.value));
732
- }
733
- }
734
- return shadow;
735
- }
736
-
737
- // src/utils/openapi-utils/dereference-operation.ts
738
- function dereferencePathObject(swagger) {
739
- const matches = JSONPath4({
740
- path: "$.paths.*.$ref^",
741
- json: swagger,
742
- resultType: "all"
743
- });
744
- for (const match of matches) {
745
- const value = dereference(match.value.$ref, swagger);
746
- jsonpointer2.set(swagger, match.pointer, value);
747
- }
748
- }
749
- function dereferenceRequestBody(swagger) {
750
- const matches = JSONPath4({
751
- path: "$.paths.*.*.requestBody.$ref^",
752
- json: swagger,
753
- resultType: "all"
754
- });
755
- for (const match of matches) {
756
- const value = dereference(match.value.$ref, swagger);
757
- jsonpointer2.set(swagger, match.pointer, value);
758
- }
759
- }
760
- function dereferenceResponses(swagger) {
761
- const matches = [
762
- ...JSONPath4({
763
- path: "$.paths.*.*.responses.*.$ref^",
764
- json: swagger,
765
- resultType: "all"
766
- }),
767
- ...JSONPath4({
768
- path: "$.paths.*.*.responses.*.headers.*.$ref^",
769
- json: swagger,
770
- resultType: "all"
771
- })
772
- ];
773
- for (const match of matches) {
774
- const value = dereference(match.value.$ref, swagger);
775
- jsonpointer2.set(swagger, match.pointer, value);
776
- }
777
- }
778
- function dereferenceParameters(swagger) {
779
- const matches = JSONPath4({
780
- path: "$.paths.*.*.parameters.*.$ref^",
781
- json: swagger,
782
- resultType: "all"
783
- });
784
- for (const match of matches) {
785
- const value = dereference(match.value.$ref, swagger);
786
- jsonpointer2.set(swagger, match.pointer, value);
787
- }
788
- }
789
- function dereferenceOperation(swagger) {
790
- const shadow = R10.clone(swagger);
791
- dereferencePathObject(shadow);
792
- dereferenceRequestBody(shadow);
793
- dereferenceResponses(shadow);
794
- dereferenceParameters(shadow);
795
- return removeUndefinedRef(shadow);
796
- }
797
-
798
- // src/utils/openapi-utils/dereference-deep.ts
799
- function dereferenceDeep($ref, swagger) {
800
- const stack = [$ref];
801
- let value;
802
- while (true) {
803
- const last = stack[stack.length - 1];
804
- value = dereference(last, swagger);
805
- if (JsonSchemaUtils.isRef(value)) {
806
- if (!stack.includes(value.$ref)) {
807
- stack.push(value.$ref);
808
- continue;
809
- } else {
810
- throw new Error(`Circular reference detected: ${stack.join(" -> ")} -> ${value.$ref}`);
811
- }
812
- }
813
- break;
814
- }
815
- return value;
816
- }
817
-
818
- // src/utils/openapi-utils/to-3_1.ts
819
- import { upgrade } from "@scalar/openapi-parser";
820
- function To3_1(openapi) {
821
- const { specification } = upgrade(openapi);
822
- return specification;
823
- }
824
-
825
- // src/utils/openapi-utils/map-operation.ts
826
- import * as R11 from "ramda";
827
- function mapOperation(specification, mapper) {
828
- const shadow = R11.clone(specification);
829
- for (const [pathname, pathItem] of Object.entries(shadow.paths || {})) {
830
- for (const m in pathItem) {
831
- const method = m.toLowerCase();
832
- if (!SupportedMethods.includes(method)) continue;
833
- if (typeof pathItem[m] !== "object" || Array.isArray(pathItem[m]) || pathItem[m] === null) continue;
834
- const operation = pathItem[m];
835
- pathItem[m] = mapper(method, pathname, operation);
836
- }
837
- }
838
- return shadow;
839
- }
840
-
841
- // src/utils/openapi-utils/map-parameter.ts
842
- function mapParameter(specification, mapper) {
843
- return mapOperation(specification, (method, pathname, operation) => {
844
- if (!operation.parameters) return operation;
845
- operation.parameters = operation.parameters.map((parameter) => mapper(method, pathname, operation, parameter));
846
- return operation;
847
- });
848
- }
849
-
850
- // src/utils/openapi-utils/index.ts
851
- var OpenapiUtils = class {
852
- static isRefDefined = isRefDefined;
853
- static dereference = dereference;
854
- static dereferenceDeep = dereferenceDeep;
855
- static removeUndefinedRef = removeUndefinedRef;
856
- static dereferenceOperation = dereferenceOperation;
857
- static mapOperation = mapOperation;
858
- static mapParameter = mapParameter;
859
- // static updateOperationId = updateOperationId
860
- static to3_1 = To3_1;
861
- };
862
-
863
- // src/transformers/operation-definition/declaration.renderer.ts
864
- var alias = (name) => `${name}Schema`;
865
- var DeclarationRenderer2 = class {
866
- constructor(operationDefinition, options) {
867
- this.operationDefinition = operationDefinition;
868
- this.options = options;
869
- this.typeName = typeNameFactory(operationDefinition);
870
- }
871
- typeName;
872
- renderResponseBodies(operation, options) {
873
- if (!operation.responses || R12.isEmpty(operation.responses)) {
874
- return `export interface ${this.typeName("ResponseBodies")} {}`;
875
- }
876
- const $responses = Object.entries(operation.responses).map(([statusCode, response]) => {
877
- if (!JsonSchemaUtils.isRef(response)) {
878
- const $value = Object.entries(response.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schema]) => {
879
- if (mediaType.includes("text/event-stream")) return "ReadableStream<ServerSentEvent>";
880
- if (mediaType.includes("multipart/form-data")) return "FormData";
881
- if (!schema) return "unknown";
882
- return JsonSchemaTransformer.toDeclaration(schema, options);
883
- }).join(" | ");
884
- return indent(2, `${statusCode}: ${$value || "void"}`);
885
- }
886
- }).join("\n");
887
- return [
888
- `export interface ${this.typeName("ResponseBodies")} {`,
889
- $responses,
890
- "}"
891
- ].join("\n");
892
- }
893
- renderRequestBodies(operation, options) {
894
- let $requestBodies = `export interface ${this.typeName("RequestBodies")} {}`;
895
- if (operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody)) {
896
- const $mediaTypes = Object.entries(operation.requestBody.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schema]) => {
897
- if (!schema) return `${JSON.stringify(mediaType)}: unknown`;
898
- return `${JSON.stringify(mediaType)}: ${JsonSchemaTransformer.toDeclaration(schema, options)}`;
899
- }).map((pair) => indent(2, pair));
900
- $requestBodies = [
901
- `export interface ${this.typeName("RequestBodies")} {`,
902
- ...$mediaTypes,
903
- "}"
904
- ].join("\n");
905
- }
906
- return $requestBodies;
907
- }
908
- renderParameterBodies(operationDefinition, options) {
909
- const { operation } = operationDefinition;
910
- let parameterBodies = "";
911
- if (operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody)) {
912
- const $mediaTypes = Object.entries(operation.requestBody.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schemaOrRef]) => {
913
- if (!schemaOrRef) return `${JSON.stringify(mediaType)}: unknown`;
914
- const schema = JsonSchemaUtils.isRef(schemaOrRef) ? OpenapiUtils.dereferenceDeep(schemaOrRef.$ref, operationDefinition.document.specification) : schemaOrRef;
915
- if (schema.type === "object" || schema.properties) {
916
- return `${JSON.stringify(mediaType)}: ${JsonSchemaTransformer.toDeclaration(schemaOrRef, options)} & { [key: string]: any }`;
917
- }
918
- return `${JSON.stringify(mediaType)}: { [key: string]: any }`;
919
- }).map((pair) => indent(2, pair));
920
- parameterBodies = [
921
- `interface ${this.typeName("ParameterBodies")} {`,
922
- ...$mediaTypes,
923
- "}",
924
- ""
925
- ].join("\n");
926
- }
927
- return parameterBodies;
928
- }
929
- renderRequestParameters(operation, options) {
930
- const mediaTypes = operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody) ? Object.keys(operation.requestBody.content || {}) : [];
931
- const base = `${this.typeName("RequestQuery")} & ${this.typeName("RouteParameters")} & ${this.typeName("RequestHeaders")}`;
932
- if (mediaTypes.length === 1) {
933
- return `export type ${this.typeName("RequestParameters")} = ${base} & ${this.typeName("RequestBodies")}[${JSON.stringify(mediaTypes[0])}]`;
934
- }
935
- if (mediaTypes.length > 1) {
936
- const unions = mediaTypes.map((mediaType) => `(${base} & ${this.typeName("RequestBodies")}[${JSON.stringify(mediaType)}] & { "content-type": ${JSON.stringify(mediaType)} })`).join("\n| ");
937
- return `export type ${this.typeName("RequestParameters")} = ${unions}`;
938
- }
939
- return `export type ${this.typeName("RequestParameters")} = ${base}`;
940
- }
941
- rendererParameters(name, parameters, options) {
942
- if (parameters.length === 0) {
943
- return `export type ${name} = {}`;
944
- }
945
- const $parameters = parameters.map((parameter) => {
946
- const parameterName = `"${parameter.name}"`;
947
- const $key = parameter.required ? parameterName : `${parameterName}?`;
948
- const $value = JsonSchemaTransformer.toDeclaration(parameter.schema || { type: "any" }, options);
949
- return indent(2, `${$key}: ${$value}`);
950
- }).join("\n");
951
- return [
952
- `export type ${name} = {`,
953
- $parameters,
954
- "}"
955
- ].filter(Boolean).join("\n");
956
- }
957
- renderDependencies() {
958
- const schemaDefinitions = this.operationDefinition.getDependencies().filter((schemaDefinition) => !SchemaDefinition.isUnknown(schemaDefinition));
959
- const $schemaDefinitions = schemaDefinitions.map((schemaDefinition) => {
960
- const filepath = this.options.getDependentSchemaDefinitionFilepath(schemaDefinition);
961
- const schemaName = schemaDefinition.name;
962
- return `import type { ${schemaName} as ${alias(schemaName)} } from "${filepath}"`;
963
- }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? ' from "$1.js"' : ' from "$1"'));
964
- return [
965
- 'import type { KeqOperation, KeqPathParameterInit, KeqQueryInit, ServerSentEvent } from "keq"',
966
- ...$schemaDefinitions
967
- ].join("\n");
968
- }
969
- render() {
970
- const { operation } = this.operationDefinition;
971
- if (!operation.responses) return "";
972
- const jsonSchemaDeclarationRendererOptions = {
973
- referenceTransformer: (schema) => {
974
- return ReferenceTransformer.toDeclaration(schema, alias);
975
- }
976
- };
977
- const $dependencies = this.renderDependencies();
978
- const $responseBodies = this.renderResponseBodies(operation, jsonSchemaDeclarationRendererOptions);
979
- const $requestBodies = this.renderRequestBodies(operation, jsonSchemaDeclarationRendererOptions);
980
- const $parameterBodies = this.renderParameterBodies(this.operationDefinition, jsonSchemaDeclarationRendererOptions);
981
- const $requestParameters = this.renderRequestParameters(operation, jsonSchemaDeclarationRendererOptions);
982
- const $requestQuery = this.rendererParameters(
983
- `${this.typeName("RequestQuery")}`,
984
- operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "query") || [],
985
- jsonSchemaDeclarationRendererOptions
986
- );
987
- const $routeParameters = this.rendererParameters(
988
- `${this.typeName("RouteParameters")}`,
989
- operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "path") || [],
990
- jsonSchemaDeclarationRendererOptions
991
- );
992
- const $requestHeaders = this.rendererParameters(
993
- `${this.typeName("RequestHeaders")}`,
994
- operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "header") || [],
995
- jsonSchemaDeclarationRendererOptions
996
- );
997
- return [
998
- "/* @anchor:file:start */",
999
- "",
1000
- $dependencies,
1001
- "",
1002
- $responseBodies,
1003
- "",
1004
- $requestBodies,
1005
- "",
1006
- $requestQuery,
1007
- "",
1008
- $routeParameters,
1009
- "",
1010
- $requestHeaders,
1011
- "",
1012
- $parameterBodies || void 0,
1013
- $requestParameters,
1014
- "",
1015
- `export interface ${this.typeName("Operation")}<STATUS extends keyof ${this.typeName("ResponseBodies")}, CONTENT_TYPE extends ${$parameterBodies ? `keyof ${this.typeName("ParameterBodies")}` : "string"} > extends KeqOperation {`,
1016
- ` requestParams: ${this.typeName("RouteParameters")} & { [key: string]: KeqPathParameterInit }`,
1017
- ` requestQuery: ${this.typeName("RequestQuery")} & { [key: string]: KeqQueryInit }`,
1018
- ` requestHeaders: ${this.typeName("RequestHeaders")} & { [key: string]: string | number }`,
1019
- ` requestBody: ${$parameterBodies ? `${this.typeName("ParameterBodies")}[CONTENT_TYPE] | ` : "object | "}BodyInit`,
1020
- ` responseBody: ${this.typeName("ResponseBodies")}[STATUS]`,
1021
- "}",
1022
- "",
1023
- "/* @anchor:file:end */"
1024
- ].filter(R12.isNotNil).join("\n");
1025
- }
1026
- };
1027
-
1028
- // src/transformers/operation-definition/micro-function.renderer.ts
1029
- import * as R14 from "ramda";
1030
-
1031
- // src/exception.ts
1032
- import { CustomError } from "ts-custom-error";
1033
- import wrap from "word-wrap";
1034
- var Exception = class extends CustomError {
1035
- constructor(module, message) {
1036
- const moduleName = typeof module === "string" ? module : module.name;
1037
- const msg = wrap(message, { width: 60, indent: " " });
1038
- super(`${moduleName} module failed to compile:
1039
- ${msg}`);
1040
- Object.defineProperty(this, "name", { value: "KeqCLI_Exception" });
1041
- }
1042
- };
1043
-
1044
- // src/transformers/operation-definition/typescript-snippet.ts
1045
- import * as R13 from "ramda";
1046
-
1047
- // src/constants/qs-array-format.ts
1048
- var QsArrayFormat = /* @__PURE__ */ ((QsArrayFormat2) => {
1049
- QsArrayFormat2["brackets"] = "brackets";
1050
- QsArrayFormat2["indices"] = "indices";
1051
- QsArrayFormat2["repeat"] = "repeat";
1052
- QsArrayFormat2["comma"] = "comma";
1053
- QsArrayFormat2["space"] = "space";
1054
- QsArrayFormat2["pipe"] = "pipe";
1055
- return QsArrayFormat2;
1056
- })(QsArrayFormat || {});
1057
-
1058
- // src/transformers/operation-definition/typescript-snippet.ts
1059
- var OperationDefinitionSnippet = class {
1060
- constructor(operationDefinition, options) {
1061
- this.operationDefinition = operationDefinition;
1062
- this.options = options;
1063
- this.typeName = typeNameFactory(operationDefinition);
1064
- }
1065
- typeName;
1066
- getQsParameters(parameter) {
1067
- let arrayFormat;
1068
- let allowDots;
1069
- let indices;
1070
- const style = parameter.style || "form";
1071
- const explode = parameter.explode ?? true;
1072
- if ("x-qs-array-format" in parameter) {
1073
- arrayFormat = parameter["x-qs-array-format"];
1074
- } else {
1075
- if (style === "deepObject") {
1076
- arrayFormat = "brackets" /* brackets */;
1077
- } else if (explode) {
1078
- arrayFormat = "repeat" /* repeat */;
1079
- } else {
1080
- if (style === "form") {
1081
- arrayFormat = "comma" /* comma */;
1082
- } else if (style === "spaceDelimited") {
1083
- arrayFormat = "space" /* space */;
1084
- } else if (style === "pipeDelimited") {
1085
- arrayFormat = "pipe" /* pipe */;
1086
- }
1087
- }
1088
- }
1089
- if ("x-qs-allow-dots" in parameter) {
1090
- allowDots = Boolean(parameter["x-qs-allow-dots"]);
1091
- }
1092
- if ("x-qs-indices" in parameter) {
1093
- indices = Boolean(parameter["x-qs-indices"]);
1094
- }
1095
- if (arrayFormat || allowDots !== void 0 || indices !== void 0) {
1096
- return {
1097
- ...arrayFormat ? { arrayFormat } : {},
1098
- ...allowDots !== void 0 ? { allowDots } : {},
1099
- ...indices !== void 0 ? { indices } : {}
1100
- };
1101
- }
1102
- return void 0;
1103
- }
1104
- // render: "if (args && 'Authorization' in args) req.header('Authorization', args['Authorization'])"
1105
- renderRequestHeaders() {
1106
- const { operation } = this.operationDefinition;
1107
- const $headers = (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");
1108
- return $headers;
1109
- }
1110
- // render: "if (args && 'id' in args) req.query('id', args['id'], options)"
1111
- renderRequestQuery() {
1112
- const { operation } = this.operationDefinition;
1113
- const $query = (operation.parameters || []).filter((p) => !JsonSchemaUtils.isRef(p)).filter((p) => p.in === "query").map((p) => {
1114
- const option = this.getQsParameters(p);
1115
- const $option = !option || R13.isEmpty(option) ? "" : `, ${JSON.stringify(option)}`;
1116
- return `if (args && ${JSON.stringify(p.name)} in args) req.query(${JSON.stringify(p.name)}, args[${JSON.stringify(p.name)}]${$option})`;
1117
- }).join("\n");
1118
- return $query;
1119
- }
1120
- // render: "if (args && 'id' in args) req.params('id', args['id'])"
1121
- renderRequestPathParameters() {
1122
- const { operation } = this.operationDefinition;
1123
- const $pathParameters = (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");
1124
- return $pathParameters;
1125
- }
1126
- getRequestMediaTypes() {
1127
- const { operation } = this.operationDefinition;
1128
- const requestBodyContent = operation.requestBody?.content || {};
1129
- return Object.keys(requestBodyContent);
1130
- }
1131
- // render "req.type("application/json")"
1132
- renderMediaType() {
1133
- const mediaTypes = this.getRequestMediaTypes();
1134
- if (mediaTypes.length === 1 && !mediaTypes[0].endsWith("/*")) {
1135
- return `req.type("${mediaTypes[0]}")
1136
- `;
1137
- } else if (mediaTypes.some((mediaType) => mediaType === "*/*")) {
1138
- } else if (mediaTypes.some((mediaType) => mediaType.endsWith("/*"))) {
1139
- return 'if(args?.["content-type"]) req.type(args["content-type"])\n';
1140
- } else if (mediaTypes.length > 1) {
1141
- return 'if(args?.["content-type"]) req.type(args["content-type"])\n';
1142
- }
1143
- return "";
1144
- }
1145
- // render body
1146
- requestBodyFormDataPropertyRenderer(propertyName, propertySchema, mediaType) {
1147
- try {
1148
- const $propertyName = JSON.stringify(propertyName);
1149
- const schema = JsonSchemaUtils.isRef(propertySchema) ? OpenapiUtils.dereferenceDeep(propertySchema.$ref, this.operationDefinition.document.specification) : propertySchema;
1150
- if (schema.type === "string" && schema.format === "binary" || schema.contentMediaType === "application/octet-stream") {
1151
- return `if (args && ${$propertyName} in args && args[${$propertyName}]) req.attach(${$propertyName}, args[${$propertyName}])`;
1152
- } else if (schema.type === "string" || schema.type === "array" && schema.items && schema.items.type === "string") {
1153
- return `if (args && ${$propertyName} in args && args[${$propertyName}] !== undefined) req.field(${$propertyName}, args[${$propertyName}])`;
1154
- } else if (schema.type === "number" || schema.type === "integer") {
1155
- return `if (args && ${$propertyName} in args && args[${$propertyName}] !== undefined) req.field(${$propertyName}, String(args[${$propertyName}]))`;
1156
- }
1157
- 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 */)`;
1158
- } catch (err) {
1159
- return this.renderErrorComment(err, mediaType);
1160
- }
1161
- }
1162
- requestBodyPropertyRenderer(propertyName, propertySchema, mediaType) {
1163
- if (mediaType === "application/json") {
1164
- const $propertyName = JSON.stringify(propertyName);
1165
- return `if (args && ${$propertyName} in args) req.send({ ${$propertyName}: args[${$propertyName}] })`;
1166
- } else if (mediaType === "multipart/form-data") {
1167
- return this.requestBodyFormDataPropertyRenderer(propertyName, propertySchema, mediaType);
1168
- } else {
1169
- throw new Error(`Unsupported media type: ${mediaType}`);
1170
- }
1171
- }
1172
- renderRequestBody() {
1173
- const { operation } = this.operationDefinition;
1174
- const requestBodyContent = operation.requestBody?.content || {};
1175
- const $requestBody = Object.entries(requestBodyContent).map(([mediaType, mediaTypeObject]) => {
1176
- if (!mediaTypeObject.schema) return;
1177
- try {
1178
- const schema = JsonSchemaUtils.isRef(mediaTypeObject.schema) ? OpenapiUtils.dereferenceDeep(mediaTypeObject.schema.$ref, this.operationDefinition.document.specification) : mediaTypeObject.schema;
1179
- if (schema.type !== "object") return;
1180
- const properties = schema.properties || {};
1181
- return Object.entries(properties).map(([propertyName, propertySchema]) => this.requestBodyPropertyRenderer(propertyName, propertySchema, mediaType)).join("\n");
1182
- } catch (err) {
1183
- return this.renderErrorComment(err, mediaType);
1184
- }
1185
- }).filter(R13.isNotNil).join("\n");
1186
- return $requestBody;
1187
- }
1188
- renderErrorComment(err, mediaType) {
1189
- const $err = String(err).split("\n").map(((line) => ` * ${line}`)).join("\n");
1190
- return [
1191
- "/**",
1192
- ` * Unable to dereference schema for media type ${mediaType}`,
1193
- $err,
1194
- " */"
1195
- ].join("\n");
1196
- }
1197
- };
1198
-
1199
- // src/transformers/operation-definition/micro-function.renderer.ts
1200
- var OperationDefinitionMicroFunctionRenderer = class {
1201
- constructor(operationDefinition, options) {
1202
- this.operationDefinition = operationDefinition;
1203
- this.options = options;
1204
- this.typeName = typeNameFactory(operationDefinition);
1205
- this.helper = new OperationDefinitionSnippet(operationDefinition, options);
1206
- }
1207
- helper;
1208
- typeName;
1209
- render() {
1210
- const { operation, operationId, method, pathname } = this.operationDefinition;
1211
- if (!operation.responses) return "";
1212
- const $dependencies = this.renderDependencies();
1213
- const $comment = new CommentRenderer2(this.operationDefinition).render();
1214
- const moduleName = this.operationDefinition.module.name;
1215
- const $method = method.toLowerCase();
1216
- const $queryParameters = this.helper.renderRequestQuery();
1217
- const $headerParameters = this.helper.renderRequestHeaders();
1218
- const $pathParameters = this.helper.renderRequestPathParameters();
1219
- const $mediaType = this.helper.renderMediaType();
1220
- const $requestBody = this.helper.renderRequestBody();
1221
- const $operationDeclaration = this.renderOperationDeclaration();
1222
- return [
1223
- "/* @anchor:file:start */",
1224
- "",
1225
- $dependencies,
1226
- "",
1227
- `const moduleName = "${moduleName}"`,
1228
- `const method = "${method}"`,
1229
- `const pathname = "${pathname}"`,
1230
- "",
1231
- $comment || void 0,
1232
- `export ${$operationDeclaration} {`,
1233
- ` const req = request.${$method}<${this.typeName("ResponseBodies")}[STATUS]>("${pathname}")`,
1234
- " .option('module', { name: moduleName, pathname, method })",
1235
- "",
1236
- $mediaType ? indent(2, $mediaType) : void 0,
1237
- " /* @anchor:query:start */",
1238
- $queryParameters ? indent(2, $queryParameters) : void 0,
1239
- " /* @anchor:query:end */",
1240
- "",
1241
- " /* @anchor:headers:start */",
1242
- $headerParameters ? indent(2, $headerParameters) : void 0,
1243
- " /* @anchor:headers:end */",
1244
- "",
1245
- " /* @anchor:path-parameters:start */",
1246
- $pathParameters ? indent(2, $pathParameters) : void 0,
1247
- " /* @anchor:path-parameters:end */",
1248
- "",
1249
- " /* @anchor:body:start */",
1250
- $requestBody ? indent(2, $requestBody) : void 0,
1251
- " /* @anchor:body:end */",
1252
- "",
1253
- " /* @anchor:operation-return */",
1254
- ` return req as ReturnType<typeof ${operationId}<STATUS${$operationDeclaration.includes("CONTENT_TYPE") ? ", CONTENT_TYPE" : ""}>>`,
1255
- "}",
1256
- "",
1257
- `${operationId}.pathname = pathname`,
1258
- `${operationId}.method = method`,
1259
- "/* @anchor:file:end */"
1260
- ].filter(R14.isNotNil).join("\n");
1261
- }
1262
- renderDependencies() {
1263
- const declarationFilepath = this.options.getOperationDefinitionDeclarationFilepath(this.operationDefinition);
1264
- const requestFilepath = this.options.getRequestFilepath();
1265
- return [
1266
- 'import { Keq } from "keq"',
1267
- `import { request } from "${requestFilepath}"`,
1268
- `import type { ${this.typeName("Operation")}, ${this.typeName("ResponseBodies")}, ${this.typeName("RequestParameters")} } from "${declarationFilepath}"`,
1269
- `export type { ${this.typeName("RequestQuery")}, ${this.typeName("RequestHeaders")}, ${this.typeName("RequestBodies")} } from "${declarationFilepath}"`
1270
- ].map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? ' from "$1.js"' : ' from "$1"')).join("\n");
1271
- }
1272
- renderOperationDeclaration() {
1273
- const { operationId } = this.operationDefinition;
1274
- const mediaTypes = this.helper.getRequestMediaTypes();
1275
- if (mediaTypes.length === 0) {
1276
- 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>>`;
1277
- } else if (mediaTypes.length === 1) {
1278
- 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>>`;
1279
- } else if (mediaTypes.length > 1) {
1280
- 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>>`;
1281
- }
1282
- throw new Exception(this.operationDefinition.module, "[operationDeclarationRenderer] Unreachable");
1283
- }
1284
- };
1285
-
1286
- // src/transformers/operation-definition/nestjs-method.renderer.ts
1287
- import * as R15 from "ramda";
1288
- var OperationDefinitionNestjsMethodRenderer = class {
1289
- constructor(operationDefinition, options) {
1290
- this.operationDefinition = operationDefinition;
1291
- this.options = options;
1292
- this.typeName = typeNameFactory(operationDefinition);
1293
- this.helper = new OperationDefinitionSnippet(operationDefinition, options);
1294
- }
1295
- helper;
1296
- typeName;
1297
- render() {
1298
- const pathname = this.operationDefinition.pathname;
1299
- const $comment = new CommentRenderer2(this.operationDefinition).render();
1300
- const $method = this.operationDefinition.method.toLowerCase();
1301
- const $mediaType = this.helper.renderMediaType();
1302
- const $operationDeclaration = this.renderOperationDeclaration(this.operationDefinition);
1303
- const $queryParameters = this.helper.renderRequestQuery();
1304
- const $headerParameters = this.helper.renderRequestHeaders();
1305
- const $pathParameters = this.helper.renderRequestPathParameters();
1306
- const $requestBody = this.helper.renderRequestBody();
1307
- return [
1308
- $comment,
1309
- `${$operationDeclaration} {`,
1310
- ` const req = this.request.${$method}<${this.typeName("ResponseBodies")}[STATUS]>(${JSON.stringify(pathname)})`,
1311
- " .option(",
1312
- ' "module",',
1313
- " {",
1314
- ` name: ${JSON.stringify(this.operationDefinition.module.name)},`,
1315
- ` pathname: ${JSON.stringify(pathname)},`,
1316
- ` method: ${JSON.stringify($method)},`,
1317
- " },",
1318
- " )",
1319
- "",
1320
- $mediaType ? indent(2, $mediaType) : void 0,
1321
- "",
1322
- " /* @anchor:query:start */",
1323
- $queryParameters ? indent(2, $queryParameters) : void 0,
1324
- " /* @anchor:query:end */",
1325
- "",
1326
- " /* @anchor:headers:start */",
1327
- $headerParameters ? indent(2, $headerParameters) : void 0,
1328
- " /* @anchor:headers:end */",
1329
- "",
1330
- " /* @anchor:path-parameters:start */",
1331
- $pathParameters ? indent(2, $pathParameters) : void 0,
1332
- " /* @anchor:path-parameters:end */",
1333
- "",
1334
- " /* @anchor:body:start */",
1335
- $requestBody ? indent(2, $requestBody) : void 0,
1336
- " /* @anchor:body:end */",
1337
- "",
1338
- " return req",
1339
- "}"
1340
- ].filter(R15.isNotNil).join("\n");
1341
- }
1342
- renderOperationDeclaration(operationDefinition) {
1343
- const { operationId } = operationDefinition;
1344
- const typeName = typeNameFactory(operationDefinition);
1345
- const mediaTypes = this.helper.getRequestMediaTypes();
1346
- if (mediaTypes.length === 0) {
1347
- return `${operationId}<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends never = never>(args?: ${typeName("RequestParameters")}): Keq<${typeName("Operation")}<STATUS, CONTENT_TYPE>>`;
1348
- } else if (mediaTypes.length === 1) {
1349
- 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>>`;
1350
- } else if (mediaTypes.length > 1) {
1351
- 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>>`;
1352
- }
1353
- throw new Exception(operationDefinition.module, "[operationDeclarationRenderer] Unreachable");
1354
- }
1355
- };
1356
-
1357
- // src/transformers/operation-definition/operation-definition.transformer.ts
1358
- var OperationDefinitionTransformer = class {
1359
- static toDeclaration(operationDefinition, options) {
1360
- return new DeclarationRenderer2(operationDefinition, options).render();
1361
- }
1362
- static toMicroFunction(operationDefinition, options) {
1363
- return new OperationDefinitionMicroFunctionRenderer(operationDefinition, options).render();
1364
- }
1365
- static toNestjsMethod(operationDefinition, options) {
1366
- return new OperationDefinitionNestjsMethodRenderer(operationDefinition, options).render();
1367
- }
1368
- static toComment(operationDefinition) {
1369
- return new CommentRenderer2(operationDefinition).render();
1370
- }
1371
- };
1372
-
1373
- // src/transformers/entrypoint/entrypoint.transformer.ts
1374
- import * as path4 from "path";
1375
- var EntrypointTransformer = class {
1376
- static toTypescript(exports, options) {
1377
- const $exports = exports.map((exportArtifact) => {
1378
- const relativePath = path4.relative(
1379
- options.dirpath,
1380
- exportArtifact.filepath
1381
- ).replace(/(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?$/, options.esm ? ".js" : "");
1382
- return relativePath.startsWith(".") ? `export * from '${relativePath}'` : `export * from './${relativePath}'`;
1383
- });
1384
- return [
1385
- "/* @anchor:file:start */",
1386
- "",
1387
- ...$exports,
1388
- "",
1389
- "/* @anchor:file:end */"
1390
- ].join("\n");
1391
- }
1392
- };
1393
-
1394
- // src/transformers/api-document/nestjs-client.renderer.ts
1395
- import * as R16 from "ramda";
1396
- import * as changeCase2 from "change-case";
1397
- var NestjsClientRenderer = class {
1398
- constructor(document, options) {
1399
- this.document = document;
1400
- this.options = options;
1401
- }
1402
- renderDependencies() {
1403
- const $operations = this.document.operations.map((operationDefinition) => {
1404
- const filepath = this.options.getOperationDefinitionDeclarationFilepath(operationDefinition);
1405
- const typeName = typeNameFactory(operationDefinition);
1406
- return `import type { ${typeName("Operation")}, ${typeName("ResponseBodies")}, ${typeName("RequestParameters")} } from "${filepath}"`;
1407
- }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? ' from "$1.js"' : ' from "$1"'));
1408
- return [
1409
- 'import { Injectable, Logger } from "@nestjs/common"',
1410
- 'import { Keq, KeqRequest } from "keq"',
1411
- ...$operations
1412
- ].join("\n");
1413
- }
1414
- render() {
1415
- const moduleName = changeCase2.pascalCase(this.document.module.name);
1416
- const $dependencies = this.renderDependencies();
1417
- const $operations = this.document.operations.map((operation) => OperationDefinitionTransformer.toNestjsMethod(operation, {
1418
- esm: this.options.esm
1419
- })).join("\n\n");
1420
- return [
1421
- "/* @anchor:file:start */",
1422
- "",
1423
- $dependencies,
1424
- "",
1425
- "@Injectable()",
1426
- `export class ${moduleName}Client {`,
1427
- ` private readonly logger = new Logger(${moduleName}Client.name)`,
1428
- "",
1429
- " constructor(",
1430
- " // @anchor:client-constructor-parameters:start",
1431
- " private readonly request: KeqRequest,",
1432
- " // @anchor:client-constructor-parameters:end",
1433
- " ) {}",
1434
- "",
1435
- indent(2, $operations),
1436
- "}",
1437
- "",
1438
- "/* @anchor:file:end */"
1439
- ].filter(R16.isNotNil).join("\n");
1440
- }
1441
- };
1442
-
1443
- // src/transformers/api-document/nestjs-module.renderer.ts
1444
- import * as changeCase3 from "change-case";
1445
- var NestjsModuleRenderer = class {
1446
- constructor(document, options) {
1447
- this.document = document;
1448
- this.options = options;
1449
- }
1450
- render() {
1451
- const moduleName = changeCase3.pascalCase(this.document.module.name);
1452
- const clientFilepath = this.options.getNestjsClientFilepath(this.document).replace(/(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?$/, this.options.esm ? ".js" : "");
1453
- return [
1454
- "/* @anchor:file:start */",
1455
- 'import { Module, Inject, ConfigurableModuleBuilder, Global } from "@nestjs/common"',
1456
- 'import { KeqRequest } from "keq"',
1457
- 'import { KeqModuleOptions } from "@keq-request/nestjs"',
1458
- `import { ${moduleName}Client } from "${clientFilepath}"`,
1459
- "",
1460
- "",
1461
- "const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE } = new ConfigurableModuleBuilder<KeqModuleOptions>().build()",
1462
- "",
1463
- "@Global()",
1464
- "@Module({",
1465
- " imports: [],",
1466
- " controllers: [],",
1467
- ` providers: [${moduleName}Client],`,
1468
- ` exports: [${moduleName}Client],`,
1469
- "})",
1470
- `export class ${moduleName}Module extends ConfigurableModuleClass {`,
1471
- "",
1472
- " constructor(",
1473
- " @Inject(MODULE_OPTIONS_TOKEN) private readonly options: KeqModuleOptions,",
1474
- " private readonly request: KeqRequest,",
1475
- " ) {",
1476
- " super()",
1477
- " }",
1478
- "",
1479
- " onModuleInit() {",
1480
- " if (this.options.middlewares) {",
1481
- " for (const middleware of this.options.middlewares) {",
1482
- " this.request.use(middleware)",
1483
- " }",
1484
- " }",
1485
- " }",
1486
- "}",
1487
- "",
1488
- "/* @anchor:file:end */"
1489
- ].join("\n");
1490
- }
1491
- };
1492
-
1493
- // src/transformers/api-document/api-document.transformer.ts
1494
- var ApiDocumentTransformer = class {
1495
- static toNestjsModule(document, options) {
1496
- return new NestjsModuleRenderer(document, options).render();
1497
- }
1498
- static toNestjsClient(document, options) {
1499
- return new NestjsClientRenderer(document, options).render();
1500
- }
1501
- };
1502
-
1503
- // src/plugins/generate-declaration/generators/schema-declaration/schema.generator.ts
1504
- import * as R17 from "ramda";
1505
- import * as path5 from "path";
1506
- import * as changeCase4 from "change-case";
1507
-
1508
- // src/plugins/generate-declaration/constants/metadata-storage.ts
1509
- var MetadataStorage2 = /* @__PURE__ */ new WeakMap();
1510
-
1511
- // src/plugins/generate-declaration/generators/schema-declaration/schema.generator.ts
1512
- var SCHEMA_GENERATOR = "schemaGenerator";
1513
- var SchemaDeclarationGenerator = class _SchemaDeclarationGenerator {
1514
- async compile(compiler, task) {
1515
- const context = compiler.context;
1516
- const metadata = MetadataStorage2.get(compiler);
1517
- const rc = context.rc;
1518
- const documents = context.documents;
1519
- const schemaDefinitions = documents.flatMap((document) => document.schemas);
1520
- const artifactMap = new Map(
1521
- await Promise.all(
1522
- schemaDefinitions.map(async (schemaDefinition) => [
1523
- schemaDefinition,
1524
- await metadata.hooks.afterSchemaDeclarationArtifactGenerated.promise(
1525
- this.generateSchemaDefinitionsArtifact(schemaDefinition, rc),
1526
- schemaDefinition,
1527
- task
1528
- )
1529
- ])
1530
- )
1531
- );
1532
- const entrypoints = R17.collectBy(
1533
- (schemaDefinition) => schemaDefinition.module.name,
1534
- schemaDefinitions
1535
- ).map((schemaDefinitions2) => [
1536
- schemaDefinitions2[0].module,
1537
- schemaDefinitions2.map((schemaDefinition) => artifactMap.get(schemaDefinition)).filter((artifact) => Boolean(artifact))
1538
- ]).map(([moduleDefinition, artifacts]) => this.generateEntrypointArtifact(
1539
- moduleDefinition,
1540
- artifacts,
1541
- rc
1542
- ));
1543
- return [...artifactMap.values(), ...entrypoints];
1544
- }
1545
- generateSchemaDefinitionsArtifact(schemaDefinition, rc) {
1546
- const filepath = _SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(schemaDefinition, rc.fileNamingStyle);
1547
- const dirpath = path5.dirname(filepath);
1548
- const artifact = new Artifact({
1549
- id: _SchemaDeclarationGenerator.getSchemaDefinitionArtifactId(schemaDefinition),
1550
- filepath,
1551
- content: SchemaDefinitionTransformer.toDeclaration(
1552
- schemaDefinition,
1553
- {
1554
- esm: rc.esm,
1555
- getDependentSchemaDefinitionFilepath(dependentSchemaDefinition) {
1556
- const relativePath = path5.relative(
1557
- dirpath,
1558
- _SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(dependentSchemaDefinition, rc.fileNamingStyle)
1559
- );
1560
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
1561
- }
1562
- }
1563
- ),
1564
- extensionName: ".schema.ts"
1565
- });
1566
- return artifact;
1567
- }
1568
- generateEntrypointArtifact(moduleDefinition, exports, rc) {
1569
- const filepath = _SchemaDeclarationGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.fileNamingStyle);
1570
- const dirpath = path5.dirname(filepath);
1571
- const artifact = new Artifact({
1572
- id: _SchemaDeclarationGenerator.getEntrypointArtifactId(moduleDefinition),
1573
- filepath,
1574
- content: EntrypointTransformer.toTypescript(exports, { dirpath })
1575
- });
1576
- return artifact;
1577
- }
1578
- static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
1579
- return [
1580
- ".",
1581
- changeCase4[fileNamingStyle](moduleDefinition.name),
1582
- "types",
1583
- "components",
1584
- "schemas",
1585
- "index.ts"
1586
- ].join("/");
1587
- }
1588
- static getEntrypointArtifactId(moduleDefinition) {
1589
- return `${moduleDefinition.address}/components/schemas/entrypoint?generator=${SCHEMA_GENERATOR}`;
1590
- }
1591
- static getSchemaDefinitionArtifactFilepath(schemaDefinition, fileNamingStyle) {
1592
- const filename = `${changeCase4[fileNamingStyle](schemaDefinition.name)}.schema.ts`;
1593
- return [
1594
- ".",
1595
- changeCase4[fileNamingStyle](schemaDefinition.module.name),
1596
- "types",
1597
- "components",
1598
- "schemas",
1599
- filename
1600
- ].join("/");
1601
- }
1602
- static getSchemaDefinitionArtifactId(schemaDefinition) {
1603
- return `${schemaDefinition.id}?generator=${SCHEMA_GENERATOR}`;
1604
- }
1605
- };
1606
-
1607
- // src/plugins/generate-declaration/generators/operation-declaration/operation.generator.ts
1608
- var OPERATION_GENERATOR = "operationDeclarationGenerator";
1609
- var OperationDeclarationGenerator = class _OperationDeclarationGenerator {
1610
- async compile(compiler, task) {
1611
- const context = compiler.context;
1612
- const metadata = MetadataStorage2.get(compiler);
1613
- const rc = context.rc;
1614
- const documents = context.documents;
1615
- const operationDefinitions = documents.flatMap((document) => document.operations);
1616
- const artifactMap = new Map(
1617
- await Promise.all(
1618
- operationDefinitions.map(async (operationDefinition) => [
1619
- operationDefinition,
1620
- await metadata.hooks.afterOperationDeclarationArtifactGenerated.promise(
1621
- this.generateOperationDefinitionArtifact(operationDefinition, rc),
1622
- operationDefinition,
1623
- task
1624
- )
1625
- ])
1626
- )
1627
- );
1628
- return Array.from(artifactMap.values());
1629
- }
1630
- generateOperationDefinitionArtifact(operationDefinition, rc) {
1631
- const filepath = _OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.fileNamingStyle);
1632
- const dirpath = path6.dirname(filepath);
1633
- const artifact = new Artifact({
1634
- id: _OperationDeclarationGenerator.getOperationDefinitionArtifactId(operationDefinition),
1635
- filepath,
1636
- content: OperationDefinitionTransformer.toDeclaration(
1637
- operationDefinition,
1638
- {
1639
- esm: rc.esm,
1640
- getDependentSchemaDefinitionFilepath(dependentSchemaDefinition) {
1641
- const relativePath = path6.relative(
1642
- dirpath,
1643
- SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(dependentSchemaDefinition, rc.fileNamingStyle)
1644
- );
1645
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
1646
- }
1647
- }
1648
- ),
1649
- extensionName: ".type.ts"
1650
- });
1651
- return artifact;
1652
- }
1653
- generateEntrypointArtifact(moduleDefinition, exports, rc) {
1654
- const filepath = _OperationDeclarationGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.fileNamingStyle);
1655
- const dirpath = path6.dirname(filepath);
1656
- const artifact = new Artifact({
1657
- id: _OperationDeclarationGenerator.getEntrypointArtifactId(moduleDefinition),
1658
- filepath,
1659
- content: EntrypointTransformer.toTypescript(exports, { dirpath })
1660
- });
1661
- return artifact;
1662
- }
1663
- static getOperationDefinitionArtifactFilepath(operationDefinition, fileNamingStyle) {
1664
- const filename = `${changeCase5[fileNamingStyle](operationDefinition.operationId)}.type.ts`;
1665
- const filepath = [
1666
- ".",
1667
- changeCase5[fileNamingStyle](operationDefinition.module.name),
1668
- "types",
1669
- "operations",
1670
- filename
1671
- ].join("/");
1672
- return filepath;
1673
- }
1674
- static getOperationDefinitionArtifactId(operationDefinition) {
1675
- return `${operationDefinition.id}?generator=${OPERATION_GENERATOR}`;
1676
- }
1677
- static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
1678
- return [
1679
- ".",
1680
- changeCase5[fileNamingStyle](moduleDefinition.name),
1681
- "types",
1682
- "operations",
1683
- "index.ts"
1684
- ].join("/");
1685
- }
1686
- static getEntrypointArtifactId(moduleDefinition) {
1687
- return `${moduleDefinition.address}/paths/entrypoint?generator=${OPERATION_GENERATOR}`;
1688
- }
1689
- };
1690
-
1691
- // src/plugins/generate-declaration/generate-declaration.plugin.ts
1692
- var DECLARATION_GENERATOR = "declarationGenerator";
1693
- var GenerateDeclarationPlugin = class _GenerateDeclarationPlugin {
1694
- name = DECLARATION_GENERATOR;
1695
- operationGenerator = new OperationDeclarationGenerator();
1696
- schemaGenerator = new SchemaDeclarationGenerator();
1697
- constructor() {
1698
- }
1699
- apply(compiler) {
1700
- _GenerateDeclarationPlugin.register(compiler);
1701
- compiler.hooks.compile.tapPromise(_GenerateDeclarationPlugin.name, async (task) => {
1702
- compiler.context.artifacts?.push(
1703
- ...await this.schemaGenerator.compile(compiler, task),
1704
- ...await this.operationGenerator.compile(compiler, task)
1705
- );
1706
- });
1707
- }
1708
- static register(compiler) {
1709
- if (!MetadataStorage2.has(compiler)) {
1710
- MetadataStorage2.set(compiler, {
1711
- hooks: {
1712
- afterEntrypointArtifactGenerated: new AsyncSeriesWaterfallHook(["artifact", "task"]),
1713
- afterSchemaDeclarationArtifactGenerated: new AsyncSeriesWaterfallHook(["artifact", "schemaDefinition", "task"]),
1714
- afterOperationDeclarationArtifactGenerated: new AsyncSeriesWaterfallHook(["artifact", "operationDefinition", "task"])
1715
- }
1716
- });
1717
- }
1718
- return MetadataStorage2.get(compiler);
1719
- }
1720
- static of(compiler) {
1721
- return this.register(compiler);
1722
- }
1723
- };
1724
-
1725
- // src/plugins/generate-micro-function/generators/request/request.generator.ts
1726
- var MICRO_FUNCTION_REQUEST_GENERATOR = "microFunctionRequestGenerator";
1727
- var RequestGenerator = class _RequestGenerator {
1728
- generateRequestArtifact() {
1729
- const content = [
1730
- "/* @anchor:file:start */",
1731
- "",
1732
- 'import { KeqRequest } from "keq"',
1733
- "",
1734
- "/* @anchor:request-declaration */",
1735
- "export const request = new KeqRequest()",
1736
- "",
1737
- "/* @anchor:file:end */"
1738
- ].join("\n");
1739
- return new Artifact({
1740
- id: _RequestGenerator.getRequestArtifactId(),
1741
- filepath: _RequestGenerator.getRequestArtifactFilepath(),
1742
- content
1743
- });
1744
- }
1745
- // eslint-disable-next-line @typescript-eslint/require-await
1746
- async compile(compiler, task) {
1747
- return [
1748
- this.generateRequestArtifact()
1749
- ];
1750
- }
1751
- static getRequestArtifactFilepath() {
1752
- return "./request.ts";
1753
- }
1754
- static getRequestArtifactId() {
1755
- return `request?generator=${MICRO_FUNCTION_REQUEST_GENERATOR}`;
1756
- }
1757
- };
1758
-
1759
- // src/plugins/generate-micro-function/generators/micro_function/micro-function.generator.ts
1760
- var MICRO_FUNCTION_GENERATOR = "microFunctionGenerator";
1761
- var MicroFunctionGenerator = class _MicroFunctionGenerator {
1762
- async compile(compiler, task) {
1763
- const metadata = MetadataStorage.get(compiler);
1764
- const context = compiler.context;
1765
- const rc = context.rc;
1766
- const documents = context.documents;
1767
- const operationDefinitions = documents.flatMap((document) => document.operations);
1768
- const artifactMap = new Map(
1769
- await Promise.all(
1770
- operationDefinitions.map(async (operationDefinition) => [
1771
- operationDefinition,
1772
- await metadata.hooks.afterMicroFunctionArtifactGenerated.promise(
1773
- this.generateOperationDefinitionArtifact(operationDefinition, rc),
1774
- operationDefinition,
1775
- task
1776
- )
1777
- ])
1778
- )
1779
- );
1780
- const entrypoints = await Promise.all(
1781
- R18.collectBy(
1782
- (operationDefinition) => operationDefinition.module.name,
1783
- operationDefinitions
1784
- ).map((operationDefinitions2) => [
1785
- operationDefinitions2[0].module,
1786
- operationDefinitions2.map((operationDefinition) => artifactMap.get(operationDefinition)).filter((artifact) => Boolean(artifact))
1787
- ]).map(async ([moduleDefinition, artifacts]) => await metadata.hooks.afterEntrypointArtifactGenerated.promise(
1788
- this.generateEntrypointArtifact(
1789
- moduleDefinition,
1790
- artifacts,
1791
- rc
1792
- ),
1793
- task
1794
- ))
1795
- );
1796
- return [...entrypoints, ...artifactMap.values()];
1797
- }
1798
- generateOperationDefinitionArtifact(operationDefinition, rc) {
1799
- const filepath = _MicroFunctionGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.fileNamingStyle);
1800
- const dirpath = path7.dirname(filepath);
1801
- const artifact = new Artifact({
1802
- id: _MicroFunctionGenerator.getOperationDefinitionArtifactId(operationDefinition),
1803
- filepath,
1804
- content: OperationDefinitionTransformer.toMicroFunction(operationDefinition, {
1805
- esm: rc.esm,
1806
- getOperationDefinitionDeclarationFilepath(operationDefinition2) {
1807
- const relativePath = path7.relative(
1808
- dirpath,
1809
- OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition2, rc.fileNamingStyle)
1810
- );
1811
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
1812
- },
1813
- getRequestFilepath() {
1814
- const relativePath = path7.relative(
1815
- dirpath,
1816
- RequestGenerator.getRequestArtifactFilepath()
1817
- );
1818
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
1819
- }
1820
- }),
1821
- extensionName: ".type.ts"
1822
- });
1823
- return artifact;
1824
- }
1825
- generateEntrypointArtifact(moduleDefinition, exports, rc) {
1826
- const filepath = _MicroFunctionGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.fileNamingStyle);
1827
- const dirpath = filepath.substring(0, filepath.lastIndexOf("/"));
1828
- const artifact = new Artifact({
1829
- id: _MicroFunctionGenerator.getEntrypointArtifactId(moduleDefinition),
1830
- filepath,
1831
- content: EntrypointTransformer.toTypescript(exports, { dirpath })
1832
- });
1833
- return artifact;
1834
- }
1835
- static getOperationDefinitionArtifactFilepath(operationDefinition, fileNamingStyle) {
1836
- const filename = `${changeCase6[fileNamingStyle](operationDefinition.operationId)}.fn.ts`;
1837
- const filepath = [
1838
- ".",
1839
- changeCase6[fileNamingStyle](operationDefinition.module.name),
1840
- "operations",
1841
- filename
1842
- ].join("/");
1843
- return filepath;
1844
- }
1845
- static getOperationDefinitionArtifactId(operationDefinition) {
1846
- return `${operationDefinition.id}?generator=${MICRO_FUNCTION_GENERATOR}`;
1847
- }
1848
- static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
1849
- return [
1850
- ".",
1851
- changeCase6[fileNamingStyle](moduleDefinition.name),
1852
- "operations",
1853
- "index.ts"
1854
- ].join("/");
1855
- }
1856
- static getEntrypointArtifactId(moduleDefinition) {
1857
- return `${moduleDefinition.address}/paths/entrypoint?generator=${MICRO_FUNCTION_GENERATOR}`;
1858
- }
1859
- };
1860
-
1861
- // src/plugins/generate-micro-function/generate-micro-function.plugin.ts
1862
- var GenerateMicroFunctionPlugin = class _GenerateMicroFunctionPlugin {
1863
- microFunctionGenerator = new MicroFunctionGenerator();
1864
- requestGenerator = new RequestGenerator();
1865
- apply(compiler) {
1866
- _GenerateMicroFunctionPlugin.register(compiler);
1867
- compiler.hooks.compile.tapPromise(_GenerateMicroFunctionPlugin.name, async (task) => {
1868
- const artifacts = [
1869
- ...await this.requestGenerator.compile(compiler, task),
1870
- ...await this.microFunctionGenerator.compile(compiler, task)
1871
- ];
1872
- compiler.context.artifacts.push(...artifacts);
1873
- });
1874
- }
1875
- static register(compiler) {
1876
- if (!MetadataStorage.has(compiler)) {
1877
- MetadataStorage.set(compiler, {
1878
- hooks: {
1879
- afterEntrypointArtifactGenerated: new AsyncSeriesWaterfallHook2(["artifact", "task"]),
1880
- afterMicroFunctionArtifactGenerated: new AsyncSeriesWaterfallHook2(["artifact", "operationDefinition", "task"])
1881
- }
1882
- });
1883
- }
1884
- return MetadataStorage.get(compiler);
1885
- }
1886
- static of(compiler) {
1887
- return this.register(compiler);
1888
- }
1889
- };
1890
-
1891
- // src/plugins/body-fallback/index.ts
1892
- var BodyFallbackPlugin = class _BodyFallbackPlugin {
1893
- apply(compiler) {
1894
- compiler.hooks.setup.tap(_BodyFallbackPlugin.name, () => {
1895
- const generateMicroFunctionPluginMetadata = GenerateMicroFunctionPlugin.of(compiler);
1896
- if (!generateMicroFunctionPluginMetadata) {
1897
- throw new Error("BodyFallbackPlugin requires GenerateMicroFunctionPlugin to be applied first.");
1898
- }
1899
- generateMicroFunctionPluginMetadata.hooks.afterMicroFunctionArtifactGenerated.tap(_BodyFallbackPlugin.name, (artifact, operationDefinition) => {
1900
- const operation = operationDefinition.operation;
1901
- const parameters = operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p)) || [];
1902
- const keys2 = parameters.map((p) => p.name).filter(R19.isNotNil);
1903
- const $acc = !keys2.length ? " acc[key] = args[key]" : [
1904
- ` if (![${keys2.map((k) => JSON.stringify(k)).join(", ")}].includes(key)) {`,
1905
- " acc[key] = args[key]",
1906
- " }"
1907
- ].join("\n");
1908
- artifact.anchor.block.replace("body", [
1909
- // $mediaType ? `${$mediaType}\n` : undefined,
1910
- ' if (typeof args === "object" && args !== null && !Array.isArray(args)) {',
1911
- " const requestBody = Object.keys(args)",
1912
- " .reduce((acc, key) => {",
1913
- $acc,
1914
- " return acc",
1915
- " }, {} as Record<string, unknown>)",
1916
- "",
1917
- " if (Object.keys(requestBody).length > 0) {",
1918
- " req.send(requestBody)",
1919
- " }",
1920
- " }"
1921
- ].filter(R19.isNotNil).join("\n"));
1922
- return artifact;
1923
- });
1924
- });
1925
- }
1926
- };
1927
-
1928
- // src/plugins/generate-nestjs-module/generate-nestjs-module.ts
1929
- import { AsyncSeriesWaterfallHook as AsyncSeriesWaterfallHook3 } from "tapable";
1930
-
1931
- // src/plugins/generate-nestjs-module/constants/metadata-storage.ts
1932
- var MetadataStorage3 = /* @__PURE__ */ new WeakMap();
1933
-
1934
- // src/plugins/generate-nestjs-module/generators/nestjs-module.generator.ts
1935
- import * as path8 from "path";
1936
- import * as changeCase7 from "change-case";
1937
- var NESTJS_MODULE_GENERATOR = "nestjs-module-generator";
1938
- var NestjsModuleGenerator = class _NestjsModuleGenerator {
1939
- generateNestjsModuleArtifact(document, rc) {
1940
- const filepath = _NestjsModuleGenerator.getNestjsModuleArtifactFilepath(document, rc.fileNamingStyle);
1941
- const dirname6 = path8.dirname(filepath);
1942
- const artifact = new Artifact({
1943
- id: _NestjsModuleGenerator.getNestjsModuleArtifactId(document),
1944
- filepath,
1945
- content: ApiDocumentTransformer.toNestjsModule(document, {
1946
- esm: rc.esm,
1947
- getNestjsClientFilepath(document2) {
1948
- const relativePath = path8.relative(
1949
- dirname6,
1950
- _NestjsModuleGenerator.getNestjsClientArtifactFilepath(document2, rc.fileNamingStyle)
1951
- );
1952
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
1953
- }
1954
- })
1955
- });
1956
- return artifact;
1957
- }
1958
- generateNestjsClientArtifact(document, rc) {
1959
- const filepath = _NestjsModuleGenerator.getNestjsClientArtifactFilepath(document, rc.fileNamingStyle);
1960
- const dirpath = path8.dirname(filepath);
1961
- const artifact = new Artifact({
1962
- id: _NestjsModuleGenerator.getNestjsClientArtifactId(document),
1963
- filepath,
1964
- content: ApiDocumentTransformer.toNestjsClient(document, {
1965
- esm: rc.esm,
1966
- getOperationDefinitionDeclarationFilepath(operationDefinition) {
1967
- const relativePath = path8.relative(
1968
- dirpath,
1969
- OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.fileNamingStyle)
1970
- );
1971
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
1972
- }
1973
- })
1974
- });
1975
- return artifact;
1976
- }
1977
- async compile(compiler, task) {
1978
- const metadata = MetadataStorage3.get(compiler);
1979
- const rc = compiler.context.rc;
1980
- const documents = compiler.context.documents;
1981
- const nestjsModuleArtifacts = await Promise.all(
1982
- documents.map((document) => metadata.hooks.afterNestjsModuleArtifactGenerated.promise(
1983
- this.generateNestjsModuleArtifact(document, rc),
1984
- document,
1985
- task
1986
- ))
1987
- );
1988
- const nestjsClientArtifacts = await Promise.all(
1989
- documents.map((document) => metadata.hooks.afterNestjsModuleArtifactGenerated.promise(
1990
- this.generateNestjsClientArtifact(document, rc),
1991
- document,
1992
- task
1993
- ))
1994
- );
1995
- return [...nestjsModuleArtifacts, ...nestjsClientArtifacts];
1996
- }
1997
- static getNestjsModuleArtifactFilepath(document, fileNamingStyle) {
1998
- const filename = `${changeCase7[fileNamingStyle](document.module.name)}.module.ts`;
1999
- const filepath = [
2000
- ".",
2001
- changeCase7[fileNamingStyle](document.module.name),
2002
- filename
2003
- ];
2004
- return filepath.join("/");
2005
- }
2006
- static getNestjsModuleArtifactId(document) {
2007
- return `${document.module.address}?generate=${NESTJS_MODULE_GENERATOR}`;
2008
- }
2009
- static getNestjsClientArtifactFilepath(document, fileNamingStyle) {
2010
- const filename = `${changeCase7[fileNamingStyle](document.module.name)}.client.ts`;
2011
- const filepath = [
2012
- ".",
2013
- changeCase7[fileNamingStyle](document.module.name),
2014
- filename
2015
- ];
2016
- return filepath.join("/");
2017
- }
2018
- static getNestjsClientArtifactId(document) {
2019
- return `${document.module.address}?generate=${NESTJS_MODULE_GENERATOR}-client`;
2020
- }
2021
- };
2022
-
2023
- // src/plugins/generate-nestjs-module/generate-nestjs-module.ts
2024
- var GenerateNestjsModulePlugin = class _GenerateNestjsModulePlugin {
2025
- nestjsModuleGenerator = new NestjsModuleGenerator();
2026
- apply(compiler) {
2027
- _GenerateNestjsModulePlugin.register(compiler);
2028
- compiler.hooks.compile.tapPromise(_GenerateNestjsModulePlugin.name, async (task) => {
2029
- const artifacts = await this.nestjsModuleGenerator.compile(compiler, task);
2030
- compiler.context.artifacts.push(...artifacts);
2031
- });
2032
- }
2033
- static register(compiler) {
2034
- if (!MetadataStorage3.has(compiler)) {
2035
- MetadataStorage3.set(compiler, {
2036
- hooks: {
2037
- afterNestjsModuleArtifactGenerated: new AsyncSeriesWaterfallHook3(["artifact", "document", "task"])
2038
- }
2039
- });
2040
- }
2041
- return MetadataStorage3.get(compiler);
2042
- }
2043
- static of(compiler) {
2044
- return MetadataStorage3.get(compiler);
2045
- }
2046
- };
2047
-
2048
- // src/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.ts
2049
- import { fixSwagger } from "swagger-fix";
2050
- var ChineseToPinyinPlugin = class _ChineseToPinyinPlugin {
2051
- apply(compiler) {
2052
- compiler.hooks.afterDownload.tap(_ChineseToPinyinPlugin.name, (task) => {
2053
- const documents = compiler.context.documents;
2054
- compiler.context.documents = documents.map((doc) => {
2055
- return new ApiDocumentV3_1(
2056
- fixSwagger(doc.specification),
2057
- doc.module
2058
- );
2059
- });
2060
- });
2061
- }
2062
- };
2063
-
2064
- // src/plugins/download-http-file/download-http-file.plugin.ts
2065
- import * as validUrl from "valid-url";
2066
- var DownloadHttpFilePlugin = class _DownloadHttpFilePlugin {
2067
- apply(compiler) {
2068
- compiler.hooks.download.tapPromise(_DownloadHttpFilePlugin.name, async (address, task) => {
2069
- if (!validUrl.isUri(address)) return void 0;
2070
- const content = await this.download(address);
2071
- const spec = this.deserialize(content);
2072
- return JSON.stringify(spec);
2073
- });
2074
- }
2075
- async download(address) {
2076
- try {
2077
- const res = await fetch(address);
2078
- if (res.status >= 400) throw new Error(`failed with status code ${res.status}`);
2079
- return await res.text();
2080
- } catch (e) {
2081
- if (e instanceof Error) {
2082
- e.message = `Unable get the openapi/swagger file from ${address}: ${e.message}`;
2083
- }
2084
- throw e;
2085
- }
2086
- }
2087
- deserialize(content) {
2088
- const json = JSON.parse(content);
2089
- const spec = OpenapiUtils.to3_1(json);
2090
- return spec;
2091
- }
2092
- };
2093
-
2094
- // src/plugins/download-local-file/download-local-file.plugin.ts
2095
- import * as path9 from "path";
2096
- import * as fs from "fs/promises";
2097
- import * as yaml from "js-yaml";
2098
- var DownloadLocalFilePlugin = class _DownloadLocalFilePlugin {
2099
- apply(compiler) {
2100
- compiler.hooks.download.tapPromise(_DownloadLocalFilePlugin.name, async (address, task) => {
2101
- if (!address.startsWith("./") && !address.startsWith("/") && !address.startsWith("../")) return void 0;
2102
- const fileExt = path9.extname(address);
2103
- const content = await fs.readFile(address, "utf8");
2104
- if ([".yml", ".yaml"].includes(fileExt)) {
2105
- const value = yaml.load(content);
2106
- return JSON.stringify(OpenapiUtils.to3_1(value));
2107
- } else if (fileExt === ".json") {
2108
- return JSON.stringify(OpenapiUtils.to3_1(JSON.parse(content)));
2109
- }
2110
- });
2111
- }
2112
- };
2113
-
2114
- // src/plugins/shaking/shaking.plugin.ts
2115
- import { openapiShakingSync } from "@opendoc/openapi-shaking";
2116
- var ShakingPlugin = class _ShakingPlugin {
2117
- apply(compiler) {
2118
- compiler.hooks.beforeCompile.tap(_ShakingPlugin.name, (task) => {
2119
- const matcher = compiler.context.matcher;
2120
- const documents = compiler.context.documents;
2121
- compiler.context.documents = documents.map((document) => this.shaking(compiler, document)).filter((document) => !document.isEmpty()).filter((document) => !matcher.isModuleIgnored(document.module));
2122
- });
2123
- }
2124
- shaking(compiler, document) {
2125
- const rc = compiler.context.rc;
2126
- const matcher = compiler.context.matcher;
2127
- const isAccepted = (pathname, method, operation) => {
2128
- if (!SupportedMethods.includes(method)) return false;
2129
- return !matcher.isOperationIgnored(new OperationDefinition({
2130
- method,
2131
- pathname,
2132
- operation,
2133
- module: document.module,
2134
- document
2135
- }));
2136
- };
2137
- const sharkedSwagger = openapiShakingSync(
2138
- document.specification,
2139
- isAccepted,
2140
- { tolerant: rc.tolerant }
2141
- );
2142
- return new ApiDocumentV3_1(
2143
- sharkedSwagger,
2144
- new ModuleDefinition(
2145
- document.module.name,
2146
- `file://${document.module.name}.v3_1.sharked.json`
2147
- )
2148
- );
2149
- }
2150
- };
2151
-
2152
- // src/plugins/terminal-select/utils/select-operation-definitions.ts
2153
- import { select } from "inquirer-select-pro";
2154
- import { ListrInquirerPromptAdapter } from "@listr2/prompt-adapter-inquirer";
2155
- async function selectOperationDefinitions(task, operationDefinitions) {
2156
- const selectedOperationDefinitions = await task.prompt(ListrInquirerPromptAdapter).run(
2157
- select,
2158
- {
2159
- message: "Select Pathname",
2160
- defaultValue: [],
2161
- options: (input) => {
2162
- const items = operationDefinitions.map((op) => ({ name: `${op.module.name} ${op.method.toUpperCase()} ${op.pathname}`, value: op }));
2163
- if (!input) return items;
2164
- const keys2 = input.trim().toLowerCase().split(/\s+/);
2165
- return items.filter((i) => {
2166
- const name = i.name.toLowerCase();
2167
- return keys2.every((q) => name.includes(q));
2168
- });
2169
- }
2170
- }
2171
- );
2172
- return selectedOperationDefinitions;
2173
- }
2174
-
2175
- // src/plugins/terminal-select/terminal-select.plugin.ts
2176
- var TerminalSelectPlugin = class _TerminalSelectPlugin {
2177
- constructor(options) {
2178
- this.options = options;
2179
- }
2180
- apply(compiler) {
2181
- compiler.hooks.afterDownload.tapPromise(_TerminalSelectPlugin.name, async (task) => {
2182
- const context = compiler.context;
2183
- const matcher = context.matcher;
2184
- const documents = context.documents;
2185
- const operationDefinitions = documents.flatMap((document) => document.operations);
2186
- const selectedOperationDefinitions = await selectOperationDefinitions(task, operationDefinitions);
2187
- if (this.options.clear) {
2188
- matcher.append({
2189
- persist: false,
2190
- ignore: true,
2191
- moduleName: "*",
2192
- operationMethod: "*",
2193
- operationPathname: "*"
2194
- });
2195
- }
2196
- for (const op of selectedOperationDefinitions) {
2197
- matcher.append({
2198
- persist: !!this.options.persist,
2199
- ignore: this.options.mode === "add",
2200
- moduleName: op.module.name,
2201
- operationMethod: op.method,
2202
- operationPathname: op.pathname
2203
- });
2204
- }
2205
- });
2206
- }
2207
- };
2208
-
2209
- // src/plugins/initialize/initialize.plugin.ts
2210
- import * as R20 from "ramda";
2211
- var InitializePlugin = class _InitializePlugin {
2212
- constructor(options) {
2213
- this.options = options;
2214
- }
2215
- apply(compiler) {
2216
- compiler.hooks.setup.tap(_InitializePlugin.name, (task) => {
2217
- new DownloadHttpFilePlugin().apply(compiler);
2218
- new DownloadLocalFilePlugin().apply(compiler);
2219
- new GenerateDeclarationPlugin().apply(compiler);
2220
- if (this.options.build) {
2221
- new ShakingPlugin().apply(compiler);
2222
- }
2223
- if (this.options.interactive) {
2224
- new TerminalSelectPlugin(
2225
- typeof this.options.interactive === "object" ? this.options.interactive : { mode: "except" }
2226
- ).apply(compiler);
2227
- }
2228
- const rc = compiler.context.rc;
2229
- if (rc.mode === "micro-function") {
2230
- new GenerateMicroFunctionPlugin().apply(compiler);
2231
- } else if (rc.mode === "nestjs-module") {
2232
- new GenerateNestjsModulePlugin().apply(compiler);
2233
- }
2234
- if (rc.plugins && rc.plugins.length) {
2235
- for (const plugin of rc.plugins) {
2236
- plugin.apply(compiler);
2237
- }
2238
- }
2239
- });
2240
- if (this.options.includes && this.options.includes.length) {
2241
- const modulesIncludes = this.options.includes;
2242
- compiler.hooks.afterSetup.tap(_InitializePlugin.name, (task) => {
2243
- const rc = compiler.context.rc;
2244
- const matcher = compiler.context.matcher;
2245
- const notExistModules = modulesIncludes.filter((moduleName) => !(moduleName in rc.modules));
2246
- if (notExistModules.length) {
2247
- throw new Error(`Cannot find module(s) ${notExistModules.join(", ")} in config file.`);
2248
- }
2249
- const ignoredModules = R20.difference(R20.keys(rc.modules), modulesIncludes);
2250
- for (const moduleName of ignoredModules) {
2251
- matcher.append({
2252
- persist: false,
2253
- ignore: true,
2254
- moduleName,
2255
- operationMethod: "*",
2256
- operationPathname: "*"
2257
- });
2258
- }
2259
- });
2260
- }
2261
- }
2262
- };
2263
-
2264
- // src/plugins/overwrite-operation-id/overwrite-operation-id.plugin.ts
2265
- var OverwriteOperationIdPlugin = class _OverwriteOperationIdPlugin {
2266
- constructor(factory) {
2267
- this.factory = factory;
2268
- }
2269
- apply(compiler) {
2270
- compiler.hooks.afterDownload.tap(_OverwriteOperationIdPlugin.name, () => {
2271
- const documents = compiler.context.documents;
2272
- const factory = this.factory;
2273
- compiler.context.documents = documents.map((document) => {
2274
- const spec = OpenapiUtils.mapOperation(
2275
- document.specification,
2276
- (method, pathname, operation) => {
2277
- const operationId = factory({ method, pathname, operation, module: document.module });
2278
- if (typeof operationId === "string") {
2279
- if (operationId.length === 0) {
2280
- throw new Exception(document.module, `The generated operationId for [${method.toUpperCase()} ${pathname}] is an empty string.`);
2281
- }
2282
- operation.operationId = operationId;
2283
- return operation;
2284
- }
2285
- return operation;
2286
- }
2287
- );
2288
- return new ApiDocumentV3_1(spec, document.module);
2289
- });
2290
- });
2291
- }
2292
- };
2293
-
2294
- // src/plugins/overwrite-query-options/overwrite-query-options.plugin.ts
2295
- var QsArrayFormatUnion = Object.values(QsArrayFormat);
2296
- var OverwriteQueryOptionsPlugin = class _OverwriteQueryOptionsPlugin {
2297
- constructor(factory) {
2298
- this.factory = factory;
2299
- }
2300
- apply(compiler) {
2301
- compiler.hooks.afterDownload.tap(_OverwriteQueryOptionsPlugin.name, (task) => {
2302
- const documents = compiler.context.documents;
2303
- const factory = this.factory;
2304
- compiler.context.documents = documents.map((document) => {
2305
- const specification = OpenapiUtils.mapParameter(
2306
- document.specification,
2307
- (method, pathname, operation, parameter) => {
2308
- const qsOptions = typeof factory === "function" ? factory({ parameter, operation, pathname, method, module: document.module }) : factory;
2309
- if (!qsOptions) return parameter;
2310
- if (qsOptions.arrayFormat) {
2311
- if (!QsArrayFormatUnion.includes(qsOptions.arrayFormat)) {
2312
- throw new Exception(document.module, `The 'arrayFormat' value '${qsOptions.arrayFormat}' for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] is invalid.`);
2313
- }
2314
- parameter["x-qs-array-format"] = qsOptions.arrayFormat;
2315
- }
2316
- if (qsOptions.allowDots !== void 0) {
2317
- if (typeof qsOptions.allowDots !== "boolean") {
2318
- throw new Exception(document.module, `The 'allowDots' value for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] must be a boolean.`);
2319
- }
2320
- parameter["x-qs-allow-dots"] = Boolean(qsOptions.allowDots);
2321
- }
2322
- if (qsOptions.indices !== void 0) {
2323
- if (typeof qsOptions.indices !== "boolean") {
2324
- throw new Exception(document.module, `The 'indices' value for the query parameter '${parameter.name}' in [${method.toUpperCase()} ${pathname}] must be a boolean.`);
2325
- }
2326
- parameter["x-qs-indices"] = Boolean(qsOptions.indices);
2327
- }
2328
- return parameter;
2329
- }
2330
- );
2331
- return new ApiDocumentV3_1(
2332
- specification,
2333
- document.module
2334
- );
2335
- });
2336
- });
2337
- }
2338
- };
2339
- export {
2340
- BodyFallbackPlugin,
2341
- ChineseToPinyinPlugin,
2342
- DECLARATION_GENERATOR,
2343
- DownloadHttpFilePlugin,
2344
- DownloadLocalFilePlugin,
2345
- EslintPlugin,
2346
- GenerateDeclarationPlugin,
2347
- GenerateMicroFunctionPlugin,
2348
- GenerateNestjsModulePlugin,
2349
- InitializePlugin,
2350
- MICRO_FUNCTION_GENERATOR,
2351
- MICRO_FUNCTION_REQUEST_GENERATOR,
2352
- MicroFunctionGenerator,
2353
- NestjsModuleGenerator,
2354
- OPERATION_GENERATOR,
2355
- OperationDeclarationGenerator,
2356
- OverwriteOperationIdPlugin,
2357
- OverwriteQueryOptionsPlugin,
2358
- PrettierPlugin,
2359
- RequestGenerator,
2360
- SCHEMA_GENERATOR,
2361
- SchemaDeclarationGenerator,
2362
- ShakingPlugin,
2363
- TerminalSelectPlugin
2364
- };
2365
- //# sourceMappingURL=plugins.js.map