keq 2.8.14 → 2.10.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 (810) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/esm/src/constant.d.ts +2 -0
  3. package/dist/esm/src/constant.js +2 -0
  4. package/dist/esm/src/core.d.ts +30 -0
  5. package/dist/esm/src/core.js +162 -53
  6. package/dist/esm/src/create-request.js +2 -0
  7. package/dist/esm/src/exception/abort.exception.d.ts +3 -0
  8. package/dist/esm/src/exception/abort.exception.js +6 -0
  9. package/dist/esm/src/index.d.ts +1 -0
  10. package/dist/esm/src/index.js +1 -0
  11. package/dist/esm/src/is/is-abort-signal.d.ts +1 -0
  12. package/dist/esm/src/is/is-abort-signal.js +8 -0
  13. package/dist/esm/src/middlewares/fetch-arguments-middleware.js +5 -1
  14. package/dist/esm/src/middlewares/mutex-flow-control-middleware.d.ts +2 -0
  15. package/dist/esm/src/middlewares/mutex-flow-control-middleware.js +22 -0
  16. package/dist/esm/src/middlewares/retry-middleware.js +20 -3
  17. package/dist/esm/src/middlewares/timeout-middleware.js +3 -1
  18. package/dist/esm/src/types/keq-context.d.ts +10 -1
  19. package/dist/esm/src/types/keq-context.js +1 -1
  20. package/dist/esm/src/types/keq-flow-control.d.ts +1 -1
  21. package/dist/esm/src/types/keq-global.d.ts +1 -0
  22. package/dist/umd/src/constant.d.ts +2 -0
  23. package/dist/umd/src/constant.js +3 -1
  24. package/dist/umd/src/core.d.ts +30 -0
  25. package/dist/umd/src/core.js +162 -53
  26. package/dist/umd/src/create-request.js +3 -1
  27. package/dist/umd/src/exception/abort.exception.d.ts +3 -0
  28. package/dist/umd/src/exception/abort.exception.js +20 -0
  29. package/dist/umd/src/index.d.ts +1 -0
  30. package/dist/umd/src/index.js +4 -2
  31. package/dist/umd/src/is/is-abort-signal.d.ts +1 -0
  32. package/dist/umd/src/is/is-abort-signal.js +22 -0
  33. package/dist/umd/src/middlewares/fetch-arguments-middleware.js +4 -0
  34. package/dist/umd/src/middlewares/mutex-flow-control-middleware.d.ts +2 -0
  35. package/dist/umd/src/middlewares/mutex-flow-control-middleware.js +36 -0
  36. package/dist/umd/src/middlewares/retry-middleware.js +21 -4
  37. package/dist/umd/src/middlewares/timeout-middleware.js +4 -2
  38. package/dist/umd/src/types/keq-context.d.ts +10 -1
  39. package/dist/umd/src/types/keq-flow-control.d.ts +1 -1
  40. package/dist/umd/src/types/keq-global.d.ts +1 -0
  41. package/package.json +10 -13
  42. package/packages/cache/.turbo/turbo-build.log +0 -14
  43. package/packages/cache/dist/cache-entry/cache-entry.d.ts +0 -17
  44. package/packages/cache/dist/cache-entry/cache-entry.d.ts.map +0 -1
  45. package/packages/cache/dist/cache-entry/index.d.ts +0 -4
  46. package/packages/cache/dist/cache-entry/index.d.ts.map +0 -1
  47. package/packages/cache/dist/cache-entry/types/cache-entry-build-options.d.ts +0 -8
  48. package/packages/cache/dist/cache-entry/types/cache-entry-build-options.d.ts.map +0 -1
  49. package/packages/cache/dist/cache-entry/types/cache-entry-options.d.ts +0 -7
  50. package/packages/cache/dist/cache-entry/types/cache-entry-options.d.ts.map +0 -1
  51. package/packages/cache/dist/cache.d.ts +0 -44
  52. package/packages/cache/dist/cache.d.ts.map +0 -1
  53. package/packages/cache/dist/constants/eviction.enum.d.ts +0 -7
  54. package/packages/cache/dist/constants/eviction.enum.d.ts.map +0 -1
  55. package/packages/cache/dist/constants/index.d.ts +0 -5
  56. package/packages/cache/dist/constants/index.d.ts.map +0 -1
  57. package/packages/cache/dist/constants/max-expired-at.d.ts +0 -2
  58. package/packages/cache/dist/constants/max-expired-at.d.ts.map +0 -1
  59. package/packages/cache/dist/constants/size.enum.d.ts +0 -7
  60. package/packages/cache/dist/constants/size.enum.d.ts.map +0 -1
  61. package/packages/cache/dist/constants/strategy.enum.d.ts +0 -7
  62. package/packages/cache/dist/constants/strategy.enum.d.ts.map +0 -1
  63. package/packages/cache/dist/exceptions/cache-exception.d.ts +0 -5
  64. package/packages/cache/dist/exceptions/cache-exception.d.ts.map +0 -1
  65. package/packages/cache/dist/exceptions/index.d.ts +0 -2
  66. package/packages/cache/dist/exceptions/index.d.ts.map +0 -1
  67. package/packages/cache/dist/index.d.ts +0 -6
  68. package/packages/cache/dist/index.d.ts.map +0 -1
  69. package/packages/cache/dist/index.js +0 -1336
  70. package/packages/cache/dist/index.js.map +0 -1
  71. package/packages/cache/dist/index.mjs +0 -1305
  72. package/packages/cache/dist/index.mjs.map +0 -1
  73. package/packages/cache/dist/request-cache-handler/index.d.ts +0 -2
  74. package/packages/cache/dist/request-cache-handler/index.d.ts.map +0 -1
  75. package/packages/cache/dist/request-cache-handler/request-cache-handler.d.ts +0 -23
  76. package/packages/cache/dist/request-cache-handler/request-cache-handler.d.ts.map +0 -1
  77. package/packages/cache/dist/storage/index.d.ts +0 -6
  78. package/packages/cache/dist/storage/index.d.ts.map +0 -1
  79. package/packages/cache/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts +0 -22
  80. package/packages/cache/dist/storage/indexed-db-storage/base-indexed-db-storage.d.ts.map +0 -1
  81. package/packages/cache/dist/storage/indexed-db-storage/constants/default-table-name.d.ts +0 -2
  82. package/packages/cache/dist/storage/indexed-db-storage/constants/default-table-name.d.ts.map +0 -1
  83. package/packages/cache/dist/storage/indexed-db-storage/index.d.ts +0 -3
  84. package/packages/cache/dist/storage/indexed-db-storage/index.d.ts.map +0 -1
  85. package/packages/cache/dist/storage/indexed-db-storage/indexed-db-storage.d.ts +0 -12
  86. package/packages/cache/dist/storage/indexed-db-storage/indexed-db-storage.d.ts.map +0 -1
  87. package/packages/cache/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts +0 -11
  88. package/packages/cache/dist/storage/indexed-db-storage/lfu-indexed-db-storage.d.ts.map +0 -1
  89. package/packages/cache/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts +0 -11
  90. package/packages/cache/dist/storage/indexed-db-storage/lru-indexed-db-storage.d.ts.map +0 -1
  91. package/packages/cache/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts +0 -11
  92. package/packages/cache/dist/storage/indexed-db-storage/random-indexed-db-storage.d.ts.map +0 -1
  93. package/packages/cache/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts +0 -11
  94. package/packages/cache/dist/storage/indexed-db-storage/ttl-indexed-db-storage.d.ts.map +0 -1
  95. package/packages/cache/dist/storage/indexed-db-storage/types/index.d.ts +0 -7
  96. package/packages/cache/dist/storage/indexed-db-storage/types/index.d.ts.map +0 -1
  97. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts +0 -12
  98. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-metadata.d.ts.map +0 -1
  99. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts +0 -8
  100. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-response.d.ts.map +0 -1
  101. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts +0 -14
  102. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-entry-visits.d.ts.map +0 -1
  103. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts +0 -29
  104. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-schema.d.ts.map +0 -1
  105. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts +0 -14
  106. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-options.d.ts.map +0 -1
  107. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts +0 -13
  108. package/packages/cache/dist/storage/indexed-db-storage/types/indexed-db-storage-size.d.ts.map +0 -1
  109. package/packages/cache/dist/storage/internal-storage/internal-storage.d.ts +0 -16
  110. package/packages/cache/dist/storage/internal-storage/internal-storage.d.ts.map +0 -1
  111. package/packages/cache/dist/storage/internal-storage/types/events.d.ts +0 -16
  112. package/packages/cache/dist/storage/internal-storage/types/events.d.ts.map +0 -1
  113. package/packages/cache/dist/storage/internal-storage/types/storage-options.d.ts +0 -20
  114. package/packages/cache/dist/storage/internal-storage/types/storage-options.d.ts.map +0 -1
  115. package/packages/cache/dist/storage/keq-cache-storage.d.ts +0 -20
  116. package/packages/cache/dist/storage/keq-cache-storage.d.ts.map +0 -1
  117. package/packages/cache/dist/storage/memory-storage/base-memory-storage.d.ts +0 -31
  118. package/packages/cache/dist/storage/memory-storage/base-memory-storage.d.ts.map +0 -1
  119. package/packages/cache/dist/storage/memory-storage/index.d.ts +0 -3
  120. package/packages/cache/dist/storage/memory-storage/index.d.ts.map +0 -1
  121. package/packages/cache/dist/storage/memory-storage/lfu-memory-storage.d.ts +0 -11
  122. package/packages/cache/dist/storage/memory-storage/lfu-memory-storage.d.ts.map +0 -1
  123. package/packages/cache/dist/storage/memory-storage/lru-memory-storage.d.ts +0 -11
  124. package/packages/cache/dist/storage/memory-storage/lru-memory-storage.d.ts.map +0 -1
  125. package/packages/cache/dist/storage/memory-storage/memory-storage.d.ts +0 -13
  126. package/packages/cache/dist/storage/memory-storage/memory-storage.d.ts.map +0 -1
  127. package/packages/cache/dist/storage/memory-storage/random-memory-storage.d.ts +0 -11
  128. package/packages/cache/dist/storage/memory-storage/random-memory-storage.d.ts.map +0 -1
  129. package/packages/cache/dist/storage/memory-storage/ttl-memory-storage.d.ts +0 -11
  130. package/packages/cache/dist/storage/memory-storage/ttl-memory-storage.d.ts.map +0 -1
  131. package/packages/cache/dist/storage/memory-storage/types/index.d.ts +0 -3
  132. package/packages/cache/dist/storage/memory-storage/types/index.d.ts.map +0 -1
  133. package/packages/cache/dist/storage/memory-storage/types/memory-storage-options.d.ts +0 -9
  134. package/packages/cache/dist/storage/memory-storage/types/memory-storage-options.d.ts.map +0 -1
  135. package/packages/cache/dist/storage/memory-storage/types/memory-storage-size.d.ts +0 -13
  136. package/packages/cache/dist/storage/memory-storage/types/memory-storage-size.d.ts.map +0 -1
  137. package/packages/cache/dist/storage/memory-storage/utils/humanize-size.d.ts +0 -6
  138. package/packages/cache/dist/storage/memory-storage/utils/humanize-size.d.ts.map +0 -1
  139. package/packages/cache/dist/storage/memory-storage/utils/index.d.ts +0 -3
  140. package/packages/cache/dist/storage/memory-storage/utils/index.d.ts.map +0 -1
  141. package/packages/cache/dist/storage/memory-storage/utils/serialize-response-body.d.ts +0 -6
  142. package/packages/cache/dist/storage/memory-storage/utils/serialize-response-body.d.ts.map +0 -1
  143. package/packages/cache/dist/storage/multi-tier-storage/index.d.ts +0 -3
  144. package/packages/cache/dist/storage/multi-tier-storage/index.d.ts.map +0 -1
  145. package/packages/cache/dist/storage/multi-tier-storage/multi-tier-storage.d.ts +0 -36
  146. package/packages/cache/dist/storage/multi-tier-storage/multi-tier-storage.d.ts.map +0 -1
  147. package/packages/cache/dist/storage/multi-tier-storage/types/index.d.ts +0 -2
  148. package/packages/cache/dist/storage/multi-tier-storage/types/index.d.ts.map +0 -1
  149. package/packages/cache/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts +0 -5
  150. package/packages/cache/dist/storage/multi-tier-storage/types/multi-tier-storage-options.d.ts.map +0 -1
  151. package/packages/cache/dist/storage/tier-storage/index.d.ts +0 -3
  152. package/packages/cache/dist/storage/tier-storage/index.d.ts.map +0 -1
  153. package/packages/cache/dist/storage/tier-storage/tier-storage.d.ts +0 -15
  154. package/packages/cache/dist/storage/tier-storage/tier-storage.d.ts.map +0 -1
  155. package/packages/cache/dist/storage/tier-storage/types/index.d.ts +0 -2
  156. package/packages/cache/dist/storage/tier-storage/types/index.d.ts.map +0 -1
  157. package/packages/cache/dist/storage/tier-storage/types/tier-storage-options.d.ts +0 -21
  158. package/packages/cache/dist/storage/tier-storage/types/tier-storage-options.d.ts.map +0 -1
  159. package/packages/cache/dist/strategies/cache-first.d.ts +0 -3
  160. package/packages/cache/dist/strategies/cache-first.d.ts.map +0 -1
  161. package/packages/cache/dist/strategies/index.d.ts +0 -5
  162. package/packages/cache/dist/strategies/index.d.ts.map +0 -1
  163. package/packages/cache/dist/strategies/network-first.d.ts +0 -3
  164. package/packages/cache/dist/strategies/network-first.d.ts.map +0 -1
  165. package/packages/cache/dist/strategies/network-only.d.ts +0 -3
  166. package/packages/cache/dist/strategies/network-only.d.ts.map +0 -1
  167. package/packages/cache/dist/strategies/stale-while-revalidate.d.ts +0 -3
  168. package/packages/cache/dist/strategies/stale-while-revalidate.d.ts.map +0 -1
  169. package/packages/cache/dist/types/index.d.ts +0 -6
  170. package/packages/cache/dist/types/index.d.ts.map +0 -1
  171. package/packages/cache/dist/types/keq-cache-key.d.ts +0 -4
  172. package/packages/cache/dist/types/keq-cache-key.d.ts.map +0 -1
  173. package/packages/cache/dist/types/keq-cache-pattern.d.ts +0 -3
  174. package/packages/cache/dist/types/keq-cache-pattern.d.ts.map +0 -1
  175. package/packages/cache/dist/types/keq-cache-rule.d.ts +0 -6
  176. package/packages/cache/dist/types/keq-cache-rule.d.ts.map +0 -1
  177. package/packages/cache/dist/types/keq-cache-strategy.d.ts +0 -6
  178. package/packages/cache/dist/types/keq-cache-strategy.d.ts.map +0 -1
  179. package/packages/cache/dist/types/request-cache-options.d.ts +0 -45
  180. package/packages/cache/dist/types/request-cache-options.d.ts.map +0 -1
  181. package/packages/cache/dist/utils/get-response-bytes.d.ts +0 -2
  182. package/packages/cache/dist/utils/get-response-bytes.d.ts.map +0 -1
  183. package/packages/cache/dist/utils/index.d.ts +0 -4
  184. package/packages/cache/dist/utils/index.d.ts.map +0 -1
  185. package/packages/cache/dist/utils/logger.d.ts +0 -5
  186. package/packages/cache/dist/utils/logger.d.ts.map +0 -1
  187. package/packages/cache/dist/utils/random.d.ts +0 -2
  188. package/packages/cache/dist/utils/random.d.ts.map +0 -1
  189. package/packages/cli/.turbo/turbo-build.log +0 -11
  190. package/packages/cli/dist/cli.cjs +0 -2968
  191. package/packages/cli/dist/cli.cjs.map +0 -1
  192. package/packages/cli/dist/cli.d.ts +0 -3
  193. package/packages/cli/dist/cli.d.ts.map +0 -1
  194. package/packages/cli/dist/cli.js +0 -2945
  195. package/packages/cli/dist/cli.js.map +0 -1
  196. package/packages/cli/dist/compiler/compiler.d.ts +0 -17
  197. package/packages/cli/dist/compiler/compiler.d.ts.map +0 -1
  198. package/packages/cli/dist/compiler/index.d.ts +0 -4
  199. package/packages/cli/dist/compiler/index.d.ts.map +0 -1
  200. package/packages/cli/dist/compiler/intercepter/index.d.ts +0 -3
  201. package/packages/cli/dist/compiler/intercepter/index.d.ts.map +0 -1
  202. package/packages/cli/dist/compiler/intercepter/perfect-error-message.d.ts +0 -3
  203. package/packages/cli/dist/compiler/intercepter/perfect-error-message.d.ts.map +0 -1
  204. package/packages/cli/dist/compiler/intercepter/print-information.d.ts +0 -5
  205. package/packages/cli/dist/compiler/intercepter/print-information.d.ts.map +0 -1
  206. package/packages/cli/dist/compiler/tasks/compile/index.d.ts +0 -6
  207. package/packages/cli/dist/compiler/tasks/compile/index.d.ts.map +0 -1
  208. package/packages/cli/dist/compiler/tasks/download/index.d.ts +0 -10
  209. package/packages/cli/dist/compiler/tasks/download/index.d.ts.map +0 -1
  210. package/packages/cli/dist/compiler/tasks/index.d.ts +0 -6
  211. package/packages/cli/dist/compiler/tasks/index.d.ts.map +0 -1
  212. package/packages/cli/dist/compiler/tasks/persist/index.d.ts +0 -5
  213. package/packages/cli/dist/compiler/tasks/persist/index.d.ts.map +0 -1
  214. package/packages/cli/dist/compiler/tasks/setup/index.d.ts +0 -15
  215. package/packages/cli/dist/compiler/tasks/setup/index.d.ts.map +0 -1
  216. package/packages/cli/dist/compiler/tasks/setup/utils/find-nearest-package-json.d.ts +0 -6
  217. package/packages/cli/dist/compiler/tasks/setup/utils/find-nearest-package-json.d.ts.map +0 -1
  218. package/packages/cli/dist/compiler/tasks/setup/utils/get-project-module-system.d.ts +0 -5
  219. package/packages/cli/dist/compiler/tasks/setup/utils/get-project-module-system.d.ts.map +0 -1
  220. package/packages/cli/dist/compiler/tasks/setup/utils/index.d.ts +0 -3
  221. package/packages/cli/dist/compiler/tasks/setup/utils/index.d.ts.map +0 -1
  222. package/packages/cli/dist/compiler/tasks/setup/utils/parse-runtime-config.d.ts +0 -3
  223. package/packages/cli/dist/compiler/tasks/setup/utils/parse-runtime-config.d.ts.map +0 -1
  224. package/packages/cli/dist/compiler/tasks/types/base-task-options.d.ts +0 -6
  225. package/packages/cli/dist/compiler/tasks/types/base-task-options.d.ts.map +0 -1
  226. package/packages/cli/dist/compiler/tasks/types/index.d.ts +0 -3
  227. package/packages/cli/dist/compiler/tasks/types/index.d.ts.map +0 -1
  228. package/packages/cli/dist/compiler/tasks/types/task-wrapper.d.ts +0 -4
  229. package/packages/cli/dist/compiler/tasks/types/task-wrapper.d.ts.map +0 -1
  230. package/packages/cli/dist/compiler/types/compiler-context.d.ts +0 -11
  231. package/packages/cli/dist/compiler/types/compiler-context.d.ts.map +0 -1
  232. package/packages/cli/dist/compiler/types/compiler-hooks.d.ts +0 -19
  233. package/packages/cli/dist/compiler/types/compiler-hooks.d.ts.map +0 -1
  234. package/packages/cli/dist/compiler/types/index.d.ts +0 -3
  235. package/packages/cli/dist/compiler/types/index.d.ts.map +0 -1
  236. package/packages/cli/dist/constants/file-naming-style.d.ts +0 -14
  237. package/packages/cli/dist/constants/file-naming-style.d.ts.map +0 -1
  238. package/packages/cli/dist/constants/index.d.ts +0 -4
  239. package/packages/cli/dist/constants/index.d.ts.map +0 -1
  240. package/packages/cli/dist/constants/qs-array-format.d.ts +0 -9
  241. package/packages/cli/dist/constants/qs-array-format.d.ts.map +0 -1
  242. package/packages/cli/dist/constants/supported-methods.d.ts +0 -2
  243. package/packages/cli/dist/constants/supported-methods.d.ts.map +0 -1
  244. package/packages/cli/dist/define-config.d.ts +0 -3
  245. package/packages/cli/dist/define-config.d.ts.map +0 -1
  246. package/packages/cli/dist/exception.d.ts +0 -6
  247. package/packages/cli/dist/exception.d.ts.map +0 -1
  248. package/packages/cli/dist/generators/index.d.ts +0 -2
  249. package/packages/cli/dist/generators/index.d.ts.map +0 -1
  250. package/packages/cli/dist/index.cjs +0 -2899
  251. package/packages/cli/dist/index.cjs.map +0 -1
  252. package/packages/cli/dist/index.d.ts +0 -6
  253. package/packages/cli/dist/index.d.ts.map +0 -1
  254. package/packages/cli/dist/index.js +0 -2853
  255. package/packages/cli/dist/index.js.map +0 -1
  256. package/packages/cli/dist/models/anchor.d.ts +0 -20
  257. package/packages/cli/dist/models/anchor.d.ts.map +0 -1
  258. package/packages/cli/dist/models/api-document_v3_1.d.ts +0 -16
  259. package/packages/cli/dist/models/api-document_v3_1.d.ts.map +0 -1
  260. package/packages/cli/dist/models/artifact.d.ts +0 -17
  261. package/packages/cli/dist/models/artifact.d.ts.map +0 -1
  262. package/packages/cli/dist/models/asset.d.ts +0 -5
  263. package/packages/cli/dist/models/asset.d.ts.map +0 -1
  264. package/packages/cli/dist/models/index.d.ts +0 -8
  265. package/packages/cli/dist/models/index.d.ts.map +0 -1
  266. package/packages/cli/dist/models/module-definition.d.ts +0 -8
  267. package/packages/cli/dist/models/module-definition.d.ts.map +0 -1
  268. package/packages/cli/dist/models/operation-definition.d.ts +0 -23
  269. package/packages/cli/dist/models/operation-definition.d.ts.map +0 -1
  270. package/packages/cli/dist/models/schema-definition.d.ts +0 -20
  271. package/packages/cli/dist/models/schema-definition.d.ts.map +0 -1
  272. package/packages/cli/dist/models/utils/to-comment.d.ts +0 -2
  273. package/packages/cli/dist/models/utils/to-comment.d.ts.map +0 -1
  274. package/packages/cli/dist/plugins/body-fallback/index.d.ts +0 -6
  275. package/packages/cli/dist/plugins/body-fallback/index.d.ts.map +0 -1
  276. package/packages/cli/dist/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.d.ts +0 -5
  277. package/packages/cli/dist/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.d.ts.map +0 -1
  278. package/packages/cli/dist/plugins/chinese-to-pinyin/index.d.ts +0 -2
  279. package/packages/cli/dist/plugins/chinese-to-pinyin/index.d.ts.map +0 -1
  280. package/packages/cli/dist/plugins/download-http-file/download-http-file.plugin.d.ts +0 -8
  281. package/packages/cli/dist/plugins/download-http-file/download-http-file.plugin.d.ts.map +0 -1
  282. package/packages/cli/dist/plugins/download-http-file/index.d.ts +0 -2
  283. package/packages/cli/dist/plugins/download-http-file/index.d.ts.map +0 -1
  284. package/packages/cli/dist/plugins/download-local-file/download-local-file.plugin.d.ts +0 -6
  285. package/packages/cli/dist/plugins/download-local-file/download-local-file.plugin.d.ts.map +0 -1
  286. package/packages/cli/dist/plugins/download-local-file/index.d.ts +0 -2
  287. package/packages/cli/dist/plugins/download-local-file/index.d.ts.map +0 -1
  288. package/packages/cli/dist/plugins/eslint/index.d.ts +0 -15
  289. package/packages/cli/dist/plugins/eslint/index.d.ts.map +0 -1
  290. package/packages/cli/dist/plugins/generate-declaration/constants/index.d.ts +0 -2
  291. package/packages/cli/dist/plugins/generate-declaration/constants/index.d.ts.map +0 -1
  292. package/packages/cli/dist/plugins/generate-declaration/constants/metadata-storage.d.ts +0 -12
  293. package/packages/cli/dist/plugins/generate-declaration/constants/metadata-storage.d.ts.map +0 -1
  294. package/packages/cli/dist/plugins/generate-declaration/generate-declaration.plugin.d.ts +0 -15
  295. package/packages/cli/dist/plugins/generate-declaration/generate-declaration.plugin.d.ts.map +0 -1
  296. package/packages/cli/dist/plugins/generate-declaration/generators/index.d.ts +0 -3
  297. package/packages/cli/dist/plugins/generate-declaration/generators/index.d.ts.map +0 -1
  298. package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/index.d.ts +0 -2
  299. package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/index.d.ts.map +0 -1
  300. package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/operation.generator.d.ts +0 -15
  301. package/packages/cli/dist/plugins/generate-declaration/generators/operation-declaration/operation.generator.d.ts.map +0 -1
  302. package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/index.d.ts +0 -2
  303. package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/index.d.ts.map +0 -1
  304. package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/schema.generator.d.ts +0 -15
  305. package/packages/cli/dist/plugins/generate-declaration/generators/schema-declaration/schema.generator.d.ts.map +0 -1
  306. package/packages/cli/dist/plugins/generate-declaration/index.d.ts +0 -3
  307. package/packages/cli/dist/plugins/generate-declaration/index.d.ts.map +0 -1
  308. package/packages/cli/dist/plugins/generate-micro-function/constants/index.d.ts +0 -2
  309. package/packages/cli/dist/plugins/generate-micro-function/constants/index.d.ts.map +0 -1
  310. package/packages/cli/dist/plugins/generate-micro-function/constants/metadata-storage.d.ts +0 -11
  311. package/packages/cli/dist/plugins/generate-micro-function/constants/metadata-storage.d.ts.map +0 -1
  312. package/packages/cli/dist/plugins/generate-micro-function/generate-micro-function.plugin.d.ts +0 -11
  313. package/packages/cli/dist/plugins/generate-micro-function/generate-micro-function.plugin.d.ts.map +0 -1
  314. package/packages/cli/dist/plugins/generate-micro-function/generators/index.d.ts +0 -3
  315. package/packages/cli/dist/plugins/generate-micro-function/generators/index.d.ts.map +0 -1
  316. package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/index.d.ts +0 -2
  317. package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/index.d.ts.map +0 -1
  318. package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/micro-function.generator.d.ts +0 -15
  319. package/packages/cli/dist/plugins/generate-micro-function/generators/micro_function/micro-function.generator.d.ts.map +0 -1
  320. package/packages/cli/dist/plugins/generate-micro-function/generators/request/index.d.ts +0 -2
  321. package/packages/cli/dist/plugins/generate-micro-function/generators/request/index.d.ts.map +0 -1
  322. package/packages/cli/dist/plugins/generate-micro-function/generators/request/request.generator.d.ts +0 -11
  323. package/packages/cli/dist/plugins/generate-micro-function/generators/request/request.generator.d.ts.map +0 -1
  324. package/packages/cli/dist/plugins/generate-micro-function/index.d.ts +0 -3
  325. package/packages/cli/dist/plugins/generate-micro-function/index.d.ts.map +0 -1
  326. package/packages/cli/dist/plugins/generate-nestjs-module/constants/index.d.ts +0 -2
  327. package/packages/cli/dist/plugins/generate-nestjs-module/constants/index.d.ts.map +0 -1
  328. package/packages/cli/dist/plugins/generate-nestjs-module/constants/metadata-storage.d.ts +0 -10
  329. package/packages/cli/dist/plugins/generate-nestjs-module/constants/metadata-storage.d.ts.map +0 -1
  330. package/packages/cli/dist/plugins/generate-nestjs-module/generate-nestjs-module.d.ts +0 -10
  331. package/packages/cli/dist/plugins/generate-nestjs-module/generate-nestjs-module.d.ts.map +0 -1
  332. package/packages/cli/dist/plugins/generate-nestjs-module/generators/index.d.ts +0 -2
  333. package/packages/cli/dist/plugins/generate-nestjs-module/generators/index.d.ts.map +0 -1
  334. package/packages/cli/dist/plugins/generate-nestjs-module/generators/nestjs-module.generator.d.ts +0 -14
  335. package/packages/cli/dist/plugins/generate-nestjs-module/generators/nestjs-module.generator.d.ts.map +0 -1
  336. package/packages/cli/dist/plugins/generate-nestjs-module/index.d.ts +0 -3
  337. package/packages/cli/dist/plugins/generate-nestjs-module/index.d.ts.map +0 -1
  338. package/packages/cli/dist/plugins/index.d.ts +0 -15
  339. package/packages/cli/dist/plugins/index.d.ts.map +0 -1
  340. package/packages/cli/dist/plugins/initialize/index.d.ts +0 -2
  341. package/packages/cli/dist/plugins/initialize/index.d.ts.map +0 -1
  342. package/packages/cli/dist/plugins/initialize/initialize.plugin.d.ts +0 -15
  343. package/packages/cli/dist/plugins/initialize/initialize.plugin.d.ts.map +0 -1
  344. package/packages/cli/dist/plugins/overwrite-operation-id/index.d.ts +0 -2
  345. package/packages/cli/dist/plugins/overwrite-operation-id/index.d.ts.map +0 -1
  346. package/packages/cli/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts +0 -20
  347. package/packages/cli/dist/plugins/overwrite-operation-id/overwrite-operation-id.plugin.d.ts.map +0 -1
  348. package/packages/cli/dist/plugins/overwrite-query-options/index.d.ts +0 -2
  349. package/packages/cli/dist/plugins/overwrite-query-options/index.d.ts.map +0 -1
  350. package/packages/cli/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts +0 -18
  351. package/packages/cli/dist/plugins/overwrite-query-options/overwrite-query-options.plugin.d.ts.map +0 -1
  352. package/packages/cli/dist/plugins/prettier/index.d.ts +0 -2
  353. package/packages/cli/dist/plugins/prettier/index.d.ts.map +0 -1
  354. package/packages/cli/dist/plugins/prettier/prettier.plugin.d.ts +0 -6
  355. package/packages/cli/dist/plugins/prettier/prettier.plugin.d.ts.map +0 -1
  356. package/packages/cli/dist/plugins/shaking/index.d.ts +0 -2
  357. package/packages/cli/dist/plugins/shaking/index.d.ts.map +0 -1
  358. package/packages/cli/dist/plugins/shaking/shaking.plugin.d.ts +0 -8
  359. package/packages/cli/dist/plugins/shaking/shaking.plugin.d.ts.map +0 -1
  360. package/packages/cli/dist/plugins/terminal-select/index.d.ts +0 -2
  361. package/packages/cli/dist/plugins/terminal-select/index.d.ts.map +0 -1
  362. package/packages/cli/dist/plugins/terminal-select/terminal-select.plugin.d.ts +0 -18
  363. package/packages/cli/dist/plugins/terminal-select/terminal-select.plugin.d.ts.map +0 -1
  364. package/packages/cli/dist/plugins/terminal-select/types/ignore-mode.d.ts +0 -2
  365. package/packages/cli/dist/plugins/terminal-select/types/ignore-mode.d.ts.map +0 -1
  366. package/packages/cli/dist/plugins/terminal-select/types/index.d.ts +0 -2
  367. package/packages/cli/dist/plugins/terminal-select/types/index.d.ts.map +0 -1
  368. package/packages/cli/dist/plugins/terminal-select/utils/index.d.ts +0 -2
  369. package/packages/cli/dist/plugins/terminal-select/utils/index.d.ts.map +0 -1
  370. package/packages/cli/dist/plugins/terminal-select/utils/select-operation-definitions.d.ts +0 -5
  371. package/packages/cli/dist/plugins/terminal-select/utils/select-operation-definitions.d.ts.map +0 -1
  372. package/packages/cli/dist/plugins.cjs +0 -2438
  373. package/packages/cli/dist/plugins.cjs.map +0 -1
  374. package/packages/cli/dist/plugins.js +0 -2378
  375. package/packages/cli/dist/plugins.js.map +0 -1
  376. package/packages/cli/dist/transformers/api-document/api-document.transformer.d.ts +0 -8
  377. package/packages/cli/dist/transformers/api-document/api-document.transformer.d.ts.map +0 -1
  378. package/packages/cli/dist/transformers/api-document/index.d.ts +0 -2
  379. package/packages/cli/dist/transformers/api-document/index.d.ts.map +0 -1
  380. package/packages/cli/dist/transformers/api-document/nestjs-client.renderer.d.ts +0 -14
  381. package/packages/cli/dist/transformers/api-document/nestjs-client.renderer.d.ts.map +0 -1
  382. package/packages/cli/dist/transformers/api-document/nestjs-module.renderer.d.ts +0 -12
  383. package/packages/cli/dist/transformers/api-document/nestjs-module.renderer.d.ts.map +0 -1
  384. package/packages/cli/dist/transformers/entrypoint/entrypoint.transformer.d.ts +0 -10
  385. package/packages/cli/dist/transformers/entrypoint/entrypoint.transformer.d.ts.map +0 -1
  386. package/packages/cli/dist/transformers/entrypoint/index.d.ts +0 -2
  387. package/packages/cli/dist/transformers/entrypoint/index.d.ts.map +0 -1
  388. package/packages/cli/dist/transformers/index.d.ts +0 -6
  389. package/packages/cli/dist/transformers/index.d.ts.map +0 -1
  390. package/packages/cli/dist/transformers/json-schema/comment.renderer.d.ts +0 -8
  391. package/packages/cli/dist/transformers/json-schema/comment.renderer.d.ts.map +0 -1
  392. package/packages/cli/dist/transformers/json-schema/declaration.renderer.d.ts +0 -26
  393. package/packages/cli/dist/transformers/json-schema/declaration.renderer.d.ts.map +0 -1
  394. package/packages/cli/dist/transformers/json-schema/index.d.ts +0 -4
  395. package/packages/cli/dist/transformers/json-schema/index.d.ts.map +0 -1
  396. package/packages/cli/dist/transformers/json-schema/json-schema.transformer.d.ts +0 -7
  397. package/packages/cli/dist/transformers/json-schema/json-schema.transformer.d.ts.map +0 -1
  398. package/packages/cli/dist/transformers/json-schema/reference.transformer.d.ts +0 -5
  399. package/packages/cli/dist/transformers/json-schema/reference.transformer.d.ts.map +0 -1
  400. package/packages/cli/dist/transformers/json-schema/types/any-other-attribute.d.ts +0 -5
  401. package/packages/cli/dist/transformers/json-schema/types/any-other-attribute.d.ts.map +0 -1
  402. package/packages/cli/dist/transformers/json-schema/types/index.d.ts +0 -3
  403. package/packages/cli/dist/transformers/json-schema/types/index.d.ts.map +0 -1
  404. package/packages/cli/dist/transformers/json-schema/types/mixed-schema-object.d.ts +0 -7
  405. package/packages/cli/dist/transformers/json-schema/types/mixed-schema-object.d.ts.map +0 -1
  406. package/packages/cli/dist/transformers/operation-definition/comment.renderer.d.ts +0 -8
  407. package/packages/cli/dist/transformers/operation-definition/comment.renderer.d.ts.map +0 -1
  408. package/packages/cli/dist/transformers/operation-definition/declaration.renderer.d.ts +0 -20
  409. package/packages/cli/dist/transformers/operation-definition/declaration.renderer.d.ts.map +0 -1
  410. package/packages/cli/dist/transformers/operation-definition/index.d.ts +0 -3
  411. package/packages/cli/dist/transformers/operation-definition/index.d.ts.map +0 -1
  412. package/packages/cli/dist/transformers/operation-definition/micro-function.renderer.d.ts +0 -19
  413. package/packages/cli/dist/transformers/operation-definition/micro-function.renderer.d.ts.map +0 -1
  414. package/packages/cli/dist/transformers/operation-definition/nestjs-method.renderer.d.ts +0 -15
  415. package/packages/cli/dist/transformers/operation-definition/nestjs-method.renderer.d.ts.map +0 -1
  416. package/packages/cli/dist/transformers/operation-definition/operation-definition.transformer.d.ts +0 -11
  417. package/packages/cli/dist/transformers/operation-definition/operation-definition.transformer.d.ts.map +0 -1
  418. package/packages/cli/dist/transformers/operation-definition/typescript-snippet.d.ts +0 -22
  419. package/packages/cli/dist/transformers/operation-definition/typescript-snippet.d.ts.map +0 -1
  420. package/packages/cli/dist/transformers/operation-definition/utils/index.d.ts +0 -2
  421. package/packages/cli/dist/transformers/operation-definition/utils/index.d.ts.map +0 -1
  422. package/packages/cli/dist/transformers/operation-definition/utils/type-name-factory.d.ts +0 -4
  423. package/packages/cli/dist/transformers/operation-definition/utils/type-name-factory.d.ts.map +0 -1
  424. package/packages/cli/dist/transformers/schema-definition/index.d.ts +0 -2
  425. package/packages/cli/dist/transformers/schema-definition/index.d.ts.map +0 -1
  426. package/packages/cli/dist/transformers/schema-definition/schema-definition.transformer.d.ts +0 -10
  427. package/packages/cli/dist/transformers/schema-definition/schema-definition.transformer.d.ts.map +0 -1
  428. package/packages/cli/dist/transformers/types/renderer.d.ts +0 -4
  429. package/packages/cli/dist/transformers/types/renderer.d.ts.map +0 -1
  430. package/packages/cli/dist/types/address.d.ts +0 -8
  431. package/packages/cli/dist/types/address.d.ts.map +0 -1
  432. package/packages/cli/dist/types/build-cli-options.d.ts +0 -19
  433. package/packages/cli/dist/types/build-cli-options.d.ts.map +0 -1
  434. package/packages/cli/dist/types/generator.d.ts +0 -7
  435. package/packages/cli/dist/types/generator.d.ts.map +0 -1
  436. package/packages/cli/dist/types/index.d.ts +0 -7
  437. package/packages/cli/dist/types/index.d.ts.map +0 -1
  438. package/packages/cli/dist/types/plugin.d.ts +0 -5
  439. package/packages/cli/dist/types/plugin.d.ts.map +0 -1
  440. package/packages/cli/dist/types/runtime-config.d.ts +0 -41
  441. package/packages/cli/dist/types/runtime-config.d.ts.map +0 -1
  442. package/packages/cli/dist/types/to-code-options.d.ts +0 -4
  443. package/packages/cli/dist/types/to-code-options.d.ts.map +0 -1
  444. package/packages/cli/dist/utils/debugger.d.ts +0 -7
  445. package/packages/cli/dist/utils/debugger.d.ts.map +0 -1
  446. package/packages/cli/dist/utils/ignore-matcher.d.ts +0 -18
  447. package/packages/cli/dist/utils/ignore-matcher.d.ts.map +0 -1
  448. package/packages/cli/dist/utils/indent.d.ts +0 -2
  449. package/packages/cli/dist/utils/indent.d.ts.map +0 -1
  450. package/packages/cli/dist/utils/is-keywords.d.ts +0 -2
  451. package/packages/cli/dist/utils/is-keywords.d.ts.map +0 -1
  452. package/packages/cli/dist/utils/is-reserved-word.d.ts +0 -2
  453. package/packages/cli/dist/utils/is-reserved-word.d.ts.map +0 -1
  454. package/packages/cli/dist/utils/is-valid-url.d.ts +0 -16
  455. package/packages/cli/dist/utils/is-valid-url.d.ts.map +0 -1
  456. package/packages/cli/dist/utils/json-schema-utils/index.d.ts +0 -11
  457. package/packages/cli/dist/utils/json-schema-utils/index.d.ts.map +0 -1
  458. package/packages/cli/dist/utils/json-schema-utils/is-array.d.ts +0 -3
  459. package/packages/cli/dist/utils/json-schema-utils/is-array.d.ts.map +0 -1
  460. package/packages/cli/dist/utils/json-schema-utils/is-mixed.d.ts +0 -4
  461. package/packages/cli/dist/utils/json-schema-utils/is-mixed.d.ts.map +0 -1
  462. package/packages/cli/dist/utils/json-schema-utils/is-non-array.d.ts +0 -3
  463. package/packages/cli/dist/utils/json-schema-utils/is-non-array.d.ts.map +0 -1
  464. package/packages/cli/dist/utils/json-schema-utils/is-ref.d.ts +0 -3
  465. package/packages/cli/dist/utils/json-schema-utils/is-ref.d.ts.map +0 -1
  466. package/packages/cli/dist/utils/json-schema-utils/types/any-other-attribute.d.ts +0 -5
  467. package/packages/cli/dist/utils/json-schema-utils/types/any-other-attribute.d.ts.map +0 -1
  468. package/packages/cli/dist/utils/json-schema-utils/types/mixed-schema-object.d.ts +0 -7
  469. package/packages/cli/dist/utils/json-schema-utils/types/mixed-schema-object.d.ts.map +0 -1
  470. package/packages/cli/dist/utils/logger.d.ts +0 -6
  471. package/packages/cli/dist/utils/logger.d.ts.map +0 -1
  472. package/packages/cli/dist/utils/openapi-utils/dereference-deep.d.ts +0 -3
  473. package/packages/cli/dist/utils/openapi-utils/dereference-deep.d.ts.map +0 -1
  474. package/packages/cli/dist/utils/openapi-utils/dereference-operation.d.ts +0 -4
  475. package/packages/cli/dist/utils/openapi-utils/dereference-operation.d.ts.map +0 -1
  476. package/packages/cli/dist/utils/openapi-utils/dereference.d.ts +0 -3
  477. package/packages/cli/dist/utils/openapi-utils/dereference.d.ts.map +0 -1
  478. package/packages/cli/dist/utils/openapi-utils/index.d.ts +0 -19
  479. package/packages/cli/dist/utils/openapi-utils/index.d.ts.map +0 -1
  480. package/packages/cli/dist/utils/openapi-utils/is-ref-defined.d.ts +0 -3
  481. package/packages/cli/dist/utils/openapi-utils/is-ref-defined.d.ts.map +0 -1
  482. package/packages/cli/dist/utils/openapi-utils/map-operation.d.ts +0 -4
  483. package/packages/cli/dist/utils/openapi-utils/map-operation.d.ts.map +0 -1
  484. package/packages/cli/dist/utils/openapi-utils/map-parameter.d.ts +0 -4
  485. package/packages/cli/dist/utils/openapi-utils/map-parameter.d.ts.map +0 -1
  486. package/packages/cli/dist/utils/openapi-utils/remove-undefined-ref.d.ts +0 -3
  487. package/packages/cli/dist/utils/openapi-utils/remove-undefined-ref.d.ts.map +0 -1
  488. package/packages/cli/dist/utils/openapi-utils/to-3_1.d.ts +0 -3
  489. package/packages/cli/dist/utils/openapi-utils/to-3_1.d.ts.map +0 -1
  490. package/packages/cli/node_modules/.bin/eslint +0 -21
  491. package/packages/cli/node_modules/.bin/jiti +0 -21
  492. package/packages/cli/node_modules/.bin/js-yaml +0 -21
  493. package/packages/cli/node_modules/.bin/jsonpath +0 -21
  494. package/packages/cli/node_modules/.bin/jsonpath-plus +0 -21
  495. package/packages/cli/node_modules/.bin/semver +0 -21
  496. package/packages/cli/node_modules/.bin/tsc +0 -21
  497. package/packages/cli/node_modules/.bin/tsserver +0 -21
  498. package/packages/exception/.turbo/turbo-build.log +0 -34
  499. package/packages/exception/dist/catch-exception.d.ts +0 -4
  500. package/packages/exception/dist/catch-exception.d.ts.map +0 -1
  501. package/packages/exception/dist/index.d.ts +0 -4
  502. package/packages/exception/dist/index.d.ts.map +0 -1
  503. package/packages/exception/dist/index.js +0 -112
  504. package/packages/exception/dist/index.js.map +0 -1
  505. package/packages/exception/dist/index.mjs +0 -111
  506. package/packages/exception/dist/index.mjs.map +0 -1
  507. package/packages/exception/dist/plugins/index.d.mts +0 -12
  508. package/packages/exception/dist/plugins/index.d.ts +0 -12
  509. package/packages/exception/dist/plugins/index.js +0 -95
  510. package/packages/exception/dist/plugins/index.mjs +0 -68
  511. package/packages/exception/dist/throw-exception.d.ts +0 -5
  512. package/packages/exception/dist/throw-exception.d.ts.map +0 -1
  513. package/packages/exception/dist/validate-status-code.d.ts +0 -3
  514. package/packages/exception/dist/validate-status-code.d.ts.map +0 -1
  515. package/packages/exception/node_modules/.bin/keq +0 -21
  516. package/packages/headers/.turbo/turbo-build.log +0 -21
  517. package/packages/headers/dist/index.d.ts +0 -42
  518. package/packages/headers/dist/index.d.ts.map +0 -1
  519. package/packages/headers/dist/index.js +0 -77
  520. package/packages/headers/dist/index.js.map +0 -1
  521. package/packages/headers/dist/index.mjs +0 -56
  522. package/packages/headers/dist/index.mjs.map +0 -1
  523. package/packages/keq/.turbo/turbo-build.log +0 -19
  524. package/packages/keq/dist/context/execution-context.d.ts +0 -26
  525. package/packages/keq/dist/context/execution-context.d.ts.map +0 -1
  526. package/packages/keq/dist/context/index.d.ts +0 -5
  527. package/packages/keq/dist/context/index.d.ts.map +0 -1
  528. package/packages/keq/dist/context/middleware-context.d.ts +0 -11
  529. package/packages/keq/dist/context/middleware-context.d.ts.map +0 -1
  530. package/packages/keq/dist/context/orchestrator-context.d.ts +0 -18
  531. package/packages/keq/dist/context/orchestrator-context.d.ts.map +0 -1
  532. package/packages/keq/dist/context/shared-context.d.ts +0 -43
  533. package/packages/keq/dist/context/shared-context.d.ts.map +0 -1
  534. package/packages/keq/dist/context/types/index.d.ts +0 -6
  535. package/packages/keq/dist/context/types/index.d.ts.map +0 -1
  536. package/packages/keq/dist/context/types/keq-context-data.d.ts +0 -7
  537. package/packages/keq/dist/context/types/keq-context-data.d.ts.map +0 -1
  538. package/packages/keq/dist/context/types/keq-context-emitter.d.ts +0 -35
  539. package/packages/keq/dist/context/types/keq-context-emitter.d.ts.map +0 -1
  540. package/packages/keq/dist/context/types/keq-context-options/index.d.ts +0 -6
  541. package/packages/keq/dist/context/types/keq-context-options/index.d.ts.map +0 -1
  542. package/packages/keq/dist/context/types/keq-context-options/keq-context-options.d.ts +0 -5
  543. package/packages/keq/dist/context/types/keq-context-options/keq-context-options.d.ts.map +0 -1
  544. package/packages/keq/dist/context/types/keq-context-options/keq-middleware-options.d.ts +0 -33
  545. package/packages/keq/dist/context/types/keq-context-options/keq-middleware-options.d.ts.map +0 -1
  546. package/packages/keq/dist/context/types/keq-context-options/keq-module-options.d.ts +0 -5
  547. package/packages/keq/dist/context/types/keq-context-options/keq-module-options.d.ts.map +0 -1
  548. package/packages/keq/dist/context/types/keq-context-options/keq-resolve-with-mode.d.ts +0 -2
  549. package/packages/keq/dist/context/types/keq-context-options/keq-resolve-with-mode.d.ts.map +0 -1
  550. package/packages/keq/dist/context/types/keq-context-options/keq-retry-options.d.ts +0 -9
  551. package/packages/keq/dist/context/types/keq-context-options/keq-retry-options.d.ts.map +0 -1
  552. package/packages/keq/dist/context/types/keq-context.d.ts +0 -17
  553. package/packages/keq/dist/context/types/keq-context.d.ts.map +0 -1
  554. package/packages/keq/dist/context/types/keq-global.d.ts +0 -12
  555. package/packages/keq/dist/context/types/keq-global.d.ts.map +0 -1
  556. package/packages/keq/dist/context/utils/assign-shared-context.d.ts +0 -3
  557. package/packages/keq/dist/context/utils/assign-shared-context.d.ts.map +0 -1
  558. package/packages/keq/dist/context/utils/clone-shared-context.d.ts +0 -3
  559. package/packages/keq/dist/context/utils/clone-shared-context.d.ts.map +0 -1
  560. package/packages/keq/dist/context/utils/create-proxy-response.d.ts +0 -2
  561. package/packages/keq/dist/context/utils/create-proxy-response.d.ts.map +0 -1
  562. package/packages/keq/dist/context/utils/fork.d.ts +0 -6
  563. package/packages/keq/dist/context/utils/fork.d.ts.map +0 -1
  564. package/packages/keq/dist/context/utils/index.d.ts +0 -5
  565. package/packages/keq/dist/context/utils/index.d.ts.map +0 -1
  566. package/packages/keq/dist/context/utils/watch-object.d.ts +0 -5
  567. package/packages/keq/dist/context/utils/watch-object.d.ts.map +0 -1
  568. package/packages/keq/dist/exception/abort.exception.d.ts +0 -4
  569. package/packages/keq/dist/exception/abort.exception.d.ts.map +0 -1
  570. package/packages/keq/dist/exception/exception.d.ts +0 -5
  571. package/packages/keq/dist/exception/exception.d.ts.map +0 -1
  572. package/packages/keq/dist/exception/http-exceptions/bad-gateway.exception.d.ts +0 -5
  573. package/packages/keq/dist/exception/http-exceptions/bad-gateway.exception.d.ts.map +0 -1
  574. package/packages/keq/dist/exception/http-exceptions/bad-request.exception.d.ts +0 -5
  575. package/packages/keq/dist/exception/http-exceptions/bad-request.exception.d.ts.map +0 -1
  576. package/packages/keq/dist/exception/http-exceptions/conflict.exception.d.ts +0 -5
  577. package/packages/keq/dist/exception/http-exceptions/conflict.exception.d.ts.map +0 -1
  578. package/packages/keq/dist/exception/http-exceptions/content-too-large.exception.d.ts +0 -5
  579. package/packages/keq/dist/exception/http-exceptions/content-too-large.exception.d.ts.map +0 -1
  580. package/packages/keq/dist/exception/http-exceptions/forbidden.exception.d.ts +0 -5
  581. package/packages/keq/dist/exception/http-exceptions/forbidden.exception.d.ts.map +0 -1
  582. package/packages/keq/dist/exception/http-exceptions/gateway-timeout.exception.d.ts +0 -5
  583. package/packages/keq/dist/exception/http-exceptions/gateway-timeout.exception.d.ts.map +0 -1
  584. package/packages/keq/dist/exception/http-exceptions/http-version-not-supported.exception.d.ts +0 -5
  585. package/packages/keq/dist/exception/http-exceptions/http-version-not-supported.exception.d.ts.map +0 -1
  586. package/packages/keq/dist/exception/http-exceptions/im-a-teapot.exception.d.ts +0 -5
  587. package/packages/keq/dist/exception/http-exceptions/im-a-teapot.exception.d.ts.map +0 -1
  588. package/packages/keq/dist/exception/http-exceptions/index.d.ts +0 -22
  589. package/packages/keq/dist/exception/http-exceptions/index.d.ts.map +0 -1
  590. package/packages/keq/dist/exception/http-exceptions/internal-server-error.exception.d.ts +0 -5
  591. package/packages/keq/dist/exception/http-exceptions/internal-server-error.exception.d.ts.map +0 -1
  592. package/packages/keq/dist/exception/http-exceptions/method-not-allowed.exception.d.ts +0 -5
  593. package/packages/keq/dist/exception/http-exceptions/method-not-allowed.exception.d.ts.map +0 -1
  594. package/packages/keq/dist/exception/http-exceptions/not-acceptable.exception.d.ts +0 -5
  595. package/packages/keq/dist/exception/http-exceptions/not-acceptable.exception.d.ts.map +0 -1
  596. package/packages/keq/dist/exception/http-exceptions/not-founded.exception.d.ts +0 -5
  597. package/packages/keq/dist/exception/http-exceptions/not-founded.exception.d.ts.map +0 -1
  598. package/packages/keq/dist/exception/http-exceptions/not-implemented.exception.d.ts +0 -5
  599. package/packages/keq/dist/exception/http-exceptions/not-implemented.exception.d.ts.map +0 -1
  600. package/packages/keq/dist/exception/http-exceptions/precondition-failed.exception.d.ts +0 -5
  601. package/packages/keq/dist/exception/http-exceptions/precondition-failed.exception.d.ts.map +0 -1
  602. package/packages/keq/dist/exception/http-exceptions/proxy-authentication-required.exception.d.ts +0 -5
  603. package/packages/keq/dist/exception/http-exceptions/proxy-authentication-required.exception.d.ts.map +0 -1
  604. package/packages/keq/dist/exception/http-exceptions/request-timeout.exception.d.ts +0 -5
  605. package/packages/keq/dist/exception/http-exceptions/request-timeout.exception.d.ts.map +0 -1
  606. package/packages/keq/dist/exception/http-exceptions/request.exception.d.ts +0 -12
  607. package/packages/keq/dist/exception/http-exceptions/request.exception.d.ts.map +0 -1
  608. package/packages/keq/dist/exception/http-exceptions/service-unavailable.exception.d.ts +0 -5
  609. package/packages/keq/dist/exception/http-exceptions/service-unavailable.exception.d.ts.map +0 -1
  610. package/packages/keq/dist/exception/http-exceptions/too-many-requests.exception.d.ts +0 -5
  611. package/packages/keq/dist/exception/http-exceptions/too-many-requests.exception.d.ts.map +0 -1
  612. package/packages/keq/dist/exception/http-exceptions/unauthorized.exception.d.ts +0 -5
  613. package/packages/keq/dist/exception/http-exceptions/unauthorized.exception.d.ts.map +0 -1
  614. package/packages/keq/dist/exception/http-exceptions/unsupported-media-type.exception.d.ts +0 -5
  615. package/packages/keq/dist/exception/http-exceptions/unsupported-media-type.exception.d.ts.map +0 -1
  616. package/packages/keq/dist/exception/http-exceptions/uri-too-long.exception.d.ts +0 -5
  617. package/packages/keq/dist/exception/http-exceptions/uri-too-long.exception.d.ts.map +0 -1
  618. package/packages/keq/dist/exception/index.d.ts +0 -6
  619. package/packages/keq/dist/exception/index.d.ts.map +0 -1
  620. package/packages/keq/dist/exception/timeout.exception.d.ts +0 -5
  621. package/packages/keq/dist/exception/timeout.exception.d.ts.map +0 -1
  622. package/packages/keq/dist/exception/type.exception.d.ts +0 -5
  623. package/packages/keq/dist/exception/type.exception.d.ts.map +0 -1
  624. package/packages/keq/dist/index.d.ts +0 -8
  625. package/packages/keq/dist/index.d.ts.map +0 -1
  626. package/packages/keq/dist/index.js +0 -1991
  627. package/packages/keq/dist/index.js.map +0 -1
  628. package/packages/keq/dist/index.mjs +0 -1960
  629. package/packages/keq/dist/index.mjs.map +0 -1
  630. package/packages/keq/dist/middleware/index.d.ts +0 -3
  631. package/packages/keq/dist/middleware/index.d.ts.map +0 -1
  632. package/packages/keq/dist/middleware/types/index.d.ts +0 -3
  633. package/packages/keq/dist/middleware/types/index.d.ts.map +0 -1
  634. package/packages/keq/dist/middleware/types/keq-middleware.d.ts +0 -8
  635. package/packages/keq/dist/middleware/types/keq-middleware.d.ts.map +0 -1
  636. package/packages/keq/dist/middleware/types/keq-next.d.ts +0 -2
  637. package/packages/keq/dist/middleware/types/keq-next.d.ts.map +0 -1
  638. package/packages/keq/dist/middleware/utils/compose-middleware.d.ts +0 -7
  639. package/packages/keq/dist/middleware/utils/compose-middleware.d.ts.map +0 -1
  640. package/packages/keq/dist/middleware/utils/get-middleware-name.d.ts +0 -3
  641. package/packages/keq/dist/middleware/utils/get-middleware-name.d.ts.map +0 -1
  642. package/packages/keq/dist/middleware/utils/index.d.ts +0 -3
  643. package/packages/keq/dist/middleware/utils/index.d.ts.map +0 -1
  644. package/packages/keq/dist/middlewares/fetch-middleware/index.d.ts +0 -6
  645. package/packages/keq/dist/middlewares/fetch-middleware/index.d.ts.map +0 -1
  646. package/packages/keq/dist/middlewares/flow-control-middleware/abort-flow-control-middleware.d.ts +0 -3
  647. package/packages/keq/dist/middlewares/flow-control-middleware/abort-flow-control-middleware.d.ts.map +0 -1
  648. package/packages/keq/dist/middlewares/flow-control-middleware/index.d.ts +0 -4
  649. package/packages/keq/dist/middlewares/flow-control-middleware/index.d.ts.map +0 -1
  650. package/packages/keq/dist/middlewares/flow-control-middleware/serial-flow-control-middleware.d.ts +0 -3
  651. package/packages/keq/dist/middlewares/flow-control-middleware/serial-flow-control-middleware.d.ts.map +0 -1
  652. package/packages/keq/dist/middlewares/flow-control-middleware/types/keq-flow-control.d.ts +0 -9
  653. package/packages/keq/dist/middlewares/flow-control-middleware/types/keq-flow-control.d.ts.map +0 -1
  654. package/packages/keq/dist/middlewares/index.d.ts +0 -4
  655. package/packages/keq/dist/middlewares/index.d.ts.map +0 -1
  656. package/packages/keq/dist/middlewares/timeout-middleware/index.d.ts +0 -6
  657. package/packages/keq/dist/middlewares/timeout-middleware/index.d.ts.map +0 -1
  658. package/packages/keq/dist/orchestrator/executor.d.ts +0 -13
  659. package/packages/keq/dist/orchestrator/executor.d.ts.map +0 -1
  660. package/packages/keq/dist/orchestrator/index.d.ts +0 -3
  661. package/packages/keq/dist/orchestrator/index.d.ts.map +0 -1
  662. package/packages/keq/dist/orchestrator/orchestrator.d.ts +0 -25
  663. package/packages/keq/dist/orchestrator/orchestrator.d.ts.map +0 -1
  664. package/packages/keq/dist/request/core.d.ts +0 -48
  665. package/packages/keq/dist/request/core.d.ts.map +0 -1
  666. package/packages/keq/dist/request/create-request.d.ts +0 -7
  667. package/packages/keq/dist/request/create-request.d.ts.map +0 -1
  668. package/packages/keq/dist/request/index.d.ts +0 -6
  669. package/packages/keq/dist/request/index.d.ts.map +0 -1
  670. package/packages/keq/dist/request/keq.d.ts +0 -120
  671. package/packages/keq/dist/request/keq.d.ts.map +0 -1
  672. package/packages/keq/dist/request/request.d.ts +0 -79
  673. package/packages/keq/dist/request/request.d.ts.map +0 -1
  674. package/packages/keq/dist/request/types/api-schema/api-schema-select.d.ts +0 -42
  675. package/packages/keq/dist/request/types/api-schema/api-schema-select.d.ts.map +0 -1
  676. package/packages/keq/dist/request/types/api-schema/api-schema.d.ts +0 -8
  677. package/packages/keq/dist/request/types/api-schema/api-schema.d.ts.map +0 -1
  678. package/packages/keq/dist/request/types/api-schema/default-operation.d.ts +0 -18
  679. package/packages/keq/dist/request/types/api-schema/default-operation.d.ts.map +0 -1
  680. package/packages/keq/dist/request/types/api-schema/extract-method-operations.d.ts +0 -31
  681. package/packages/keq/dist/request/types/api-schema/extract-method-operations.d.ts.map +0 -1
  682. package/packages/keq/dist/request/types/api-schema/index.d.ts +0 -6
  683. package/packages/keq/dist/request/types/api-schema/index.d.ts.map +0 -1
  684. package/packages/keq/dist/request/types/api-schema/operation.d.ts +0 -17
  685. package/packages/keq/dist/request/types/api-schema/operation.d.ts.map +0 -1
  686. package/packages/keq/dist/request/types/content-type.d.ts +0 -3
  687. package/packages/keq/dist/request/types/content-type.d.ts.map +0 -1
  688. package/packages/keq/dist/request/types/index.d.ts +0 -8
  689. package/packages/keq/dist/request/types/index.d.ts.map +0 -1
  690. package/packages/keq/dist/request/types/keq-attachable-file.d.ts +0 -2
  691. package/packages/keq/dist/request/types/keq-attachable-file.d.ts.map +0 -1
  692. package/packages/keq/dist/request/types/keq-param-value.d.ts +0 -3
  693. package/packages/keq/dist/request/types/keq-param-value.d.ts.map +0 -1
  694. package/packages/keq/dist/request/types/keq-query-options.d.ts +0 -7
  695. package/packages/keq/dist/request/types/keq-query-options.d.ts.map +0 -1
  696. package/packages/keq/dist/request/types/keq-query-value.d.ts +0 -8
  697. package/packages/keq/dist/request/types/keq-query-value.d.ts.map +0 -1
  698. package/packages/keq/dist/request/types/server-sent-event.d.ts +0 -3
  699. package/packages/keq/dist/request/types/server-sent-event.d.ts.map +0 -1
  700. package/packages/keq/dist/request/utils/fix-content-type.d.ts +0 -4
  701. package/packages/keq/dist/request/utils/fix-content-type.d.ts.map +0 -1
  702. package/packages/keq/dist/request/utils/get-location-id.d.ts +0 -2
  703. package/packages/keq/dist/request/utils/get-location-id.d.ts.map +0 -1
  704. package/packages/keq/dist/request/utils/index.d.ts +0 -7
  705. package/packages/keq/dist/request/utils/index.d.ts.map +0 -1
  706. package/packages/keq/dist/request/utils/intelligent-parse-response.d.ts +0 -2
  707. package/packages/keq/dist/request/utils/intelligent-parse-response.d.ts.map +0 -1
  708. package/packages/keq/dist/request/utils/merge-keq-request-body.d.ts +0 -3
  709. package/packages/keq/dist/request/utils/merge-keq-request-body.d.ts.map +0 -1
  710. package/packages/keq/dist/request/utils/query-stringify.d.ts +0 -3
  711. package/packages/keq/dist/request/utils/query-stringify.d.ts.map +0 -1
  712. package/packages/keq/dist/request/utils/resolve-with.d.ts +0 -3
  713. package/packages/keq/dist/request/utils/resolve-with.d.ts.map +0 -1
  714. package/packages/keq/dist/request-init/index.d.ts +0 -4
  715. package/packages/keq/dist/request-init/index.d.ts.map +0 -1
  716. package/packages/keq/dist/request-init/request-init.d.ts +0 -42
  717. package/packages/keq/dist/request-init/request-init.d.ts.map +0 -1
  718. package/packages/keq/dist/request-init/types/index.d.ts +0 -3
  719. package/packages/keq/dist/request-init/types/index.d.ts.map +0 -1
  720. package/packages/keq/dist/request-init/types/keq-body-init.d.ts +0 -2
  721. package/packages/keq/dist/request-init/types/keq-body-init.d.ts.map +0 -1
  722. package/packages/keq/dist/request-init/types/keq-request-method.d.ts +0 -2
  723. package/packages/keq/dist/request-init/types/keq-request-method.d.ts.map +0 -1
  724. package/packages/keq/dist/request-init/utils/assign-request-init.d.ts +0 -3
  725. package/packages/keq/dist/request-init/utils/assign-request-init.d.ts.map +0 -1
  726. package/packages/keq/dist/request-init/utils/clone-body.d.ts +0 -2
  727. package/packages/keq/dist/request-init/utils/clone-body.d.ts.map +0 -1
  728. package/packages/keq/dist/request-init/utils/clone-headers.d.ts +0 -2
  729. package/packages/keq/dist/request-init/utils/clone-headers.d.ts.map +0 -1
  730. package/packages/keq/dist/request-init/utils/clone-request-init.d.ts +0 -3
  731. package/packages/keq/dist/request-init/utils/clone-request-init.d.ts.map +0 -1
  732. package/packages/keq/dist/request-init/utils/compile-url.d.ts +0 -3
  733. package/packages/keq/dist/request-init/utils/compile-url.d.ts.map +0 -1
  734. package/packages/keq/dist/request-init/utils/index.d.ts +0 -7
  735. package/packages/keq/dist/request-init/utils/index.d.ts.map +0 -1
  736. package/packages/keq/dist/request-init/utils/to-form-data.d.ts +0 -2
  737. package/packages/keq/dist/request-init/utils/to-form-data.d.ts.map +0 -1
  738. package/packages/keq/dist/request-init/utils/to-url-search-params.d.ts +0 -2
  739. package/packages/keq/dist/request-init/utils/to-url-search-params.d.ts.map +0 -1
  740. package/packages/keq/dist/router/index.d.ts +0 -4
  741. package/packages/keq/dist/router/index.d.ts.map +0 -1
  742. package/packages/keq/dist/router/keq-host-route.d.ts +0 -3
  743. package/packages/keq/dist/router/keq-host-route.d.ts.map +0 -1
  744. package/packages/keq/dist/router/keq-location-route.d.ts +0 -3
  745. package/packages/keq/dist/router/keq-location-route.d.ts.map +0 -1
  746. package/packages/keq/dist/router/keq-method-route.d.ts +0 -3
  747. package/packages/keq/dist/router/keq-method-route.d.ts.map +0 -1
  748. package/packages/keq/dist/router/keq-module-route.d.ts +0 -3
  749. package/packages/keq/dist/router/keq-module-route.d.ts.map +0 -1
  750. package/packages/keq/dist/router/keq-pathname-route.d.ts +0 -3
  751. package/packages/keq/dist/router/keq-pathname-route.d.ts.map +0 -1
  752. package/packages/keq/dist/router/keq-router.d.ts +0 -32
  753. package/packages/keq/dist/router/keq-router.d.ts.map +0 -1
  754. package/packages/keq/dist/router/types/index.d.ts +0 -2
  755. package/packages/keq/dist/router/types/index.d.ts.map +0 -1
  756. package/packages/keq/dist/router/types/keq-route.d.ts +0 -7
  757. package/packages/keq/dist/router/types/keq-route.d.ts.map +0 -1
  758. package/packages/keq/dist/router/utils/compose-route.d.ts +0 -3
  759. package/packages/keq/dist/router/utils/compose-route.d.ts.map +0 -1
  760. package/packages/keq/dist/router/utils/index.d.ts +0 -2
  761. package/packages/keq/dist/router/utils/index.d.ts.map +0 -1
  762. package/packages/keq/dist/types/enabled-if-string-index.d.ts +0 -24
  763. package/packages/keq/dist/types/enabled-if-string-index.d.ts.map +0 -1
  764. package/packages/keq/dist/types/exclude-unknown-properties.d.ts +0 -19
  765. package/packages/keq/dist/types/exclude-unknown-properties.d.ts.map +0 -1
  766. package/packages/keq/dist/types/index-keys.d.ts +0 -18
  767. package/packages/keq/dist/types/index-keys.d.ts.map +0 -1
  768. package/packages/keq/dist/types/index.d.ts +0 -7
  769. package/packages/keq/dist/types/index.d.ts.map +0 -1
  770. package/packages/keq/dist/types/literal-keys.d.ts +0 -18
  771. package/packages/keq/dist/types/literal-keys.d.ts.map +0 -1
  772. package/packages/keq/dist/types/loose-nested-like.d.ts +0 -11
  773. package/packages/keq/dist/types/loose-nested-like.d.ts.map +0 -1
  774. package/packages/keq/dist/types/string-index-value-of.d.ts +0 -18
  775. package/packages/keq/dist/types/string-index-value-of.d.ts.map +0 -1
  776. package/packages/keq/dist/utils/base64.d.ts +0 -3
  777. package/packages/keq/dist/utils/base64.d.ts.map +0 -1
  778. package/packages/keq/dist/utils/index.d.ts +0 -4
  779. package/packages/keq/dist/utils/index.d.ts.map +0 -1
  780. package/packages/keq/dist/utils/shallow-clone.d.ts +0 -5
  781. package/packages/keq/dist/utils/shallow-clone.d.ts.map +0 -1
  782. package/packages/keq/dist/utils/sleep.d.ts +0 -2
  783. package/packages/keq/dist/utils/sleep.d.ts.map +0 -1
  784. package/packages/keq/dist/validator/index.d.ts +0 -2
  785. package/packages/keq/dist/validator/index.d.ts.map +0 -1
  786. package/packages/keq/dist/validator/validator.d.ts +0 -65
  787. package/packages/keq/dist/validator/validator.d.ts.map +0 -1
  788. package/packages/nestjs/.turbo/turbo-build.log +0 -14
  789. package/packages/nestjs/dist/index.d.ts +0 -3
  790. package/packages/nestjs/dist/index.d.ts.map +0 -1
  791. package/packages/nestjs/dist/index.js +0 -70
  792. package/packages/nestjs/dist/index.js.map +0 -1
  793. package/packages/nestjs/dist/index.mjs +0 -45
  794. package/packages/nestjs/dist/index.mjs.map +0 -1
  795. package/packages/nestjs/dist/keq.module-definition.d.ts +0 -3
  796. package/packages/nestjs/dist/keq.module-definition.d.ts.map +0 -1
  797. package/packages/nestjs/dist/keq.module.d.ts +0 -7
  798. package/packages/nestjs/dist/keq.module.d.ts.map +0 -1
  799. package/packages/nestjs/dist/types/index.d.ts +0 -2
  800. package/packages/nestjs/dist/types/index.d.ts.map +0 -1
  801. package/packages/nestjs/dist/types/keq-module-options.d.ts +0 -5
  802. package/packages/nestjs/dist/types/keq-module-options.d.ts.map +0 -1
  803. package/packages/test/.turbo/turbo-build.log +0 -6
  804. package/packages/url/.turbo/turbo-build.log +0 -21
  805. package/packages/url/dist/index.d.ts +0 -5
  806. package/packages/url/dist/index.d.ts.map +0 -1
  807. package/packages/url/dist/index.js +0 -67
  808. package/packages/url/dist/index.js.map +0 -1
  809. package/packages/url/dist/index.mjs +0 -46
  810. package/packages/url/dist/index.mjs.map +0 -1
@@ -1,2968 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- var __create = Object.create;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
- var __getOwnPropNames = Object.getOwnPropertyNames;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
18
- // If the importer is in node compatibility mode or this is not an ESM
19
- // file that has been converted to a CommonJS file using a Babel-
20
- // compatible transform (i.e. "__esModule" has not been set), then set
21
- // "default" to the CommonJS "module.exports" for node compatibility.
22
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
23
- mod
24
- ));
25
-
26
- // src/cli.ts
27
- var import_semver = __toESM(require("semver"), 1);
28
- var import_commander = require("commander");
29
-
30
- // src/constants/supported-methods.ts
31
- var SupportedMethods = [
32
- "get",
33
- "post",
34
- "put",
35
- "delete",
36
- "patch",
37
- "head",
38
- "options"
39
- ];
40
-
41
- // src/utils/logger.ts
42
- var import_chalk = __toESM(require("chalk"), 1);
43
- var logger = {
44
- log: (str) => console.log(import_chalk.default.green(str)),
45
- warn: (str) => console.warn(import_chalk.default.yellow(str)),
46
- error: (str) => console.error(import_chalk.default.red(str))
47
- };
48
-
49
- // src/compiler/compiler.ts
50
- var import_listr22 = require("listr2");
51
- var import_tapable4 = require("tapable");
52
-
53
- // src/compiler/tasks/setup/index.ts
54
- var import_fs_extra2 = __toESM(require("fs-extra"), 1);
55
- var import_path = __toESM(require("path"), 1);
56
- var import_cosmiconfig = require("cosmiconfig");
57
-
58
- // src/utils/ignore-matcher.ts
59
- var R = __toESM(require("ramda"), 1);
60
- var import_fs_extra = __toESM(require("fs-extra"), 1);
61
- var IgnoreMatcher = class _IgnoreMatcher {
62
- rules;
63
- constructor(rules) {
64
- this.rules = rules;
65
- }
66
- static async read(filepath) {
67
- let content = await import_fs_extra.default.readFile(filepath, "utf-8");
68
- content = content.replace(/\r\n/g, "\n").replace(/\r/g, "\n").replace(/#.*$/gm, "").replace(/\n+/g, "\n").trim();
69
- let rules = content.split("\n").map((line) => line.trim()).filter((line) => line.length > 0).map((line) => {
70
- const matched = line.match(/^(!)?\s*([^\s/]+)\s+([^\s/]+)\s+([^\s]+)$/);
71
- if (!matched) throw new Error(`Invalid ignore rule: "${line}"`);
72
- const [, flag, moduleName, operationMethod, operationPathname] = matched;
73
- return {
74
- persist: true,
75
- ignore: !flag,
76
- moduleName,
77
- operationMethod: operationMethod.toLowerCase(),
78
- operationPathname
79
- };
80
- });
81
- rules = R.sortBy(
82
- R.prop("ignore"),
83
- rules
84
- );
85
- rules = R.uniqWith(
86
- (a, b) => a.moduleName === b.moduleName && a.operationMethod === b.operationMethod && a.operationPathname === b.operationPathname,
87
- rules
88
- );
89
- return new _IgnoreMatcher(rules);
90
- }
91
- async write(filepath) {
92
- const ruleGroups = R.compose(
93
- R.groupBy((rule) => rule.moduleName),
94
- R.reverse,
95
- R.uniqWith(
96
- (a, b) => a.moduleName === b.moduleName && a.operationMethod === b.operationMethod && a.operationPathname === b.operationPathname
97
- ),
98
- R.filter((rule) => rule.persist)
99
- )(this.rules);
100
- const content = Object.entries(ruleGroups).sort((a, b) => {
101
- const aModuleName = a[0];
102
- const bModuleName = b[0];
103
- if (aModuleName === "*") return -1;
104
- if (bModuleName === "*") return 1;
105
- return aModuleName.localeCompare(bModuleName);
106
- }).map(([, rules]) => (rules || []).sort((a, b) => {
107
- if (a.ignore !== b.ignore) return a.ignore ? -1 : 1;
108
- if (a.operationMethod === "*") return -1;
109
- if (b.operationMethod === "*") return 1;
110
- if (a.operationPathname === "*") return -1;
111
- if (b.operationPathname === "*") return 1;
112
- if (a.operationMethod !== b.operationMethod) return a.operationMethod.localeCompare(b.operationMethod);
113
- if (a.operationPathname !== b.operationPathname) return a.operationPathname.localeCompare(b.operationPathname);
114
- return 0;
115
- }).map((rule) => `${rule.ignore ? "" : "! "}${rule.moduleName} ${rule.operationMethod.toUpperCase()} ${rule.operationPathname}`).join("\n")).join("\n\n");
116
- await import_fs_extra.default.writeFile(filepath, content, "utf-8");
117
- }
118
- append(rule) {
119
- this.rules.unshift(rule);
120
- }
121
- // if operation is ignored, return true
122
- isOperationIgnored(operationDefinition) {
123
- const moduleName = operationDefinition.module.name;
124
- const operationMethod = operationDefinition.method.toLowerCase();
125
- const operationPathname = operationDefinition.pathname;
126
- for (const rule of this.rules) {
127
- if (rule.moduleName !== "*" && rule.moduleName !== moduleName) continue;
128
- if (rule.operationMethod !== "*" && rule.operationMethod !== operationMethod) continue;
129
- if (rule.operationPathname !== "*" && rule.operationPathname !== operationPathname) continue;
130
- return rule.ignore;
131
- }
132
- return false;
133
- }
134
- isModuleIgnored(moduleDefinition) {
135
- const moduleName = moduleDefinition.name;
136
- for (const rule of this.rules) {
137
- if (!rule.ignore) {
138
- if (rule.moduleName === "*" || rule.moduleName === moduleName) return false;
139
- continue;
140
- }
141
- if (rule.operationMethod !== "*") continue;
142
- if (rule.operationPathname !== "*") continue;
143
- if (rule.moduleName === "*" || rule.moduleName === moduleName) return true;
144
- }
145
- return false;
146
- }
147
- };
148
-
149
- // src/compiler/tasks/setup/utils/find-nearest-package-json.ts
150
- var import_node_fs = __toESM(require("fs"), 1);
151
- var import_node_path = __toESM(require("path"), 1);
152
- function findNearestPackageJson(startDir = process.cwd()) {
153
- let dir = startDir;
154
- while (true) {
155
- const pkgPath = import_node_path.default.join(dir, "package.json");
156
- if (import_node_fs.default.existsSync(pkgPath)) {
157
- const json = JSON.parse(import_node_fs.default.readFileSync(pkgPath, "utf8"));
158
- return { json, path: pkgPath };
159
- }
160
- const parent = import_node_path.default.dirname(dir);
161
- if (parent === dir) break;
162
- dir = parent;
163
- }
164
- return null;
165
- }
166
-
167
- // src/compiler/tasks/setup/utils/get-project-module-system.ts
168
- function getProjectModuleSystem(pkgInfo) {
169
- if (!pkgInfo?.json) return "cjs";
170
- const { json } = pkgInfo;
171
- if (json.type === "module") return "esm";
172
- return "cjs";
173
- }
174
-
175
- // src/compiler/tasks/setup/utils/parse-runtime-config.ts
176
- var import_value = require("@sinclair/typebox/value");
177
-
178
- // src/types/address.ts
179
- var import_typebox = require("@sinclair/typebox");
180
- var Address = import_typebox.Type.Object({
181
- url: import_typebox.Type.String(),
182
- headers: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.String(), { default: {} })),
183
- encoding: import_typebox.Type.Optional(
184
- import_typebox.Type.Union([
185
- import_typebox.Type.Literal("utf8"),
186
- import_typebox.Type.Literal("ascii")
187
- ], { default: "utf8" })
188
- )
189
- });
190
-
191
- // src/types/runtime-config.ts
192
- var R2 = __toESM(require("ramda"), 1);
193
- var import_typebox2 = require("@sinclair/typebox");
194
-
195
- // src/constants/file-naming-style.ts
196
- var FileNamingStyle = /* @__PURE__ */ ((FileNamingStyle2) => {
197
- FileNamingStyle2["camelCase"] = "camelCase";
198
- FileNamingStyle2["capitalCase"] = "capitalCase";
199
- FileNamingStyle2["constantCase"] = "constantCase";
200
- FileNamingStyle2["dotCase"] = "dotCase";
201
- FileNamingStyle2["headerCase"] = "headerCase";
202
- FileNamingStyle2["noCase"] = "noCase";
203
- FileNamingStyle2["paramCase"] = "paramCase";
204
- FileNamingStyle2["pascalCase"] = "pascalCase";
205
- FileNamingStyle2["pathCase"] = "pathCase";
206
- FileNamingStyle2["sentenceCase"] = "sentenceCase";
207
- FileNamingStyle2["snakeCase"] = "snakeCase";
208
- return FileNamingStyle2;
209
- })(FileNamingStyle || {});
210
-
211
- // src/utils/is-valid-url.ts
212
- var URL_REGEX = /^[a-zA-Z][a-zA-Z0-9+.-]*:\/\/(?:[^\s@]+@)?[^\s/:?#]*(?::\d+)?(?:\/[^\s?#]*)?(?:\?[^\s#]*)?(?:#[^\s]*)?$/;
213
- function isValidURL(url) {
214
- return URL_REGEX.test(url);
215
- }
216
-
217
- // src/types/runtime-config.ts
218
- var Modules = import_typebox2.Type.Transform(
219
- import_typebox2.Type.Record(
220
- import_typebox2.Type.String(),
221
- import_typebox2.Type.Union([import_typebox2.Type.String(), Address])
222
- )
223
- ).Decode((value) => {
224
- const keys2 = Object.keys(value);
225
- for (const key of keys2) {
226
- if (!/^[A-Za-z_][A-Za-z0-9_$]*$/.test(key)) {
227
- throw new Error(`Module name "${key}" is not valid. It must start with a letter or underscore, and can only contain letters, numbers, and underscores.`);
228
- }
229
- }
230
- const keysGroupByLowerCase = R2.groupBy(R2.toLower, keys2);
231
- for (const groupKey in keysGroupByLowerCase) {
232
- const keys3 = keysGroupByLowerCase[groupKey] || [];
233
- if (keys3.length > 1) {
234
- throw new Error(`Module names ${keys3.map((name) => `"${name}"`).join(", ")} are case-insensitively duplicated.`);
235
- }
236
- }
237
- for (const key in value) {
238
- const url = typeof value[key] === "string" ? value[key] : value[key].url;
239
- if (isValidURL(url)) continue;
240
- throw new Error(`The ${JSON.stringify(url)} of module "${key}" is not a valid URL.`);
241
- }
242
- return R2.map(
243
- (item) => typeof item !== "string" ? item : { url: item, headers: {}, encoding: "utf8" },
244
- value
245
- );
246
- }).Encode((value) => value);
247
- var RawConfig = import_typebox2.Type.Object({
248
- mode: import_typebox2.Type.Optional(
249
- import_typebox2.Type.Union([
250
- import_typebox2.Type.Literal("micro-function"),
251
- import_typebox2.Type.Literal("nestjs-module"),
252
- import_typebox2.Type.Literal("none")
253
- ], { default: "micro-function" })
254
- ),
255
- /**
256
- * Whether to generate ES Module code
257
- *
258
- * If not specified, the module system will be inferred from the nearest package.json "type" field
259
- * or defaults to "cjs" if no package.json is found.
260
- */
261
- esm: import_typebox2.Type.Optional(import_typebox2.Type.Boolean({ default: false })),
262
- /**
263
- * Output directory for generated files
264
- */
265
- outdir: import_typebox2.Type.String({ default: `${process.cwd()}/api` }),
266
- /**
267
- * File naming style for generated files
268
- */
269
- fileNamingStyle: import_typebox2.Type.Enum(FileNamingStyle, { default: "snakeCase" /* snakeCase */ }),
270
- modules: Modules,
271
- debug: import_typebox2.Type.Optional(import_typebox2.Type.Boolean({ default: false })),
272
- /**
273
- * Whether to tolerate wrong openapi/swagger structure
274
- */
275
- tolerant: import_typebox2.Type.Optional(import_typebox2.Type.Boolean({ default: false })),
276
- plugins: import_typebox2.Type.Optional(import_typebox2.Type.Array(import_typebox2.Type.Unsafe(import_typebox2.Type.Any()), { default: [] }))
277
- });
278
-
279
- // src/compiler/tasks/setup/utils/parse-runtime-config.ts
280
- function parseRuntimeConfig(data) {
281
- try {
282
- const originalPlugins = typeof data === "object" && data !== null && "plugins" in data ? data.plugins : void 0;
283
- const parsed = import_value.Value.Parse(RawConfig, data);
284
- if (originalPlugins !== void 0) {
285
- parsed.plugins = originalPlugins;
286
- }
287
- return parsed;
288
- } catch (error) {
289
- if (error instanceof Error) {
290
- error.message = `Invalid Config: ${error.message}`;
291
- }
292
- throw error;
293
- }
294
- }
295
-
296
- // src/compiler/tasks/setup/index.ts
297
- var explore = (0, import_cosmiconfig.cosmiconfig)("keq");
298
- function main(compiler, options) {
299
- return {
300
- task: async (context, task) => {
301
- const result = options?.config ? await explore.load(options.config) : await explore.search();
302
- if (!result || "isEmpty" in result && result.isEmpty) {
303
- throw new Error("Cannot find config file.");
304
- }
305
- const rc = parseRuntimeConfig(result.config);
306
- if (options?.debug) {
307
- await import_fs_extra2.default.ensureDir(".keq");
308
- rc.debug = true;
309
- }
310
- rc.tolerant = Boolean(rc.tolerant);
311
- const packageJsonInfo = findNearestPackageJson();
312
- if (packageJsonInfo) {
313
- const moduleSystem = getProjectModuleSystem(packageJsonInfo);
314
- rc.esm = moduleSystem === "esm";
315
- }
316
- context.rc = rc;
317
- let matcher = new IgnoreMatcher([]);
318
- if (result.filepath) {
319
- const ignoreFilepath = import_path.default.resolve(import_path.default.dirname(result.filepath), ".keqignore");
320
- if (await import_fs_extra2.default.exists(ignoreFilepath)) {
321
- matcher = await IgnoreMatcher.read(ignoreFilepath);
322
- }
323
- }
324
- const ignoreRules = options.ignore === false ? [] : options.ignore?.rules || [];
325
- for (const rule of ignoreRules) {
326
- matcher.append({
327
- persist: !!rule.persist,
328
- ignore: rule.ignore,
329
- moduleName: rule.moduleName,
330
- operationMethod: rule.operationMethod,
331
- operationPathname: rule.operationPathname
332
- });
333
- }
334
- context.matcher = matcher;
335
- await compiler.hooks.setup.promise(task);
336
- }
337
- };
338
- }
339
- function createSetupTask(compiler, options) {
340
- return {
341
- title: "Setup",
342
- enabled: options?.enabled,
343
- skip: options?.skip,
344
- task: (context, task) => task.newListr(
345
- [
346
- main(compiler, options),
347
- {
348
- task: (context2, task2) => compiler.hooks.afterSetup.promise(task2)
349
- }
350
- ],
351
- {
352
- concurrent: false
353
- }
354
- )
355
- };
356
- }
357
-
358
- // src/compiler/tasks/download/index.ts
359
- var import_listr2 = require("listr2");
360
- var import_openapi_parser2 = require("@scalar/openapi-parser");
361
-
362
- // src/models/artifact.ts
363
- var path3 = __toESM(require("path"), 1);
364
-
365
- // src/models/anchor.ts
366
- var AnchorBlock = class {
367
- constructor(artifact) {
368
- this.artifact = artifact;
369
- }
370
- /**
371
- * Append content to the end of the anchor block.
372
- */
373
- append(anchorName, content) {
374
- const lines = this.artifact.content.split("\n");
375
- const anchor = `@anchor:${anchorName}:end`;
376
- const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
377
- if (anchorIndex === -1) {
378
- throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
379
- }
380
- lines.splice(anchorIndex, 0, content);
381
- this.artifact.content = lines.join("\n");
382
- }
383
- prepend(anchorName, content) {
384
- const lines = this.artifact.content.split("\n");
385
- const anchor = `@anchor:${anchorName}:start`;
386
- const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
387
- if (anchorIndex === -1) {
388
- throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
389
- }
390
- lines.splice(anchorIndex + 1, 0, content);
391
- this.artifact.content = lines.join("\n");
392
- }
393
- replace(anchorName, content) {
394
- const lines = this.artifact.content.split("\n");
395
- const startIndex = lines.findIndex((line) => line.includes(`/* @anchor:${anchorName}:start */`));
396
- const endIndex = lines.findIndex((line) => line.includes(`/* @anchor:${anchorName}:end */`));
397
- if (startIndex === -1 || endIndex === -1 || endIndex <= startIndex) {
398
- throw new Error(`"@anchor:${anchorName}:start" or "@anchor:${anchorName}:end" not found in artifact "${this.artifact.filepath}".`);
399
- }
400
- lines.splice(startIndex + 1, endIndex - startIndex - 1, content);
401
- this.artifact.content = lines.join("\n");
402
- }
403
- };
404
- var Anchor = class {
405
- constructor(artifact) {
406
- this.artifact = artifact;
407
- this.block = new AnchorBlock(artifact);
408
- }
409
- block;
410
- append(anchorName, content) {
411
- const lines = this.artifact.content.split("\n");
412
- const anchor = `@anchor:${anchorName}`;
413
- const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
414
- if (anchorIndex === -1) {
415
- throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
416
- }
417
- lines.splice(anchorIndex + 1, 0, content);
418
- this.artifact.content = lines.join("\n");
419
- }
420
- prepend(anchorName, content) {
421
- const lines = this.artifact.content.split("\n");
422
- const anchor = `@anchor:${anchorName}`;
423
- const anchorIndex = lines.findIndex((line) => line.includes(`/* ${anchor} */`));
424
- if (anchorIndex === -1) {
425
- throw new Error(`"${anchor}" not found in artifact "${this.artifact.filepath}".`);
426
- }
427
- lines.splice(anchorIndex, 0, content);
428
- this.artifact.content = lines.join("\n");
429
- }
430
- };
431
-
432
- // src/models/artifact.ts
433
- var HeaderComment = [
434
- "// Code generated by keq-cli. DO NOT EDIT.",
435
- "// Code generated by keq-cli. DO NOT EDIT.",
436
- "// Code generated by keq-cli. DO NOT EDIT.",
437
- "",
438
- ""
439
- ].join("\n");
440
- var Artifact = class {
441
- id;
442
- filepath;
443
- content;
444
- extensionName;
445
- anchor = new Anchor(this);
446
- constructor(options) {
447
- this.id = options.id;
448
- this.filepath = options.filepath;
449
- this.extensionName = options.extensionName || path3.extname(options.filepath);
450
- this.content = options.content;
451
- }
452
- get dirname() {
453
- return path3.dirname(this.filepath);
454
- }
455
- renderer() {
456
- return `${HeaderComment}${this.content}`;
457
- }
458
- };
459
-
460
- // src/models/api-document_v3_1.ts
461
- var R5 = __toESM(require("ramda"), 1);
462
-
463
- // src/models/module-definition.ts
464
- var ModuleDefinition = class _ModuleDefinition {
465
- name;
466
- address;
467
- constructor(name, address) {
468
- this.name = name;
469
- if (typeof address === "string") {
470
- this.address = { url: address, headers: {}, encoding: "utf8" };
471
- } else {
472
- this.address = address;
473
- }
474
- }
475
- static unknown() {
476
- return new _ModuleDefinition("", { url: "", headers: {}, encoding: "utf8" });
477
- }
478
- };
479
-
480
- // src/models/operation-definition.ts
481
- var R4 = __toESM(require("ramda"), 1);
482
-
483
- // src/utils/is-keywords.ts
484
- var keywords = [
485
- "break",
486
- "case",
487
- "catch",
488
- "continue",
489
- "default",
490
- "delete",
491
- "do",
492
- "else",
493
- "finally",
494
- "for",
495
- "function",
496
- "if",
497
- "in",
498
- "instanceof",
499
- "new",
500
- "return",
501
- "switch",
502
- "this",
503
- "throw",
504
- "try",
505
- "typeof",
506
- "var",
507
- "void",
508
- "while",
509
- "with"
510
- ];
511
- function isKeywords(str) {
512
- return keywords.includes(str);
513
- }
514
-
515
- // src/utils/is-reserved-word.ts
516
- var reservedWords = [
517
- "abstract",
518
- "boolean",
519
- "byte",
520
- "char",
521
- "class",
522
- "const",
523
- "debugger",
524
- "double",
525
- "enum",
526
- "export",
527
- "extends",
528
- "final",
529
- "float",
530
- "goto",
531
- "implements",
532
- "import",
533
- "int",
534
- "interface",
535
- "long",
536
- "native",
537
- "package",
538
- "private",
539
- "protected",
540
- "public",
541
- "short",
542
- "static",
543
- "super",
544
- "synchronized",
545
- "throws",
546
- "transient",
547
- "volatile"
548
- ];
549
- function isReservedWord(str) {
550
- return reservedWords.includes(str);
551
- }
552
-
553
- // src/models/operation-definition.ts
554
- var import_jsonpath_plus2 = require("jsonpath-plus");
555
-
556
- // src/models/schema-definition.ts
557
- var R3 = __toESM(require("ramda"), 1);
558
- var import_jsonpath_plus = require("jsonpath-plus");
559
- var SchemaDefinition = class _SchemaDefinition {
560
- name;
561
- schema;
562
- module;
563
- document;
564
- get id() {
565
- return `${this.module.address}#/components/schemas/${this.name}`;
566
- }
567
- constructor(args) {
568
- this.module = args.module;
569
- this.name = args.name;
570
- this.schema = args.schema;
571
- this.document = args.document;
572
- }
573
- getDependencies() {
574
- const refs = R3.uniq((0, import_jsonpath_plus.JSONPath)({
575
- path: "$..*['$ref']",
576
- json: this.schema
577
- }));
578
- return refs.filter((ref) => typeof ref === "string" && !!ref.trim()).map((ref) => {
579
- const definition = this.document.dereference(ref);
580
- if (definition) return definition;
581
- return _SchemaDefinition.unknown();
582
- });
583
- }
584
- static unknown() {
585
- return new _SchemaDefinition({
586
- name: "",
587
- schema: {},
588
- module: ModuleDefinition.unknown(),
589
- document: ApiDocumentV3_1.unknown()
590
- });
591
- }
592
- static isUnknown(definition) {
593
- return definition.name === "";
594
- }
595
- };
596
-
597
- // src/models/operation-definition.ts
598
- var OperationDefinition = class {
599
- module;
600
- operationId;
601
- method;
602
- pathname;
603
- operation;
604
- document;
605
- get id() {
606
- return `${this.module.address}#/paths/${this.pathname}/${this.method}`;
607
- }
608
- constructor(args) {
609
- this.module = args.module;
610
- this.method = args.method.toLowerCase();
611
- this.pathname = args.pathname;
612
- this.document = args.document;
613
- this.operationId = this.formatOperationId(args.method, args.pathname, args.operation);
614
- this.operation = {
615
- ...args.operation,
616
- operationId: this.operationId
617
- };
618
- }
619
- formatOperationId(method, pathname, operation) {
620
- const operationId = operation.operationId;
621
- if (operationId && operationId !== "index" && !isKeywords(operationId) && !isReservedWord(operationId)) {
622
- return operationId;
623
- }
624
- return `${method}_${pathname}`.replace(/\//g, "_").replace(/-/g, "_").replace(/:/g, "$$").replace(/{(.+)}/, "$$$1");
625
- }
626
- getDependencies() {
627
- const refs = R4.uniq([
628
- ...(0, import_jsonpath_plus2.JSONPath)({
629
- path: "$.requestBody.content..schema..$ref",
630
- json: this.operation
631
- }),
632
- ...(0, import_jsonpath_plus2.JSONPath)({
633
- path: "$.responses..content..schema..$ref",
634
- json: this.operation
635
- }),
636
- ...(0, import_jsonpath_plus2.JSONPath)({
637
- path: "$.parameters..schema..$ref",
638
- json: this.operation
639
- })
640
- ]);
641
- const dependencies = refs.filter((ref) => typeof ref === "string" && ref).map((ref) => {
642
- const schemaDefinition = this.document.dereference(ref);
643
- if (schemaDefinition) return schemaDefinition;
644
- return SchemaDefinition.unknown();
645
- });
646
- return dependencies;
647
- }
648
- };
649
-
650
- // src/models/api-document_v3_1.ts
651
- var ApiDocumentV3_1 = class _ApiDocumentV3_1 {
652
- module;
653
- specification;
654
- constructor(specification, module2) {
655
- this.module = module2;
656
- this.specification = specification;
657
- }
658
- get schemas() {
659
- const module2 = this.module;
660
- return Object.entries(this.specification.components?.schemas || {}).map(([name, schema]) => new SchemaDefinition({
661
- name,
662
- schema,
663
- module: module2,
664
- document: this
665
- }));
666
- }
667
- get operations() {
668
- const module2 = this.module;
669
- return Object.entries(this.specification.paths || {}).flatMap(([pathname, pathItem]) => Object.entries(pathItem || {}).filter(([method]) => SupportedMethods.includes(method.toLowerCase())).map(([method, operation]) => new OperationDefinition({
670
- method,
671
- pathname,
672
- operation,
673
- module: module2,
674
- document: this
675
- })));
676
- }
677
- isEmpty() {
678
- return R5.isEmpty(this.specification.paths);
679
- }
680
- dereference($ref) {
681
- if ($ref.startsWith("#/")) {
682
- return this.schemas.find((schema) => schema.id.endsWith($ref));
683
- }
684
- logger.warn(`The $ref(${$ref}) is not defined in ${this.module.name} openapi/swagger.`);
685
- }
686
- isRefDefined($ref) {
687
- if ($ref.startsWith("#/")) {
688
- const path13 = $ref.replace("#/", "").split("/");
689
- return R5.path(path13, this.specification) !== void 0;
690
- }
691
- return false;
692
- }
693
- static unknown() {
694
- return new _ApiDocumentV3_1({}, ModuleDefinition.unknown());
695
- }
696
- };
697
-
698
- // src/models/asset.ts
699
- var Asset = class {
700
- path;
701
- constructor(path13) {
702
- this.path = path13;
703
- }
704
- };
705
-
706
- // src/exception.ts
707
- var import_ts_custom_error = require("ts-custom-error");
708
- var import_word_wrap = __toESM(require("word-wrap"), 1);
709
- var Exception = class extends import_ts_custom_error.CustomError {
710
- constructor(module2, message) {
711
- const moduleName = typeof module2 === "string" ? module2 : module2.name;
712
- const msg = (0, import_word_wrap.default)(message, { width: 60, indent: " " });
713
- super(`${moduleName} module failed to compile:
714
- ${msg}`);
715
- Object.defineProperty(this, "name", { value: "KeqCLI_Exception" });
716
- }
717
- };
718
-
719
- // src/utils/openapi-utils/dereference.ts
720
- function dereference($ref, swagger) {
721
- let value;
722
- for (const key of $ref.split("/")) {
723
- if (key === "#") {
724
- value = swagger;
725
- } else {
726
- value = value[key];
727
- }
728
- if (!value) break;
729
- }
730
- return value;
731
- }
732
-
733
- // src/utils/openapi-utils/dereference-operation.ts
734
- var R8 = __toESM(require("ramda"), 1);
735
- var import_jsonpointer2 = __toESM(require("jsonpointer"), 1);
736
- var import_jsonpath_plus4 = require("jsonpath-plus");
737
-
738
- // src/utils/openapi-utils/remove-undefined-ref.ts
739
- var R7 = __toESM(require("ramda"), 1);
740
- var import_jsonpointer = __toESM(require("jsonpointer"), 1);
741
- var import_jsonpath_plus3 = require("jsonpath-plus");
742
-
743
- // src/utils/openapi-utils/is-ref-defined.ts
744
- var R6 = __toESM(require("ramda"), 1);
745
- function isRefDefined($ref, swagger) {
746
- if ($ref.startsWith("#/")) {
747
- const path13 = $ref.replace("#/", "").split("/");
748
- return R6.path(path13, swagger) !== void 0;
749
- }
750
- return false;
751
- }
752
-
753
- // src/utils/openapi-utils/remove-undefined-ref.ts
754
- function removeUndefinedRef(swagger) {
755
- const shadow = R7.clone(swagger);
756
- const matches = (0, import_jsonpath_plus3.JSONPath)({
757
- path: "$..*['$ref']^",
758
- json: swagger,
759
- resultType: "all"
760
- });
761
- for (const match of matches) {
762
- if (match.value.$ref && !isRefDefined(match.value.$ref, swagger)) {
763
- import_jsonpointer.default.set(shadow, match.pointer, R7.omit(["$ref"], match.value));
764
- }
765
- }
766
- return shadow;
767
- }
768
-
769
- // src/utils/openapi-utils/dereference-operation.ts
770
- function dereferencePathObject(swagger) {
771
- const matches = (0, import_jsonpath_plus4.JSONPath)({
772
- path: "$.paths.*.$ref^",
773
- json: swagger,
774
- resultType: "all"
775
- });
776
- for (const match of matches) {
777
- const value = dereference(match.value.$ref, swagger);
778
- import_jsonpointer2.default.set(swagger, match.pointer, value);
779
- }
780
- }
781
- function dereferenceRequestBody(swagger) {
782
- const matches = (0, import_jsonpath_plus4.JSONPath)({
783
- path: "$.paths.*.*.requestBody.$ref^",
784
- json: swagger,
785
- resultType: "all"
786
- });
787
- for (const match of matches) {
788
- const value = dereference(match.value.$ref, swagger);
789
- import_jsonpointer2.default.set(swagger, match.pointer, value);
790
- }
791
- }
792
- function dereferenceResponses(swagger) {
793
- const matches = [
794
- ...(0, import_jsonpath_plus4.JSONPath)({
795
- path: "$.paths.*.*.responses.*.$ref^",
796
- json: swagger,
797
- resultType: "all"
798
- }),
799
- ...(0, import_jsonpath_plus4.JSONPath)({
800
- path: "$.paths.*.*.responses.*.headers.*.$ref^",
801
- json: swagger,
802
- resultType: "all"
803
- })
804
- ];
805
- for (const match of matches) {
806
- const value = dereference(match.value.$ref, swagger);
807
- import_jsonpointer2.default.set(swagger, match.pointer, value);
808
- }
809
- }
810
- function dereferenceParameters(swagger) {
811
- const matches = (0, import_jsonpath_plus4.JSONPath)({
812
- path: "$.paths.*.*.parameters.*.$ref^",
813
- json: swagger,
814
- resultType: "all"
815
- });
816
- for (const match of matches) {
817
- const value = dereference(match.value.$ref, swagger);
818
- import_jsonpointer2.default.set(swagger, match.pointer, value);
819
- }
820
- }
821
- function dereferenceOperation(swagger) {
822
- const shadow = R8.clone(swagger);
823
- dereferencePathObject(shadow);
824
- dereferenceRequestBody(shadow);
825
- dereferenceResponses(shadow);
826
- dereferenceParameters(shadow);
827
- return removeUndefinedRef(shadow);
828
- }
829
-
830
- // src/utils/json-schema-utils/is-array.ts
831
- function isArray(schema) {
832
- return schema.type === "array";
833
- }
834
-
835
- // src/utils/json-schema-utils/is-mixed.ts
836
- function isMixed(schema) {
837
- return Array.isArray(schema.type);
838
- }
839
-
840
- // src/utils/json-schema-utils/is-non-array.ts
841
- function isNonArray(schema) {
842
- return typeof schema.type === "string" && schema.type !== "array";
843
- }
844
-
845
- // src/utils/json-schema-utils/is-ref.ts
846
- function isRef(schema) {
847
- return "$ref" in schema;
848
- }
849
-
850
- // src/utils/json-schema-utils/index.ts
851
- var JsonSchemaUtils = class {
852
- static isRef = isRef;
853
- static isArray = isArray;
854
- static isNonArray = isNonArray;
855
- static isMixed = isMixed;
856
- };
857
-
858
- // src/utils/openapi-utils/dereference-deep.ts
859
- function dereferenceDeep($ref, swagger) {
860
- const stack = [$ref];
861
- let value;
862
- while (true) {
863
- const last2 = stack[stack.length - 1];
864
- value = dereference(last2, swagger);
865
- if (JsonSchemaUtils.isRef(value)) {
866
- if (!stack.includes(value.$ref)) {
867
- stack.push(value.$ref);
868
- continue;
869
- } else {
870
- throw new Error(`Circular reference detected: ${stack.join(" -> ")} -> ${value.$ref}`);
871
- }
872
- }
873
- break;
874
- }
875
- return value;
876
- }
877
-
878
- // src/utils/openapi-utils/to-3_1.ts
879
- var import_openapi_parser = require("@scalar/openapi-parser");
880
- function To3_1(openapi) {
881
- const { specification } = (0, import_openapi_parser.upgrade)(openapi);
882
- return specification;
883
- }
884
-
885
- // src/utils/openapi-utils/map-operation.ts
886
- var R9 = __toESM(require("ramda"), 1);
887
- function mapOperation(specification, mapper) {
888
- const shadow = R9.clone(specification);
889
- for (const [pathname, pathItem] of Object.entries(shadow.paths || {})) {
890
- for (const m in pathItem) {
891
- const method = m.toLowerCase();
892
- if (!SupportedMethods.includes(method)) continue;
893
- if (typeof pathItem[m] !== "object" || Array.isArray(pathItem[m]) || pathItem[m] === null) continue;
894
- const operation = pathItem[m];
895
- pathItem[m] = mapper(method, pathname, operation);
896
- }
897
- }
898
- return shadow;
899
- }
900
-
901
- // src/utils/openapi-utils/map-parameter.ts
902
- function mapParameter(specification, mapper) {
903
- return mapOperation(specification, (method, pathname, operation) => {
904
- if (!operation.parameters) return operation;
905
- operation.parameters = operation.parameters.map((parameter) => mapper(method, pathname, operation, parameter));
906
- return operation;
907
- });
908
- }
909
-
910
- // src/utils/openapi-utils/index.ts
911
- var OpenapiUtils = class {
912
- static isRefDefined = isRefDefined;
913
- static dereference = dereference;
914
- static dereferenceDeep = dereferenceDeep;
915
- static removeUndefinedRef = removeUndefinedRef;
916
- static dereferenceOperation = dereferenceOperation;
917
- static mapOperation = mapOperation;
918
- static mapParameter = mapParameter;
919
- // static updateOperationId = updateOperationId
920
- static to3_1 = To3_1;
921
- };
922
-
923
- // src/compiler/tasks/download/index.ts
924
- function main2(compiler, options) {
925
- return {
926
- task: (context, task) => {
927
- if (!context.rc || !context.matcher) {
928
- throw new Error("Please run setup task first.");
929
- }
930
- const rc = context.rc;
931
- const matcher = context.matcher;
932
- context.documents = [];
933
- return task.newListr(
934
- Object.entries(rc.modules).map(([moduleName, address]) => new ModuleDefinition(moduleName, address)).map((moduleDefinition) => ({
935
- title: moduleDefinition.name,
936
- task: async (ctx, task2) => {
937
- if (options?.skipIgnoredModules && matcher.isModuleIgnored(moduleDefinition)) {
938
- task2.skip(`(${moduleDefinition.name}) is ignored`);
939
- return;
940
- }
941
- task2.output = `Downloaded from ${moduleDefinition.address.url}`;
942
- const content = await compiler.hooks.download.promise(moduleDefinition.address, moduleDefinition, task2);
943
- if (!content) {
944
- throw new Exception(moduleDefinition, `Cannot download document from ${moduleDefinition.address.url}`);
945
- }
946
- const spec = JSON.parse(content);
947
- const { valid, errors } = await (0, import_openapi_parser2.validate)(spec);
948
- if (!valid) {
949
- const message = `${moduleDefinition.name} module openapi/swagger file does not conform to the openapi specifications or have grammatical errors, which may cause unexpected errors:
950
- ${errors?.map((e) => ` - ${e.message}`).join("\n")}`;
951
- task2.output = message;
952
- }
953
- OpenapiUtils.dereferenceOperation(spec);
954
- const document = new ApiDocumentV3_1(
955
- spec,
956
- moduleDefinition
957
- );
958
- ctx.documents?.push(document);
959
- }
960
- })),
961
- {
962
- concurrent: true,
963
- exitOnError: false,
964
- collectErrors: "minimal",
965
- rendererOptions: {
966
- collapseSubtasks: false,
967
- // collapseSkips: false,
968
- suffixSkips: true,
969
- timer: import_listr2.PRESET_TIMER
970
- }
971
- }
972
- );
973
- }
974
- };
975
- }
976
- function createDownloadTask(compiler, options) {
977
- return {
978
- title: "Download",
979
- enabled: options?.enabled,
980
- skip: options?.skip,
981
- task: (_, task) => task.newListr(
982
- [
983
- main2(compiler, options),
984
- {
985
- task: (context, task2) => compiler.hooks.afterDownload.promise(task2)
986
- }
987
- ],
988
- {
989
- concurrent: false
990
- }
991
- )
992
- };
993
- }
994
-
995
- // src/compiler/tasks/persist/index.ts
996
- var path6 = __toESM(require("path"), 1);
997
- var import_fs_extra3 = __toESM(require("fs-extra"), 1);
998
- function createPersistArtifactTask() {
999
- return {
1000
- title: "Write files",
1001
- task: async (context, task) => {
1002
- if (!context.rc) throw new Error("Please run setup task first.");
1003
- if (!context.artifacts || context.artifacts.length === 0) {
1004
- task.skip("No compiled artifacts to persist.");
1005
- return;
1006
- }
1007
- const rc = context.rc;
1008
- const artifacts = context.artifacts;
1009
- const total = artifacts.length;
1010
- let completed = 0;
1011
- const files = await Promise.all(artifacts.map(async (artifact) => {
1012
- const realpath = `./${path6.join(rc.outdir, artifact.filepath)}`;
1013
- await import_fs_extra3.default.ensureFile(realpath);
1014
- await import_fs_extra3.default.writeFile(realpath, artifact.renderer());
1015
- completed += 1;
1016
- task.output = `Persisted ${completed}/${total} files`;
1017
- return new Asset(path6.resolve(realpath));
1018
- }));
1019
- context.assets = files;
1020
- }
1021
- };
1022
- }
1023
- function createPersistIgnoreTask() {
1024
- return {
1025
- title: "Update .keqignore",
1026
- task: async (context, task) => {
1027
- if (!context.matcher) throw new Error("Please run setup task first.");
1028
- const matcher = context.matcher;
1029
- await matcher.write(".keqignore");
1030
- }
1031
- };
1032
- }
1033
- function main3() {
1034
- return {
1035
- task: (context, task) => task.newListr(
1036
- [
1037
- createPersistArtifactTask(),
1038
- createPersistIgnoreTask()
1039
- ],
1040
- {
1041
- concurrent: true,
1042
- rendererOptions: {
1043
- collapseSubtasks: true
1044
- }
1045
- }
1046
- )
1047
- };
1048
- }
1049
- function createPersistTask(compiler, options) {
1050
- return {
1051
- title: "Persist",
1052
- enabled: options?.enabled,
1053
- skip: options?.skip,
1054
- task: (context, task) => task.newListr(
1055
- [
1056
- main3(),
1057
- {
1058
- task: (context2, task2) => compiler.hooks.afterPersist.promise(task2)
1059
- }
1060
- ],
1061
- {
1062
- concurrent: false
1063
- }
1064
- )
1065
- };
1066
- }
1067
-
1068
- // src/compiler/tasks/compile/index.ts
1069
- function main4(compiler) {
1070
- return {
1071
- task: async (context, task) => {
1072
- if (!context.rc) throw new Error("Please run setup task first.");
1073
- if (!context.documents) throw new Error("Please run shaking task first.");
1074
- context.artifacts = [];
1075
- await compiler.hooks.compile.promise(task);
1076
- }
1077
- };
1078
- }
1079
- function createCompileTask(compiler, options) {
1080
- return {
1081
- title: "Compile",
1082
- enabled: options?.enabled,
1083
- skip: options?.skip,
1084
- task: (context, task) => task.newListr(
1085
- [
1086
- {
1087
- task: (context2, task2) => compiler.hooks.beforeCompile.promise(task2)
1088
- },
1089
- main4(compiler),
1090
- {
1091
- task: (context2, task2) => compiler.hooks.afterCompile.promise(task2)
1092
- }
1093
- ],
1094
- {
1095
- concurrent: false
1096
- }
1097
- )
1098
- };
1099
- }
1100
-
1101
- // src/compiler/intercepter/print-information.ts
1102
- function proxyTaskWrapper(pluginName, task) {
1103
- return new Proxy(task, {
1104
- set(target, prop2, value) {
1105
- if (prop2 !== "output") {
1106
- return Reflect.set(target, prop2, value);
1107
- }
1108
- target.output = `[Plugin: ${pluginName}] ${value}`;
1109
- return true;
1110
- }
1111
- });
1112
- }
1113
- function printInformation(taskIndex) {
1114
- return {
1115
- register: (tap) => {
1116
- const fn = tap.fn;
1117
- if (tap.type === "promise") {
1118
- tap.fn = (...args) => {
1119
- const task = args[taskIndex];
1120
- const proxyTask = proxyTaskWrapper(tap.name, task);
1121
- args[taskIndex] = proxyTask;
1122
- proxyTask.output = "Processing...";
1123
- return fn(...args);
1124
- };
1125
- }
1126
- if (tap.type === "sync") {
1127
- tap.fn = (...args) => {
1128
- const task = args[taskIndex];
1129
- const proxyTask = proxyTaskWrapper(tap.name, task);
1130
- args[taskIndex] = proxyTask;
1131
- proxyTask.output = "Processing...";
1132
- return fn(...args);
1133
- };
1134
- }
1135
- if (tap.type === "async") {
1136
- tap.fn = (...args) => {
1137
- const task = args[taskIndex];
1138
- const proxyTask = proxyTaskWrapper(tap.name, task);
1139
- args[taskIndex] = proxyTask;
1140
- proxyTask.output = "Processing...";
1141
- return fn(...args);
1142
- };
1143
- }
1144
- return tap;
1145
- }
1146
- };
1147
- }
1148
-
1149
- // src/compiler/intercepter/perfect-error-message.ts
1150
- var R10 = __toESM(require("ramda"), 1);
1151
- function perfectErrorMessage() {
1152
- return {
1153
- register: (tap) => {
1154
- const fn = tap.fn;
1155
- function prefix(err) {
1156
- if (err instanceof Error) {
1157
- err.message = `[Plugin: ${tap.name}] ${err.message}`;
1158
- }
1159
- }
1160
- if (tap.type === "promise") {
1161
- tap.fn = async (...args) => {
1162
- try {
1163
- return await fn(...args);
1164
- } catch (err) {
1165
- prefix(err);
1166
- throw err;
1167
- }
1168
- };
1169
- }
1170
- if (tap.type === "sync") {
1171
- tap.fn = (...args) => {
1172
- try {
1173
- return fn(...args);
1174
- } catch (err) {
1175
- prefix(err);
1176
- throw err;
1177
- }
1178
- };
1179
- }
1180
- if (tap.type === "async") {
1181
- tap.fn = (...args) => {
1182
- const callback = R10.last(args);
1183
- return fn(...R10.init(args), (err, result) => {
1184
- prefix(err);
1185
- return callback(err, result);
1186
- });
1187
- };
1188
- }
1189
- return tap;
1190
- }
1191
- };
1192
- }
1193
-
1194
- // src/plugins/eslint/index.ts
1195
- var import_eslint = require("eslint");
1196
-
1197
- // src/plugins/prettier/prettier.plugin.ts
1198
- var import_child_process = require("child_process");
1199
- var import_util = require("util");
1200
- var execAsync = (0, import_util.promisify)(import_child_process.exec);
1201
-
1202
- // src/plugins/body-fallback/index.ts
1203
- var R22 = __toESM(require("ramda"), 1);
1204
-
1205
- // src/plugins/generate-micro-function/generate-micro-function.plugin.ts
1206
- var import_tapable2 = require("tapable");
1207
-
1208
- // src/plugins/generate-micro-function/constants/metadata-storage.ts
1209
- var MetadataStorage = /* @__PURE__ */ new WeakMap();
1210
-
1211
- // src/plugins/generate-micro-function/generators/micro_function/micro-function.generator.ts
1212
- var R21 = __toESM(require("ramda"), 1);
1213
- var path10 = __toESM(require("path"), 1);
1214
- var changeCase6 = __toESM(require("change-case"), 1);
1215
-
1216
- // src/plugins/generate-declaration/generate-declaration.plugin.ts
1217
- var import_tapable = require("tapable");
1218
-
1219
- // src/plugins/generate-declaration/generators/operation-declaration/operation.generator.ts
1220
- var path9 = __toESM(require("path"), 1);
1221
- var changeCase5 = __toESM(require("change-case"), 1);
1222
-
1223
- // src/transformers/json-schema/comment.renderer.ts
1224
- var CommentRenderer = class {
1225
- constructor(schema) {
1226
- this.schema = schema;
1227
- }
1228
- render() {
1229
- const schema = this.schema;
1230
- const lines = ["/**"];
1231
- if (schema.description) {
1232
- const description = schema.description.replace("*/", "*\\/");
1233
- lines.push(...description.split("\n").map((line) => ` * ${line}`));
1234
- }
1235
- if (schema.deprecated) {
1236
- lines.push(" * @deprecated");
1237
- }
1238
- if (schema.readOnly) {
1239
- lines.push(" * @readonly");
1240
- }
1241
- if (schema.format) {
1242
- lines.push(` * @format ${schema.format}`);
1243
- }
1244
- lines.push(" */");
1245
- if (lines.length === 2) return "";
1246
- return lines.join("\n");
1247
- }
1248
- };
1249
-
1250
- // src/transformers/json-schema/declaration.renderer.ts
1251
- var R12 = __toESM(require("ramda"), 1);
1252
-
1253
- // src/utils/indent.ts
1254
- function indent(space, text) {
1255
- if (text === "") return "";
1256
- const indentation = " ".repeat(space);
1257
- return text.split("\n").map((line) => line ? `${indentation}${line}` : line).join("\n");
1258
- }
1259
-
1260
- // src/transformers/json-schema/reference.transformer.ts
1261
- var R11 = __toESM(require("ramda"), 1);
1262
- var ReferenceTransformer = class {
1263
- static toDeclaration(schema, alias2 = R11.identity) {
1264
- if (!schema.$ref || !schema.$ref.startsWith("#")) return `unknown /* ${schema.$ref.replace("*/", "*\\/")} */`;
1265
- const parts = schema.$ref.split("/");
1266
- return alias2(parts[parts.length - 1]) || "unknown";
1267
- }
1268
- };
1269
-
1270
- // src/transformers/json-schema/declaration.renderer.ts
1271
- var DeclarationRenderer = class {
1272
- constructor(schema, options = {}) {
1273
- this.schema = schema;
1274
- this.options = options;
1275
- }
1276
- render() {
1277
- return this.renderSchema(this.schema);
1278
- }
1279
- renderSchema(schema) {
1280
- if (typeof schema === "boolean") return "unknown";
1281
- if (JsonSchemaUtils.isRef(schema)) return this.renderReference(schema);
1282
- if (JsonSchemaUtils.isMixed(schema)) return this.renderMixed(schema);
1283
- if (JsonSchemaUtils.isArray(schema)) return this.renderArray(schema);
1284
- if (schema.type === "object") return this.renderObject(schema);
1285
- if (schema.enum) return this.renderEnum(schema);
1286
- if (schema.oneOf) return this.renderOneOf(schema);
1287
- if (schema.anyOf) return this.renderAnyOf(schema);
1288
- if (schema.allOf) return this.renderAllOf(schema);
1289
- if (schema.type === "string") return this.renderString(schema);
1290
- if (schema.type === "number") return this.renderNumber(schema);
1291
- if (schema.type === "boolean") return this.renderBoolean(schema);
1292
- if (schema.type === "null") return this.renderNull(schema);
1293
- if (schema.type === "integer") return this.renderInteger(schema);
1294
- return "unknown";
1295
- }
1296
- renderMixed(schema) {
1297
- if (Array.isArray(schema.type)) {
1298
- schema.type.map((type) => ({ ...schema, type })).map((schema2) => this.renderSchema(schema2)).join(" | ");
1299
- }
1300
- return "unknown";
1301
- }
1302
- renderReference(schema) {
1303
- if (!this.options.referenceTransformer) {
1304
- return ReferenceTransformer.toDeclaration(schema);
1305
- }
1306
- return this.options.referenceTransformer(schema);
1307
- }
1308
- renderArray(schema) {
1309
- if (schema.items && Array.isArray(schema.items)) {
1310
- const items = schema.items.map((s) => this.renderSchema(s)).join(", ");
1311
- return `[${items}]`;
1312
- }
1313
- if (schema.items && typeof schema.items === "object") {
1314
- return `${this.renderSchema(schema.items)}[]`;
1315
- }
1316
- return "any[]";
1317
- }
1318
- renderObject(schema) {
1319
- if ((!schema.properties || R12.isEmpty(schema.properties)) && (!schema.additionalProperties || R12.isEmpty(schema.additionalProperties))) {
1320
- return "object";
1321
- }
1322
- const $properties = Object.entries(schema.properties || {}).map(([propertyName, propertySchema]) => {
1323
- let $comment = new CommentRenderer(propertySchema).render();
1324
- if ($comment) $comment += "\n";
1325
- const $key = `"${propertyName}"${schema.required?.includes(propertyName) ? "" : "?"}`;
1326
- const $value = this.renderSchema(propertySchema);
1327
- return indent(2, `${$comment}${$key}: ${$value}`);
1328
- });
1329
- if (schema.additionalProperties) {
1330
- const $value = schema.additionalProperties === true ? "any" : this.renderSchema(schema.additionalProperties);
1331
- $properties.push(indent(2, `[key: string]: ${$value}`));
1332
- }
1333
- return [
1334
- "{",
1335
- ...$properties,
1336
- "}"
1337
- ].join("\n");
1338
- }
1339
- renderOneOf(schema) {
1340
- if (!schema.oneOf) return "unknown";
1341
- return schema.oneOf.map((s) => this.renderSchema(s)).join(" | ");
1342
- }
1343
- renderAnyOf(schema) {
1344
- if (!schema.anyOf) return "unknown";
1345
- return schema.anyOf.map((s) => this.renderSchema(s)).join(" | ");
1346
- }
1347
- renderAllOf(schema) {
1348
- if (!schema.allOf) return "unknown";
1349
- return schema.allOf.map((s) => this.renderSchema(s)).join(" & ");
1350
- }
1351
- renderEnum(schema) {
1352
- if (!schema.enum) return "unknown";
1353
- return schema.enum.map((v) => JSON.stringify(v)).join(" | ");
1354
- }
1355
- renderString(schema) {
1356
- if (schema.contentMediaType === "application/octet-stream") return "Blob | Buffer";
1357
- if (schema.format === "binary") return "Blob | Buffer";
1358
- return "string";
1359
- }
1360
- renderNumber(schema) {
1361
- return "number";
1362
- }
1363
- renderBoolean(schema) {
1364
- return "boolean";
1365
- }
1366
- renderNull(schema) {
1367
- return "null";
1368
- }
1369
- renderInteger(schema) {
1370
- return "number";
1371
- }
1372
- };
1373
-
1374
- // src/transformers/json-schema/json-schema.transformer.ts
1375
- var JsonSchemaTransformer = class {
1376
- static toComment(schema) {
1377
- return new CommentRenderer(schema).render();
1378
- }
1379
- static toDeclaration(schema, options) {
1380
- return new DeclarationRenderer(schema, options).render();
1381
- }
1382
- };
1383
-
1384
- // src/transformers/schema-definition/schema-definition.transformer.ts
1385
- var R13 = __toESM(require("ramda"), 1);
1386
- var SchemaDefinitionTransformer = class {
1387
- static toDeclaration(schemaDefinition, options) {
1388
- const dependencies = schemaDefinition.getDependencies();
1389
- let $dependencies = dependencies.filter((dep) => !SchemaDefinition.isUnknown(dep)).map((dep) => {
1390
- const filepath = options.getDependentSchemaDefinitionFilepath(dep);
1391
- return `import type { ${dep.name} } from "${filepath}"`;
1392
- }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, options.esm ? ' from "$1.js"' : ' from "$1"')).join("\n");
1393
- if ($dependencies) $dependencies += "\n";
1394
- let $comment = JsonSchemaTransformer.toComment(schemaDefinition.schema);
1395
- if ($comment) $comment += "\n";
1396
- if (typeof schemaDefinition.schema === "boolean") {
1397
- return [
1398
- "/* @anchor:file:start */",
1399
- "",
1400
- $dependencies,
1401
- $comment || void 0,
1402
- `type ${schemaDefinition.name} = unknown`,
1403
- "",
1404
- "/* @anchor:file:end */"
1405
- ].filter(R13.isNotNil).join("\n");
1406
- }
1407
- if (JsonSchemaUtils.isNonArray(schemaDefinition.schema) && schemaDefinition.schema.type === "object") {
1408
- const $schema = JsonSchemaTransformer.toDeclaration(schemaDefinition.schema);
1409
- const $declaration = $schema.startsWith("{") ? `export interface ${schemaDefinition.name} ${$schema}` : `export type ${schemaDefinition.name} = ${$schema}`;
1410
- return [
1411
- "/* @anchor:file:start */",
1412
- "",
1413
- $dependencies,
1414
- $comment || void 0,
1415
- $declaration,
1416
- "",
1417
- "/* @anchor:file:end */"
1418
- ].filter(R13.isNotNil).join("\n");
1419
- }
1420
- return [
1421
- "/* @anchor:file:start */",
1422
- "",
1423
- $dependencies,
1424
- $comment || void 0,
1425
- `export type ${schemaDefinition.name} = ${JsonSchemaTransformer.toDeclaration(schemaDefinition.schema)}`,
1426
- "",
1427
- "/* @anchor:file:end */"
1428
- ].filter(R13.isNotNil).join("\n");
1429
- }
1430
- };
1431
-
1432
- // src/transformers/operation-definition/comment.renderer.ts
1433
- var R14 = __toESM(require("ramda"), 1);
1434
- var CommentRenderer2 = class {
1435
- constructor(operationDefinition) {
1436
- this.operationDefinition = operationDefinition;
1437
- }
1438
- render() {
1439
- const operation = this.operationDefinition.operation;
1440
- if (!operation.summary && !operation.description) return "";
1441
- const lines = ["/**"];
1442
- if (operation.summary && typeof operation.summary === "string") {
1443
- lines.push(` * ${R14.trim(operation.summary)}`);
1444
- lines.push(" *");
1445
- }
1446
- if (operation.description && typeof operation.description === "string") {
1447
- lines.push(` * @description ${R14.trim(operation.description)}`);
1448
- }
1449
- lines.push(" */");
1450
- return lines.join("\n");
1451
- }
1452
- };
1453
-
1454
- // src/transformers/operation-definition/declaration.renderer.ts
1455
- var R15 = __toESM(require("ramda"), 1);
1456
-
1457
- // src/transformers/operation-definition/utils/type-name-factory.ts
1458
- var changeCase = __toESM(require("change-case"), 1);
1459
- function typeNameFactory(operationDefinition) {
1460
- const pascalCaseOperationId = changeCase.pascalCase(operationDefinition.operationId);
1461
- return (name) => `${pascalCaseOperationId}${name}`;
1462
- }
1463
-
1464
- // src/transformers/operation-definition/declaration.renderer.ts
1465
- var alias = (name) => `${name}Schema`;
1466
- var DeclarationRenderer2 = class {
1467
- constructor(operationDefinition, options) {
1468
- this.operationDefinition = operationDefinition;
1469
- this.options = options;
1470
- this.typeName = typeNameFactory(operationDefinition);
1471
- }
1472
- typeName;
1473
- renderResponseBodies(operation, options) {
1474
- if (!operation.responses || R15.isEmpty(operation.responses)) {
1475
- return `export interface ${this.typeName("ResponseBodies")} {}`;
1476
- }
1477
- const $responses = Object.entries(operation.responses).map(([statusCode, response]) => {
1478
- if (!JsonSchemaUtils.isRef(response)) {
1479
- const $value = Object.entries(response.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schema]) => {
1480
- if (mediaType.includes("text/event-stream")) return "ReadableStream<ServerSentEvent>";
1481
- if (mediaType.includes("multipart/form-data")) return "FormData";
1482
- if (!schema) return "unknown";
1483
- return JsonSchemaTransformer.toDeclaration(schema, options);
1484
- }).join(" | ");
1485
- return indent(2, `${statusCode}: ${$value || "void"}`);
1486
- }
1487
- }).join("\n");
1488
- return [
1489
- `export interface ${this.typeName("ResponseBodies")} {`,
1490
- $responses,
1491
- "}"
1492
- ].join("\n");
1493
- }
1494
- renderRequestBodies(operation, options) {
1495
- let $requestBodies = `export interface ${this.typeName("RequestBodies")} {}`;
1496
- if (operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody)) {
1497
- const $mediaTypes = Object.entries(operation.requestBody.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schema]) => {
1498
- if (!schema) return `${JSON.stringify(mediaType)}: unknown`;
1499
- return `${JSON.stringify(mediaType)}: ${JsonSchemaTransformer.toDeclaration(schema, options)}`;
1500
- }).map((pair) => indent(2, pair));
1501
- $requestBodies = [
1502
- `export interface ${this.typeName("RequestBodies")} {`,
1503
- ...$mediaTypes,
1504
- "}"
1505
- ].join("\n");
1506
- }
1507
- return $requestBodies;
1508
- }
1509
- renderParameterBodies(operationDefinition, options) {
1510
- const { operation } = operationDefinition;
1511
- let parameterBodies = "";
1512
- if (operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody)) {
1513
- const $mediaTypes = Object.entries(operation.requestBody.content || {}).map(([mediaType, mediaTypeObject]) => [mediaType, mediaTypeObject.schema]).map(([mediaType, schemaOrRef]) => {
1514
- if (!schemaOrRef) return `${JSON.stringify(mediaType)}: unknown`;
1515
- const schema = JsonSchemaUtils.isRef(schemaOrRef) ? OpenapiUtils.dereferenceDeep(schemaOrRef.$ref, operationDefinition.document.specification) : schemaOrRef;
1516
- if (schema.type === "object" || schema.properties) {
1517
- return `${JSON.stringify(mediaType)}: ${JsonSchemaTransformer.toDeclaration(schemaOrRef, options)} & { [key: string]: any }`;
1518
- }
1519
- return `${JSON.stringify(mediaType)}: { [key: string]: any }`;
1520
- }).map((pair) => indent(2, pair));
1521
- parameterBodies = [
1522
- `interface ${this.typeName("ParameterBodies")} {`,
1523
- ...$mediaTypes,
1524
- "}",
1525
- ""
1526
- ].join("\n");
1527
- }
1528
- return parameterBodies;
1529
- }
1530
- renderRequestParameters(operation, options) {
1531
- const mediaTypes = operation.requestBody && !JsonSchemaUtils.isRef(operation.requestBody) ? Object.keys(operation.requestBody.content || {}) : [];
1532
- const base = `${this.typeName("RequestQuery")} & ${this.typeName("RouteParameters")} & ${this.typeName("RequestHeaders")}`;
1533
- if (mediaTypes.length === 1) {
1534
- return `export type ${this.typeName("RequestParameters")} = ${base} & ${this.typeName("RequestBodies")}[${JSON.stringify(mediaTypes[0])}]`;
1535
- }
1536
- if (mediaTypes.length > 1) {
1537
- const unions = mediaTypes.map((mediaType) => `(${base} & ${this.typeName("RequestBodies")}[${JSON.stringify(mediaType)}] & { "content-type": ${JSON.stringify(mediaType)} })`).join("\n| ");
1538
- return `export type ${this.typeName("RequestParameters")} = ${unions}`;
1539
- }
1540
- return `export type ${this.typeName("RequestParameters")} = ${base}`;
1541
- }
1542
- rendererParameters(name, parameters, options) {
1543
- if (parameters.length === 0) {
1544
- return `export type ${name} = {}`;
1545
- }
1546
- const $parameters = parameters.map((parameter) => {
1547
- const parameterName = `"${parameter.name}"`;
1548
- const $key = parameter.required ? parameterName : `${parameterName}?`;
1549
- const $value = JsonSchemaTransformer.toDeclaration(parameter.schema || { type: "any" }, options);
1550
- return indent(2, `${$key}: ${$value}`);
1551
- }).join("\n");
1552
- return [
1553
- `export type ${name} = {`,
1554
- $parameters,
1555
- "}"
1556
- ].filter(Boolean).join("\n");
1557
- }
1558
- renderDependencies() {
1559
- const schemaDefinitions = this.operationDefinition.getDependencies().filter((schemaDefinition) => !SchemaDefinition.isUnknown(schemaDefinition));
1560
- const $schemaDefinitions = schemaDefinitions.map((schemaDefinition) => {
1561
- const filepath = this.options.getDependentSchemaDefinitionFilepath(schemaDefinition);
1562
- const schemaName = schemaDefinition.name;
1563
- return `import type { ${schemaName} as ${alias(schemaName)} } from "${filepath}"`;
1564
- }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? ' from "$1.js"' : ' from "$1"'));
1565
- return [
1566
- 'import type { KeqOperation, KeqPathParameterInit, KeqQueryInit, ServerSentEvent } from "keq"',
1567
- ...$schemaDefinitions
1568
- ].join("\n");
1569
- }
1570
- render() {
1571
- const { operation } = this.operationDefinition;
1572
- if (!operation.responses) return "";
1573
- const jsonSchemaDeclarationRendererOptions = {
1574
- referenceTransformer: (schema) => {
1575
- return ReferenceTransformer.toDeclaration(schema, alias);
1576
- }
1577
- };
1578
- const $dependencies = this.renderDependencies();
1579
- const $responseBodies = this.renderResponseBodies(operation, jsonSchemaDeclarationRendererOptions);
1580
- const $requestBodies = this.renderRequestBodies(operation, jsonSchemaDeclarationRendererOptions);
1581
- const $parameterBodies = this.renderParameterBodies(this.operationDefinition, jsonSchemaDeclarationRendererOptions);
1582
- const $requestParameters = this.renderRequestParameters(operation, jsonSchemaDeclarationRendererOptions);
1583
- const $requestQuery = this.rendererParameters(
1584
- `${this.typeName("RequestQuery")}`,
1585
- operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "query") || [],
1586
- jsonSchemaDeclarationRendererOptions
1587
- );
1588
- const $routeParameters = this.rendererParameters(
1589
- `${this.typeName("RouteParameters")}`,
1590
- operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "path") || [],
1591
- jsonSchemaDeclarationRendererOptions
1592
- );
1593
- const $requestHeaders = this.rendererParameters(
1594
- `${this.typeName("RequestHeaders")}`,
1595
- operation.parameters?.filter((p) => !JsonSchemaUtils.isRef(p) && p.in === "header") || [],
1596
- jsonSchemaDeclarationRendererOptions
1597
- );
1598
- return [
1599
- "/* @anchor:file:start */",
1600
- "",
1601
- $dependencies,
1602
- "",
1603
- $responseBodies,
1604
- "",
1605
- $requestBodies,
1606
- "",
1607
- $requestQuery,
1608
- "",
1609
- $routeParameters,
1610
- "",
1611
- $requestHeaders,
1612
- "",
1613
- $parameterBodies || void 0,
1614
- $requestParameters,
1615
- "",
1616
- `export interface ${this.typeName("Operation")}<STATUS extends keyof ${this.typeName("ResponseBodies")}, CONTENT_TYPE extends ${$parameterBodies ? `keyof ${this.typeName("ParameterBodies")}` : "string"} > extends KeqOperation {`,
1617
- ` requestParams: ${this.typeName("RouteParameters")} & { [key: string]: KeqPathParameterInit }`,
1618
- ` requestQuery: ${this.typeName("RequestQuery")} & { [key: string]: KeqQueryInit }`,
1619
- ` requestHeaders: ${this.typeName("RequestHeaders")} & { [key: string]: string | number }`,
1620
- ` requestBody: ${$parameterBodies ? `${this.typeName("ParameterBodies")}[CONTENT_TYPE] | ` : "object | "}BodyInit`,
1621
- ` responseBody: ${this.typeName("ResponseBodies")}[STATUS]`,
1622
- "}",
1623
- "",
1624
- "/* @anchor:file:end */"
1625
- ].filter(R15.isNotNil).join("\n");
1626
- }
1627
- };
1628
-
1629
- // src/transformers/operation-definition/micro-function.renderer.ts
1630
- var R17 = __toESM(require("ramda"), 1);
1631
-
1632
- // src/transformers/operation-definition/typescript-snippet.ts
1633
- var R16 = __toESM(require("ramda"), 1);
1634
-
1635
- // src/constants/qs-array-format.ts
1636
- var QsArrayFormat = /* @__PURE__ */ ((QsArrayFormat2) => {
1637
- QsArrayFormat2["brackets"] = "brackets";
1638
- QsArrayFormat2["indices"] = "indices";
1639
- QsArrayFormat2["repeat"] = "repeat";
1640
- QsArrayFormat2["comma"] = "comma";
1641
- QsArrayFormat2["space"] = "space";
1642
- QsArrayFormat2["pipe"] = "pipe";
1643
- return QsArrayFormat2;
1644
- })(QsArrayFormat || {});
1645
-
1646
- // src/transformers/operation-definition/typescript-snippet.ts
1647
- var OperationDefinitionSnippet = class {
1648
- constructor(operationDefinition, options) {
1649
- this.operationDefinition = operationDefinition;
1650
- this.options = options;
1651
- this.typeName = typeNameFactory(operationDefinition);
1652
- }
1653
- typeName;
1654
- getQsParameters(parameter) {
1655
- let arrayFormat;
1656
- let allowDots;
1657
- let indices;
1658
- const style = parameter.style || "form";
1659
- const explode = parameter.explode ?? true;
1660
- if ("x-qs-array-format" in parameter) {
1661
- arrayFormat = parameter["x-qs-array-format"];
1662
- } else {
1663
- if (style === "deepObject") {
1664
- arrayFormat = "brackets" /* brackets */;
1665
- } else if (explode) {
1666
- arrayFormat = "repeat" /* repeat */;
1667
- } else {
1668
- if (style === "form") {
1669
- arrayFormat = "comma" /* comma */;
1670
- } else if (style === "spaceDelimited") {
1671
- arrayFormat = "space" /* space */;
1672
- } else if (style === "pipeDelimited") {
1673
- arrayFormat = "pipe" /* pipe */;
1674
- }
1675
- }
1676
- }
1677
- if ("x-qs-allow-dots" in parameter) {
1678
- allowDots = Boolean(parameter["x-qs-allow-dots"]);
1679
- }
1680
- if ("x-qs-indices" in parameter) {
1681
- indices = Boolean(parameter["x-qs-indices"]);
1682
- }
1683
- if (arrayFormat || allowDots !== void 0 || indices !== void 0) {
1684
- return {
1685
- ...arrayFormat ? { arrayFormat } : {},
1686
- ...allowDots !== void 0 ? { allowDots } : {},
1687
- ...indices !== void 0 ? { indices } : {}
1688
- };
1689
- }
1690
- return void 0;
1691
- }
1692
- // render: "if (args && 'Authorization' in args) req.header('Authorization', args['Authorization'])"
1693
- renderRequestHeaders() {
1694
- const { operation } = this.operationDefinition;
1695
- 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");
1696
- return $headers;
1697
- }
1698
- // render: "if (args && 'id' in args) req.query('id', args['id'], options)"
1699
- renderRequestQuery() {
1700
- const { operation } = this.operationDefinition;
1701
- const $query = (operation.parameters || []).filter((p) => !JsonSchemaUtils.isRef(p)).filter((p) => p.in === "query").map((p) => {
1702
- const option = this.getQsParameters(p);
1703
- const $option = !option || R16.isEmpty(option) ? "" : `, ${JSON.stringify(option)}`;
1704
- return `if (args && ${JSON.stringify(p.name)} in args) req.query(${JSON.stringify(p.name)}, args[${JSON.stringify(p.name)}]${$option})`;
1705
- }).join("\n");
1706
- return $query;
1707
- }
1708
- // render: "if (args && 'id' in args) req.params('id', args['id'])"
1709
- renderRequestPathParameters() {
1710
- const { operation } = this.operationDefinition;
1711
- 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");
1712
- return $pathParameters;
1713
- }
1714
- getRequestMediaTypes() {
1715
- const { operation } = this.operationDefinition;
1716
- const requestBodyContent = operation.requestBody?.content || {};
1717
- return Object.keys(requestBodyContent);
1718
- }
1719
- // render "req.type("application/json")"
1720
- renderMediaType() {
1721
- const mediaTypes = this.getRequestMediaTypes();
1722
- if (mediaTypes.length === 1 && !mediaTypes[0].endsWith("/*")) {
1723
- return `req.type("${mediaTypes[0]}")
1724
- `;
1725
- } else if (mediaTypes.some((mediaType) => mediaType === "*/*")) {
1726
- } else if (mediaTypes.some((mediaType) => mediaType.endsWith("/*"))) {
1727
- return 'if(args?.["content-type"]) req.type(args["content-type"])\n';
1728
- } else if (mediaTypes.length > 1) {
1729
- return 'if(args?.["content-type"]) req.type(args["content-type"])\n';
1730
- }
1731
- return "";
1732
- }
1733
- // render body
1734
- requestBodyFormDataPropertyRenderer(propertyName, propertySchema, mediaType) {
1735
- try {
1736
- const $propertyName = JSON.stringify(propertyName);
1737
- const schema = JsonSchemaUtils.isRef(propertySchema) ? OpenapiUtils.dereferenceDeep(propertySchema.$ref, this.operationDefinition.document.specification) : propertySchema;
1738
- if (schema.type === "string" && schema.format === "binary" || schema.contentMediaType === "application/octet-stream") {
1739
- return `if (args && ${$propertyName} in args && args[${$propertyName}]) req.attach(${$propertyName}, args[${$propertyName}])`;
1740
- } else if (schema.type === "string" || schema.type === "array" && schema.items && schema.items.type === "string") {
1741
- return `if (args && ${$propertyName} in args && args[${$propertyName}] !== undefined) req.field(${$propertyName}, args[${$propertyName}])`;
1742
- } else if (schema.type === "number" || schema.type === "integer") {
1743
- return `if (args && ${$propertyName} in args && args[${$propertyName}] !== undefined) req.field(${$propertyName}, String(args[${$propertyName}]))`;
1744
- }
1745
- 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 */)`;
1746
- } catch (err) {
1747
- return this.renderErrorComment(err, mediaType);
1748
- }
1749
- }
1750
- requestBodyPropertyRenderer(propertyName, propertySchema, mediaType) {
1751
- if (mediaType === "application/json") {
1752
- const $propertyName = JSON.stringify(propertyName);
1753
- return `if (args && ${$propertyName} in args) req.send({ ${$propertyName}: args[${$propertyName}] })`;
1754
- } else if (mediaType === "multipart/form-data") {
1755
- return this.requestBodyFormDataPropertyRenderer(propertyName, propertySchema, mediaType);
1756
- } else {
1757
- throw new Error(`Unsupported media type: ${mediaType}`);
1758
- }
1759
- }
1760
- renderRequestBody() {
1761
- const { operation } = this.operationDefinition;
1762
- const requestBodyContent = operation.requestBody?.content || {};
1763
- const $requestBody = Object.entries(requestBodyContent).map(([mediaType, mediaTypeObject]) => {
1764
- if (!mediaTypeObject.schema) return;
1765
- try {
1766
- const schema = JsonSchemaUtils.isRef(mediaTypeObject.schema) ? OpenapiUtils.dereferenceDeep(mediaTypeObject.schema.$ref, this.operationDefinition.document.specification) : mediaTypeObject.schema;
1767
- if (schema.type !== "object") return;
1768
- const properties = schema.properties || {};
1769
- return Object.entries(properties).map(([propertyName, propertySchema]) => this.requestBodyPropertyRenderer(propertyName, propertySchema, mediaType)).join("\n");
1770
- } catch (err) {
1771
- return this.renderErrorComment(err, mediaType);
1772
- }
1773
- }).filter(R16.isNotNil).join("\n");
1774
- return $requestBody;
1775
- }
1776
- renderErrorComment(err, mediaType) {
1777
- const $err = String(err).split("\n").map(((line) => ` * ${line}`)).join("\n");
1778
- return [
1779
- "/**",
1780
- ` * Unable to dereference schema for media type ${mediaType}`,
1781
- $err,
1782
- " */"
1783
- ].join("\n");
1784
- }
1785
- };
1786
-
1787
- // src/transformers/operation-definition/micro-function.renderer.ts
1788
- var OperationDefinitionMicroFunctionRenderer = class {
1789
- constructor(operationDefinition, options) {
1790
- this.operationDefinition = operationDefinition;
1791
- this.options = options;
1792
- this.typeName = typeNameFactory(operationDefinition);
1793
- this.helper = new OperationDefinitionSnippet(operationDefinition, options);
1794
- }
1795
- helper;
1796
- typeName;
1797
- render() {
1798
- const { operation, operationId, method, pathname } = this.operationDefinition;
1799
- if (!operation.responses) return "";
1800
- const $dependencies = this.renderDependencies();
1801
- const $comment = new CommentRenderer2(this.operationDefinition).render();
1802
- const moduleName = this.operationDefinition.module.name;
1803
- const $method = method.toLowerCase();
1804
- const $queryParameters = this.helper.renderRequestQuery();
1805
- const $headerParameters = this.helper.renderRequestHeaders();
1806
- const $pathParameters = this.helper.renderRequestPathParameters();
1807
- const $mediaType = this.helper.renderMediaType();
1808
- const $requestBody = this.helper.renderRequestBody();
1809
- const $operationDeclaration = this.renderOperationDeclaration();
1810
- return [
1811
- "/* @anchor:file:start */",
1812
- "",
1813
- $dependencies,
1814
- "",
1815
- `const moduleName = "${moduleName}"`,
1816
- `const method = "${method}"`,
1817
- `const pathname = "${pathname}"`,
1818
- "",
1819
- $comment || void 0,
1820
- `export ${$operationDeclaration} {`,
1821
- ` const req = request.${$method}<${this.typeName("ResponseBodies")}[STATUS]>("${pathname}")`,
1822
- " .option('module', { name: moduleName, pathname, method })",
1823
- "",
1824
- $mediaType ? indent(2, $mediaType) : void 0,
1825
- " /* @anchor:query:start */",
1826
- $queryParameters ? indent(2, $queryParameters) : void 0,
1827
- " /* @anchor:query:end */",
1828
- "",
1829
- " /* @anchor:headers:start */",
1830
- $headerParameters ? indent(2, $headerParameters) : void 0,
1831
- " /* @anchor:headers:end */",
1832
- "",
1833
- " /* @anchor:path-parameters:start */",
1834
- $pathParameters ? indent(2, $pathParameters) : void 0,
1835
- " /* @anchor:path-parameters:end */",
1836
- "",
1837
- " /* @anchor:body:start */",
1838
- $requestBody ? indent(2, $requestBody) : void 0,
1839
- " /* @anchor:body:end */",
1840
- "",
1841
- " /* @anchor:operation-return */",
1842
- ` return req as ReturnType<typeof ${operationId}<STATUS${$operationDeclaration.includes("CONTENT_TYPE") ? ", CONTENT_TYPE" : ""}>>`,
1843
- "}",
1844
- "",
1845
- `${operationId}.pathname = pathname`,
1846
- `${operationId}.method = method`,
1847
- "/* @anchor:file:end */"
1848
- ].filter(R17.isNotNil).join("\n");
1849
- }
1850
- renderDependencies() {
1851
- const declarationFilepath = this.options.getOperationDefinitionDeclarationFilepath(this.operationDefinition);
1852
- const requestFilepath = this.options.getRequestFilepath();
1853
- return [
1854
- 'import { Keq } from "keq"',
1855
- `import { request } from "${requestFilepath}"`,
1856
- `import type { ${this.typeName("Operation")}, ${this.typeName("ResponseBodies")}, ${this.typeName("RequestParameters")} } from "${declarationFilepath}"`,
1857
- `export type { ${this.typeName("RequestQuery")}, ${this.typeName("RequestHeaders")}, ${this.typeName("RequestBodies")} } from "${declarationFilepath}"`
1858
- ].map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? ' from "$1.js"' : ' from "$1"')).join("\n");
1859
- }
1860
- renderOperationDeclaration() {
1861
- const { operationId } = this.operationDefinition;
1862
- const mediaTypes = this.helper.getRequestMediaTypes();
1863
- if (mediaTypes.length === 0) {
1864
- 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>>`;
1865
- } else if (mediaTypes.length === 1) {
1866
- 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>>`;
1867
- } else if (mediaTypes.length > 1) {
1868
- 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>>`;
1869
- }
1870
- throw new Exception(this.operationDefinition.module, "[operationDeclarationRenderer] Unreachable");
1871
- }
1872
- };
1873
-
1874
- // src/transformers/operation-definition/nestjs-method.renderer.ts
1875
- var R18 = __toESM(require("ramda"), 1);
1876
- var OperationDefinitionNestjsMethodRenderer = class {
1877
- constructor(operationDefinition, options) {
1878
- this.operationDefinition = operationDefinition;
1879
- this.options = options;
1880
- this.typeName = typeNameFactory(operationDefinition);
1881
- this.helper = new OperationDefinitionSnippet(operationDefinition, options);
1882
- }
1883
- helper;
1884
- typeName;
1885
- render() {
1886
- const pathname = this.operationDefinition.pathname;
1887
- const $comment = new CommentRenderer2(this.operationDefinition).render();
1888
- const $method = this.operationDefinition.method.toLowerCase();
1889
- const $mediaType = this.helper.renderMediaType();
1890
- const $operationDeclaration = this.renderOperationDeclaration(this.operationDefinition);
1891
- const $queryParameters = this.helper.renderRequestQuery();
1892
- const $headerParameters = this.helper.renderRequestHeaders();
1893
- const $pathParameters = this.helper.renderRequestPathParameters();
1894
- const $requestBody = this.helper.renderRequestBody();
1895
- return [
1896
- $comment,
1897
- `${$operationDeclaration} {`,
1898
- ` const req = this.request.${$method}<${this.typeName("ResponseBodies")}[STATUS]>(${JSON.stringify(pathname)})`,
1899
- " .option(",
1900
- ' "module",',
1901
- " {",
1902
- ` name: ${JSON.stringify(this.operationDefinition.module.name)},`,
1903
- ` pathname: ${JSON.stringify(pathname)},`,
1904
- ` method: ${JSON.stringify($method)},`,
1905
- " },",
1906
- " )",
1907
- "",
1908
- $mediaType ? indent(2, $mediaType) : void 0,
1909
- "",
1910
- " /* @anchor:query:start */",
1911
- $queryParameters ? indent(2, $queryParameters) : void 0,
1912
- " /* @anchor:query:end */",
1913
- "",
1914
- " /* @anchor:headers:start */",
1915
- $headerParameters ? indent(2, $headerParameters) : void 0,
1916
- " /* @anchor:headers:end */",
1917
- "",
1918
- " /* @anchor:path-parameters:start */",
1919
- $pathParameters ? indent(2, $pathParameters) : void 0,
1920
- " /* @anchor:path-parameters:end */",
1921
- "",
1922
- " /* @anchor:body:start */",
1923
- $requestBody ? indent(2, $requestBody) : void 0,
1924
- " /* @anchor:body:end */",
1925
- "",
1926
- " return req",
1927
- "}"
1928
- ].filter(R18.isNotNil).join("\n");
1929
- }
1930
- renderOperationDeclaration(operationDefinition) {
1931
- const { operationId } = operationDefinition;
1932
- const typeName = typeNameFactory(operationDefinition);
1933
- const mediaTypes = this.helper.getRequestMediaTypes();
1934
- if (mediaTypes.length === 0) {
1935
- return `${operationId}<STATUS extends keyof ${typeName("ResponseBodies")}, CONTENT_TYPE extends never = never>(args?: ${typeName("RequestParameters")}): Keq<${typeName("Operation")}<STATUS, CONTENT_TYPE>>`;
1936
- } else if (mediaTypes.length === 1) {
1937
- 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>>`;
1938
- } else if (mediaTypes.length > 1) {
1939
- 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>>`;
1940
- }
1941
- throw new Exception(operationDefinition.module, "[operationDeclarationRenderer] Unreachable");
1942
- }
1943
- };
1944
-
1945
- // src/transformers/operation-definition/operation-definition.transformer.ts
1946
- var OperationDefinitionTransformer = class {
1947
- static toDeclaration(operationDefinition, options) {
1948
- return new DeclarationRenderer2(operationDefinition, options).render();
1949
- }
1950
- static toMicroFunction(operationDefinition, options) {
1951
- return new OperationDefinitionMicroFunctionRenderer(operationDefinition, options).render();
1952
- }
1953
- static toNestjsMethod(operationDefinition, options) {
1954
- return new OperationDefinitionNestjsMethodRenderer(operationDefinition, options).render();
1955
- }
1956
- static toComment(operationDefinition) {
1957
- return new CommentRenderer2(operationDefinition).render();
1958
- }
1959
- };
1960
-
1961
- // src/transformers/entrypoint/entrypoint.transformer.ts
1962
- var path7 = __toESM(require("path"), 1);
1963
- var EntrypointTransformer = class {
1964
- static toTypescript(exports2, options) {
1965
- const $exports = exports2.map((exportArtifact) => {
1966
- const relativePath = path7.relative(
1967
- options.dirpath,
1968
- exportArtifact.filepath
1969
- ).replace(/(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?$/, options.esm ? ".js" : "");
1970
- return relativePath.startsWith(".") ? `export * from '${relativePath}'` : `export * from './${relativePath}'`;
1971
- });
1972
- return [
1973
- "/* @anchor:file:start */",
1974
- "",
1975
- ...$exports,
1976
- "",
1977
- "/* @anchor:file:end */"
1978
- ].join("\n");
1979
- }
1980
- };
1981
-
1982
- // src/transformers/api-document/nestjs-client.renderer.ts
1983
- var R19 = __toESM(require("ramda"), 1);
1984
- var changeCase2 = __toESM(require("change-case"), 1);
1985
- var NestjsClientRenderer = class {
1986
- constructor(document, options) {
1987
- this.document = document;
1988
- this.options = options;
1989
- }
1990
- renderDependencies() {
1991
- const $operations = this.document.operations.map((operationDefinition) => {
1992
- const filepath = this.options.getOperationDefinitionDeclarationFilepath(operationDefinition);
1993
- const typeName = typeNameFactory(operationDefinition);
1994
- return `import type { ${typeName("Operation")}, ${typeName("ResponseBodies")}, ${typeName("RequestParameters")} } from "${filepath}"`;
1995
- }).map((str) => str.replace(/ from "(\.\.?\/.+?)(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?"/, this.options.esm ? ' from "$1.js"' : ' from "$1"'));
1996
- return [
1997
- 'import { Injectable, Logger } from "@nestjs/common"',
1998
- 'import { Keq, KeqRequest } from "keq"',
1999
- ...$operations
2000
- ].join("\n");
2001
- }
2002
- render() {
2003
- const moduleName = changeCase2.pascalCase(this.document.module.name);
2004
- const $dependencies = this.renderDependencies();
2005
- const $operations = this.document.operations.map((operation) => OperationDefinitionTransformer.toNestjsMethod(operation, {
2006
- esm: this.options.esm
2007
- })).join("\n\n");
2008
- return [
2009
- "/* @anchor:file:start */",
2010
- "",
2011
- $dependencies,
2012
- "",
2013
- "@Injectable()",
2014
- `export class ${moduleName}Client {`,
2015
- ` private readonly logger = new Logger(${moduleName}Client.name)`,
2016
- "",
2017
- " constructor(",
2018
- " // @anchor:client-constructor-parameters:start",
2019
- " private readonly request: KeqRequest,",
2020
- " // @anchor:client-constructor-parameters:end",
2021
- " ) {}",
2022
- "",
2023
- indent(2, $operations),
2024
- "}",
2025
- "",
2026
- "/* @anchor:file:end */"
2027
- ].filter(R19.isNotNil).join("\n");
2028
- }
2029
- };
2030
-
2031
- // src/transformers/api-document/nestjs-module.renderer.ts
2032
- var changeCase3 = __toESM(require("change-case"), 1);
2033
- var NestjsModuleRenderer = class {
2034
- constructor(document, options) {
2035
- this.document = document;
2036
- this.options = options;
2037
- }
2038
- render() {
2039
- const moduleName = changeCase3.pascalCase(this.document.module.name);
2040
- const clientFilepath = this.options.getNestjsClientFilepath(this.document).replace(/(\.ts|\.mts|\.cts|\.js|\.cjs|\.mjs)?$/, this.options.esm ? ".js" : "");
2041
- return [
2042
- "/* @anchor:file:start */",
2043
- 'import { Module, Inject, ConfigurableModuleBuilder, Global } from "@nestjs/common"',
2044
- 'import { KeqRequest } from "keq"',
2045
- 'import { KeqModuleOptions } from "@keq-request/nestjs"',
2046
- `import { ${moduleName}Client } from "${clientFilepath}"`,
2047
- "",
2048
- "",
2049
- "const { ConfigurableModuleClass, MODULE_OPTIONS_TOKEN, OPTIONS_TYPE, ASYNC_OPTIONS_TYPE } = new ConfigurableModuleBuilder<KeqModuleOptions>().build()",
2050
- "",
2051
- "@Global()",
2052
- "@Module({",
2053
- " imports: [],",
2054
- " controllers: [],",
2055
- ` providers: [${moduleName}Client],`,
2056
- ` exports: [${moduleName}Client],`,
2057
- "})",
2058
- `export class ${moduleName}Module extends ConfigurableModuleClass {`,
2059
- "",
2060
- " constructor(",
2061
- " @Inject(MODULE_OPTIONS_TOKEN) private readonly options: KeqModuleOptions,",
2062
- " private readonly request: KeqRequest,",
2063
- " ) {",
2064
- " super()",
2065
- " }",
2066
- "",
2067
- " onModuleInit() {",
2068
- " if (this.options.middlewares) {",
2069
- " for (const middleware of this.options.middlewares) {",
2070
- " this.request.use(middleware)",
2071
- " }",
2072
- " }",
2073
- " }",
2074
- "}",
2075
- "",
2076
- "/* @anchor:file:end */"
2077
- ].join("\n");
2078
- }
2079
- };
2080
-
2081
- // src/transformers/api-document/api-document.transformer.ts
2082
- var ApiDocumentTransformer = class {
2083
- static toNestjsModule(document, options) {
2084
- return new NestjsModuleRenderer(document, options).render();
2085
- }
2086
- static toNestjsClient(document, options) {
2087
- return new NestjsClientRenderer(document, options).render();
2088
- }
2089
- };
2090
-
2091
- // src/plugins/generate-declaration/generators/schema-declaration/schema.generator.ts
2092
- var R20 = __toESM(require("ramda"), 1);
2093
- var path8 = __toESM(require("path"), 1);
2094
- var changeCase4 = __toESM(require("change-case"), 1);
2095
-
2096
- // src/plugins/generate-declaration/constants/metadata-storage.ts
2097
- var MetadataStorage2 = /* @__PURE__ */ new WeakMap();
2098
-
2099
- // src/plugins/generate-declaration/generators/schema-declaration/schema.generator.ts
2100
- var SCHEMA_GENERATOR = "schemaGenerator";
2101
- var SchemaDeclarationGenerator = class _SchemaDeclarationGenerator {
2102
- async compile(compiler, task) {
2103
- const context = compiler.context;
2104
- const metadata = MetadataStorage2.get(compiler);
2105
- const rc = context.rc;
2106
- const documents = context.documents;
2107
- const schemaDefinitions = documents.flatMap((document) => document.schemas);
2108
- const artifactMap = new Map(
2109
- await Promise.all(
2110
- schemaDefinitions.map(async (schemaDefinition) => [
2111
- schemaDefinition,
2112
- await metadata.hooks.afterSchemaDeclarationArtifactGenerated.promise(
2113
- this.generateSchemaDefinitionsArtifact(schemaDefinition, rc),
2114
- schemaDefinition,
2115
- task
2116
- )
2117
- ])
2118
- )
2119
- );
2120
- const entrypoints = R20.collectBy(
2121
- (schemaDefinition) => schemaDefinition.module.name,
2122
- schemaDefinitions
2123
- ).map((schemaDefinitions2) => [
2124
- schemaDefinitions2[0].module,
2125
- schemaDefinitions2.map((schemaDefinition) => artifactMap.get(schemaDefinition)).filter((artifact) => Boolean(artifact))
2126
- ]).map(([moduleDefinition, artifacts]) => this.generateEntrypointArtifact(
2127
- moduleDefinition,
2128
- artifacts,
2129
- rc
2130
- ));
2131
- return [...artifactMap.values(), ...entrypoints];
2132
- }
2133
- generateSchemaDefinitionsArtifact(schemaDefinition, rc) {
2134
- const filepath = _SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(schemaDefinition, rc.fileNamingStyle);
2135
- const dirpath = path8.dirname(filepath);
2136
- const artifact = new Artifact({
2137
- id: _SchemaDeclarationGenerator.getSchemaDefinitionArtifactId(schemaDefinition),
2138
- filepath,
2139
- content: SchemaDefinitionTransformer.toDeclaration(
2140
- schemaDefinition,
2141
- {
2142
- esm: rc.esm,
2143
- getDependentSchemaDefinitionFilepath(dependentSchemaDefinition) {
2144
- const relativePath = path8.relative(
2145
- dirpath,
2146
- _SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(dependentSchemaDefinition, rc.fileNamingStyle)
2147
- );
2148
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2149
- }
2150
- }
2151
- ),
2152
- extensionName: ".schema.ts"
2153
- });
2154
- return artifact;
2155
- }
2156
- generateEntrypointArtifact(moduleDefinition, exports2, rc) {
2157
- const filepath = _SchemaDeclarationGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.fileNamingStyle);
2158
- const dirpath = path8.dirname(filepath);
2159
- const artifact = new Artifact({
2160
- id: _SchemaDeclarationGenerator.getEntrypointArtifactId(moduleDefinition),
2161
- filepath,
2162
- content: EntrypointTransformer.toTypescript(exports2, { dirpath })
2163
- });
2164
- return artifact;
2165
- }
2166
- static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
2167
- return [
2168
- ".",
2169
- changeCase4[fileNamingStyle](moduleDefinition.name),
2170
- "types",
2171
- "components",
2172
- "schemas",
2173
- "index.ts"
2174
- ].join("/");
2175
- }
2176
- static getEntrypointArtifactId(moduleDefinition) {
2177
- return `${moduleDefinition.address}/components/schemas/entrypoint?generator=${SCHEMA_GENERATOR}`;
2178
- }
2179
- static getSchemaDefinitionArtifactFilepath(schemaDefinition, fileNamingStyle) {
2180
- const filename = `${changeCase4[fileNamingStyle](schemaDefinition.name)}.schema.ts`;
2181
- return [
2182
- ".",
2183
- changeCase4[fileNamingStyle](schemaDefinition.module.name),
2184
- "types",
2185
- "components",
2186
- "schemas",
2187
- filename
2188
- ].join("/");
2189
- }
2190
- static getSchemaDefinitionArtifactId(schemaDefinition) {
2191
- return `${schemaDefinition.id}?generator=${SCHEMA_GENERATOR}`;
2192
- }
2193
- };
2194
-
2195
- // src/plugins/generate-declaration/generators/operation-declaration/operation.generator.ts
2196
- var OPERATION_GENERATOR = "operationDeclarationGenerator";
2197
- var OperationDeclarationGenerator = class _OperationDeclarationGenerator {
2198
- async compile(compiler, task) {
2199
- const context = compiler.context;
2200
- const metadata = MetadataStorage2.get(compiler);
2201
- const rc = context.rc;
2202
- const documents = context.documents;
2203
- const operationDefinitions = documents.flatMap((document) => document.operations);
2204
- const artifactMap = new Map(
2205
- await Promise.all(
2206
- operationDefinitions.map(async (operationDefinition) => [
2207
- operationDefinition,
2208
- await metadata.hooks.afterOperationDeclarationArtifactGenerated.promise(
2209
- this.generateOperationDefinitionArtifact(operationDefinition, rc),
2210
- operationDefinition,
2211
- task
2212
- )
2213
- ])
2214
- )
2215
- );
2216
- return Array.from(artifactMap.values());
2217
- }
2218
- generateOperationDefinitionArtifact(operationDefinition, rc) {
2219
- const filepath = _OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.fileNamingStyle);
2220
- const dirpath = path9.dirname(filepath);
2221
- const artifact = new Artifact({
2222
- id: _OperationDeclarationGenerator.getOperationDefinitionArtifactId(operationDefinition),
2223
- filepath,
2224
- content: OperationDefinitionTransformer.toDeclaration(
2225
- operationDefinition,
2226
- {
2227
- esm: rc.esm,
2228
- getDependentSchemaDefinitionFilepath(dependentSchemaDefinition) {
2229
- const relativePath = path9.relative(
2230
- dirpath,
2231
- SchemaDeclarationGenerator.getSchemaDefinitionArtifactFilepath(dependentSchemaDefinition, rc.fileNamingStyle)
2232
- );
2233
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2234
- }
2235
- }
2236
- ),
2237
- extensionName: ".type.ts"
2238
- });
2239
- return artifact;
2240
- }
2241
- generateEntrypointArtifact(moduleDefinition, exports2, rc) {
2242
- const filepath = _OperationDeclarationGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.fileNamingStyle);
2243
- const dirpath = path9.dirname(filepath);
2244
- const artifact = new Artifact({
2245
- id: _OperationDeclarationGenerator.getEntrypointArtifactId(moduleDefinition),
2246
- filepath,
2247
- content: EntrypointTransformer.toTypescript(exports2, { dirpath })
2248
- });
2249
- return artifact;
2250
- }
2251
- static getOperationDefinitionArtifactFilepath(operationDefinition, fileNamingStyle) {
2252
- const filename = `${changeCase5[fileNamingStyle](operationDefinition.operationId)}.type.ts`;
2253
- const filepath = [
2254
- ".",
2255
- changeCase5[fileNamingStyle](operationDefinition.module.name),
2256
- "types",
2257
- "operations",
2258
- filename
2259
- ].join("/");
2260
- return filepath;
2261
- }
2262
- static getOperationDefinitionArtifactId(operationDefinition) {
2263
- return `${operationDefinition.id}?generator=${OPERATION_GENERATOR}`;
2264
- }
2265
- static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
2266
- return [
2267
- ".",
2268
- changeCase5[fileNamingStyle](moduleDefinition.name),
2269
- "types",
2270
- "operations",
2271
- "index.ts"
2272
- ].join("/");
2273
- }
2274
- static getEntrypointArtifactId(moduleDefinition) {
2275
- return `${moduleDefinition.address}/paths/entrypoint?generator=${OPERATION_GENERATOR}`;
2276
- }
2277
- };
2278
-
2279
- // src/plugins/generate-declaration/generate-declaration.plugin.ts
2280
- var DECLARATION_GENERATOR = "declarationGenerator";
2281
- var GenerateDeclarationPlugin = class _GenerateDeclarationPlugin {
2282
- name = DECLARATION_GENERATOR;
2283
- operationGenerator = new OperationDeclarationGenerator();
2284
- schemaGenerator = new SchemaDeclarationGenerator();
2285
- constructor() {
2286
- }
2287
- apply(compiler) {
2288
- _GenerateDeclarationPlugin.register(compiler);
2289
- compiler.hooks.compile.tapPromise(_GenerateDeclarationPlugin.name, async (task) => {
2290
- compiler.context.artifacts?.push(
2291
- ...await this.schemaGenerator.compile(compiler, task),
2292
- ...await this.operationGenerator.compile(compiler, task)
2293
- );
2294
- });
2295
- }
2296
- static register(compiler) {
2297
- if (!MetadataStorage2.has(compiler)) {
2298
- MetadataStorage2.set(compiler, {
2299
- hooks: {
2300
- afterEntrypointArtifactGenerated: new import_tapable.AsyncSeriesWaterfallHook(["artifact", "task"]),
2301
- afterSchemaDeclarationArtifactGenerated: new import_tapable.AsyncSeriesWaterfallHook(["artifact", "schemaDefinition", "task"]),
2302
- afterOperationDeclarationArtifactGenerated: new import_tapable.AsyncSeriesWaterfallHook(["artifact", "operationDefinition", "task"])
2303
- }
2304
- });
2305
- }
2306
- return MetadataStorage2.get(compiler);
2307
- }
2308
- static of(compiler) {
2309
- return this.register(compiler);
2310
- }
2311
- };
2312
-
2313
- // src/plugins/generate-micro-function/generators/request/request.generator.ts
2314
- var MICRO_FUNCTION_REQUEST_GENERATOR = "microFunctionRequestGenerator";
2315
- var RequestGenerator = class _RequestGenerator {
2316
- generateRequestArtifact() {
2317
- const content = [
2318
- "/* @anchor:file:start */",
2319
- "",
2320
- 'import { KeqRequest } from "keq"',
2321
- "",
2322
- "/* @anchor:request-declaration */",
2323
- "export const request = new KeqRequest()",
2324
- "",
2325
- "/* @anchor:file:end */"
2326
- ].join("\n");
2327
- return new Artifact({
2328
- id: _RequestGenerator.getRequestArtifactId(),
2329
- filepath: _RequestGenerator.getRequestArtifactFilepath(),
2330
- content
2331
- });
2332
- }
2333
- // eslint-disable-next-line @typescript-eslint/require-await
2334
- async compile(compiler, task) {
2335
- return [
2336
- this.generateRequestArtifact()
2337
- ];
2338
- }
2339
- static getRequestArtifactFilepath() {
2340
- return "./request.ts";
2341
- }
2342
- static getRequestArtifactId() {
2343
- return `request?generator=${MICRO_FUNCTION_REQUEST_GENERATOR}`;
2344
- }
2345
- };
2346
-
2347
- // src/plugins/generate-micro-function/generators/micro_function/micro-function.generator.ts
2348
- var MICRO_FUNCTION_GENERATOR = "microFunctionGenerator";
2349
- var MicroFunctionGenerator = class _MicroFunctionGenerator {
2350
- async compile(compiler, task) {
2351
- const metadata = MetadataStorage.get(compiler);
2352
- const context = compiler.context;
2353
- const rc = context.rc;
2354
- const documents = context.documents;
2355
- const operationDefinitions = documents.flatMap((document) => document.operations);
2356
- const artifactMap = new Map(
2357
- await Promise.all(
2358
- operationDefinitions.map(async (operationDefinition) => [
2359
- operationDefinition,
2360
- await metadata.hooks.afterMicroFunctionArtifactGenerated.promise(
2361
- this.generateOperationDefinitionArtifact(operationDefinition, rc),
2362
- operationDefinition,
2363
- task
2364
- )
2365
- ])
2366
- )
2367
- );
2368
- const entrypoints = await Promise.all(
2369
- R21.collectBy(
2370
- (operationDefinition) => operationDefinition.module.name,
2371
- operationDefinitions
2372
- ).map((operationDefinitions2) => [
2373
- operationDefinitions2[0].module,
2374
- operationDefinitions2.map((operationDefinition) => artifactMap.get(operationDefinition)).filter((artifact) => Boolean(artifact))
2375
- ]).map(async ([moduleDefinition, artifacts]) => await metadata.hooks.afterEntrypointArtifactGenerated.promise(
2376
- this.generateEntrypointArtifact(
2377
- moduleDefinition,
2378
- artifacts,
2379
- rc
2380
- ),
2381
- task
2382
- ))
2383
- );
2384
- return [...entrypoints, ...artifactMap.values()];
2385
- }
2386
- generateOperationDefinitionArtifact(operationDefinition, rc) {
2387
- const filepath = _MicroFunctionGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.fileNamingStyle);
2388
- const dirpath = path10.dirname(filepath);
2389
- const artifact = new Artifact({
2390
- id: _MicroFunctionGenerator.getOperationDefinitionArtifactId(operationDefinition),
2391
- filepath,
2392
- content: OperationDefinitionTransformer.toMicroFunction(operationDefinition, {
2393
- esm: rc.esm,
2394
- getOperationDefinitionDeclarationFilepath(operationDefinition2) {
2395
- const relativePath = path10.relative(
2396
- dirpath,
2397
- OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition2, rc.fileNamingStyle)
2398
- );
2399
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2400
- },
2401
- getRequestFilepath() {
2402
- const relativePath = path10.relative(
2403
- dirpath,
2404
- RequestGenerator.getRequestArtifactFilepath()
2405
- );
2406
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2407
- }
2408
- }),
2409
- extensionName: ".type.ts"
2410
- });
2411
- return artifact;
2412
- }
2413
- generateEntrypointArtifact(moduleDefinition, exports2, rc) {
2414
- const filepath = _MicroFunctionGenerator.getEntrypointArtifactFilepath(moduleDefinition, rc.fileNamingStyle);
2415
- const dirpath = filepath.substring(0, filepath.lastIndexOf("/"));
2416
- const artifact = new Artifact({
2417
- id: _MicroFunctionGenerator.getEntrypointArtifactId(moduleDefinition),
2418
- filepath,
2419
- content: EntrypointTransformer.toTypescript(exports2, { dirpath })
2420
- });
2421
- return artifact;
2422
- }
2423
- static getOperationDefinitionArtifactFilepath(operationDefinition, fileNamingStyle) {
2424
- const filename = `${changeCase6[fileNamingStyle](operationDefinition.operationId)}.fn.ts`;
2425
- const filepath = [
2426
- ".",
2427
- changeCase6[fileNamingStyle](operationDefinition.module.name),
2428
- "operations",
2429
- filename
2430
- ].join("/");
2431
- return filepath;
2432
- }
2433
- static getOperationDefinitionArtifactId(operationDefinition) {
2434
- return `${operationDefinition.id}?generator=${MICRO_FUNCTION_GENERATOR}`;
2435
- }
2436
- static getEntrypointArtifactFilepath(moduleDefinition, fileNamingStyle) {
2437
- return [
2438
- ".",
2439
- changeCase6[fileNamingStyle](moduleDefinition.name),
2440
- "operations",
2441
- "index.ts"
2442
- ].join("/");
2443
- }
2444
- static getEntrypointArtifactId(moduleDefinition) {
2445
- return `${moduleDefinition.address}/paths/entrypoint?generator=${MICRO_FUNCTION_GENERATOR}`;
2446
- }
2447
- };
2448
-
2449
- // src/plugins/generate-micro-function/generate-micro-function.plugin.ts
2450
- var GenerateMicroFunctionPlugin = class _GenerateMicroFunctionPlugin {
2451
- microFunctionGenerator = new MicroFunctionGenerator();
2452
- requestGenerator = new RequestGenerator();
2453
- apply(compiler) {
2454
- _GenerateMicroFunctionPlugin.register(compiler);
2455
- compiler.hooks.compile.tapPromise(_GenerateMicroFunctionPlugin.name, async (task) => {
2456
- const artifacts = [
2457
- ...await this.requestGenerator.compile(compiler, task),
2458
- ...await this.microFunctionGenerator.compile(compiler, task)
2459
- ];
2460
- compiler.context.artifacts.push(...artifacts);
2461
- });
2462
- }
2463
- static register(compiler) {
2464
- if (!MetadataStorage.has(compiler)) {
2465
- MetadataStorage.set(compiler, {
2466
- hooks: {
2467
- afterEntrypointArtifactGenerated: new import_tapable2.AsyncSeriesWaterfallHook(["artifact", "task"]),
2468
- afterMicroFunctionArtifactGenerated: new import_tapable2.AsyncSeriesWaterfallHook(["artifact", "operationDefinition", "task"])
2469
- }
2470
- });
2471
- }
2472
- return MetadataStorage.get(compiler);
2473
- }
2474
- static of(compiler) {
2475
- return this.register(compiler);
2476
- }
2477
- };
2478
-
2479
- // src/plugins/generate-nestjs-module/generate-nestjs-module.ts
2480
- var import_tapable3 = require("tapable");
2481
-
2482
- // src/plugins/generate-nestjs-module/constants/metadata-storage.ts
2483
- var MetadataStorage3 = /* @__PURE__ */ new WeakMap();
2484
-
2485
- // src/plugins/generate-nestjs-module/generators/nestjs-module.generator.ts
2486
- var path11 = __toESM(require("path"), 1);
2487
- var changeCase7 = __toESM(require("change-case"), 1);
2488
- var NESTJS_MODULE_GENERATOR = "nestjs-module-generator";
2489
- var NestjsModuleGenerator = class _NestjsModuleGenerator {
2490
- generateNestjsModuleArtifact(document, rc) {
2491
- const filepath = _NestjsModuleGenerator.getNestjsModuleArtifactFilepath(document, rc.fileNamingStyle);
2492
- const dirname6 = path11.dirname(filepath);
2493
- const artifact = new Artifact({
2494
- id: _NestjsModuleGenerator.getNestjsModuleArtifactId(document),
2495
- filepath,
2496
- content: ApiDocumentTransformer.toNestjsModule(document, {
2497
- esm: rc.esm,
2498
- getNestjsClientFilepath(document2) {
2499
- const relativePath = path11.relative(
2500
- dirname6,
2501
- _NestjsModuleGenerator.getNestjsClientArtifactFilepath(document2, rc.fileNamingStyle)
2502
- );
2503
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2504
- }
2505
- })
2506
- });
2507
- return artifact;
2508
- }
2509
- generateNestjsClientArtifact(document, rc) {
2510
- const filepath = _NestjsModuleGenerator.getNestjsClientArtifactFilepath(document, rc.fileNamingStyle);
2511
- const dirpath = path11.dirname(filepath);
2512
- const artifact = new Artifact({
2513
- id: _NestjsModuleGenerator.getNestjsClientArtifactId(document),
2514
- filepath,
2515
- content: ApiDocumentTransformer.toNestjsClient(document, {
2516
- esm: rc.esm,
2517
- getOperationDefinitionDeclarationFilepath(operationDefinition) {
2518
- const relativePath = path11.relative(
2519
- dirpath,
2520
- OperationDeclarationGenerator.getOperationDefinitionArtifactFilepath(operationDefinition, rc.fileNamingStyle)
2521
- );
2522
- return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
2523
- }
2524
- })
2525
- });
2526
- return artifact;
2527
- }
2528
- async compile(compiler, task) {
2529
- const metadata = MetadataStorage3.get(compiler);
2530
- const rc = compiler.context.rc;
2531
- const documents = compiler.context.documents;
2532
- const nestjsModuleArtifacts = await Promise.all(
2533
- documents.map((document) => metadata.hooks.afterNestjsModuleArtifactGenerated.promise(
2534
- this.generateNestjsModuleArtifact(document, rc),
2535
- document,
2536
- task
2537
- ))
2538
- );
2539
- const nestjsClientArtifacts = await Promise.all(
2540
- documents.map((document) => metadata.hooks.afterNestjsModuleArtifactGenerated.promise(
2541
- this.generateNestjsClientArtifact(document, rc),
2542
- document,
2543
- task
2544
- ))
2545
- );
2546
- return [...nestjsModuleArtifacts, ...nestjsClientArtifacts];
2547
- }
2548
- static getNestjsModuleArtifactFilepath(document, fileNamingStyle) {
2549
- const filename = `${changeCase7[fileNamingStyle](document.module.name)}.module.ts`;
2550
- const filepath = [
2551
- ".",
2552
- changeCase7[fileNamingStyle](document.module.name),
2553
- filename
2554
- ];
2555
- return filepath.join("/");
2556
- }
2557
- static getNestjsModuleArtifactId(document) {
2558
- return `${document.module.address}?generate=${NESTJS_MODULE_GENERATOR}`;
2559
- }
2560
- static getNestjsClientArtifactFilepath(document, fileNamingStyle) {
2561
- const filename = `${changeCase7[fileNamingStyle](document.module.name)}.client.ts`;
2562
- const filepath = [
2563
- ".",
2564
- changeCase7[fileNamingStyle](document.module.name),
2565
- filename
2566
- ];
2567
- return filepath.join("/");
2568
- }
2569
- static getNestjsClientArtifactId(document) {
2570
- return `${document.module.address}?generate=${NESTJS_MODULE_GENERATOR}-client`;
2571
- }
2572
- };
2573
-
2574
- // src/plugins/generate-nestjs-module/generate-nestjs-module.ts
2575
- var GenerateNestjsModulePlugin = class _GenerateNestjsModulePlugin {
2576
- nestjsModuleGenerator = new NestjsModuleGenerator();
2577
- apply(compiler) {
2578
- _GenerateNestjsModulePlugin.register(compiler);
2579
- compiler.hooks.compile.tapPromise(_GenerateNestjsModulePlugin.name, async (task) => {
2580
- const artifacts = await this.nestjsModuleGenerator.compile(compiler, task);
2581
- compiler.context.artifacts.push(...artifacts);
2582
- });
2583
- }
2584
- static register(compiler) {
2585
- if (!MetadataStorage3.has(compiler)) {
2586
- MetadataStorage3.set(compiler, {
2587
- hooks: {
2588
- afterNestjsModuleArtifactGenerated: new import_tapable3.AsyncSeriesWaterfallHook(["artifact", "document", "task"])
2589
- }
2590
- });
2591
- }
2592
- return MetadataStorage3.get(compiler);
2593
- }
2594
- static of(compiler) {
2595
- return MetadataStorage3.get(compiler);
2596
- }
2597
- };
2598
-
2599
- // src/plugins/chinese-to-pinyin/chinese-to-pinyin.plugin.ts
2600
- var import_swagger_fix = require("swagger-fix");
2601
-
2602
- // src/plugins/download-http-file/download-http-file.plugin.ts
2603
- var DownloadHttpFilePlugin = class _DownloadHttpFilePlugin {
2604
- apply(compiler) {
2605
- compiler.hooks.download.tapPromise(_DownloadHttpFilePlugin.name, async (address, task) => {
2606
- const { url } = address;
2607
- if (!url.startsWith("http://") && !url.startsWith("https://")) return void 0;
2608
- const content = await this.download(address);
2609
- const spec = this.deserialize(content);
2610
- return JSON.stringify(spec);
2611
- });
2612
- }
2613
- async download(address) {
2614
- const { url, headers } = address;
2615
- try {
2616
- const res = await fetch(url, { headers });
2617
- if (res.status >= 400) throw new Error(`failed with status code ${res.status}`);
2618
- return await res.text();
2619
- } catch (e) {
2620
- if (e instanceof Error) {
2621
- e.message = `Unable get the openapi/swagger file from ${url}: ${e.message}`;
2622
- }
2623
- throw e;
2624
- }
2625
- }
2626
- deserialize(content) {
2627
- const json = JSON.parse(content);
2628
- const spec = OpenapiUtils.to3_1(json);
2629
- return spec;
2630
- }
2631
- };
2632
-
2633
- // src/plugins/download-local-file/download-local-file.plugin.ts
2634
- var path12 = __toESM(require("path"), 1);
2635
- var fs5 = __toESM(require("fs/promises"), 1);
2636
- var yaml = __toESM(require("js-yaml"), 1);
2637
- var import_url = require("url");
2638
- var DownloadLocalFilePlugin = class _DownloadLocalFilePlugin {
2639
- apply(compiler) {
2640
- compiler.hooks.download.tapPromise(_DownloadLocalFilePlugin.name, async (address, task) => {
2641
- const { url, encoding } = address;
2642
- if (!url.startsWith("file://")) return void 0;
2643
- const filepath = (0, import_url.fileURLToPath)(url);
2644
- const fileExt = path12.extname(filepath);
2645
- const content = await fs5.readFile(filepath, encoding);
2646
- const str = typeof content === "string" ? content : content.toString(encoding);
2647
- if ([".yml", ".yaml"].includes(fileExt)) {
2648
- const value = yaml.load(str);
2649
- return JSON.stringify(OpenapiUtils.to3_1(value));
2650
- } else if (fileExt === ".json") {
2651
- return JSON.stringify(OpenapiUtils.to3_1(JSON.parse(str)));
2652
- }
2653
- });
2654
- }
2655
- };
2656
-
2657
- // src/plugins/shaking/shaking.plugin.ts
2658
- var import_openapi_shaking = require("@opendoc/openapi-shaking");
2659
- var ShakingPlugin = class _ShakingPlugin {
2660
- apply(compiler) {
2661
- compiler.hooks.beforeCompile.tap(_ShakingPlugin.name, (task) => {
2662
- const matcher = compiler.context.matcher;
2663
- const documents = compiler.context.documents;
2664
- compiler.context.documents = documents.map((document) => this.shaking(compiler, document)).filter((document) => !document.isEmpty()).filter((document) => !matcher.isModuleIgnored(document.module));
2665
- });
2666
- }
2667
- shaking(compiler, document) {
2668
- const rc = compiler.context.rc;
2669
- const matcher = compiler.context.matcher;
2670
- const isAccepted = (pathname, method, operation) => {
2671
- if (!SupportedMethods.includes(method)) return false;
2672
- return !matcher.isOperationIgnored(new OperationDefinition({
2673
- method,
2674
- pathname,
2675
- operation,
2676
- module: document.module,
2677
- document
2678
- }));
2679
- };
2680
- const sharkedSwagger = (0, import_openapi_shaking.openapiShakingSync)(
2681
- document.specification,
2682
- isAccepted,
2683
- { tolerant: rc.tolerant }
2684
- );
2685
- return new ApiDocumentV3_1(
2686
- sharkedSwagger,
2687
- new ModuleDefinition(
2688
- document.module.name,
2689
- {
2690
- url: `memory://${document.module.name}.v3_1.sharked.json`,
2691
- headers: {},
2692
- encoding: "utf8"
2693
- }
2694
- )
2695
- );
2696
- }
2697
- };
2698
-
2699
- // src/plugins/terminal-select/utils/select-operation-definitions.ts
2700
- var import_inquirer_select_pro = require("inquirer-select-pro");
2701
- var import_prompt_adapter_inquirer = require("@listr2/prompt-adapter-inquirer");
2702
- async function selectOperationDefinitions(task, operationDefinitions) {
2703
- const selectedOperationDefinitions = await task.prompt(import_prompt_adapter_inquirer.ListrInquirerPromptAdapter).run(
2704
- import_inquirer_select_pro.select,
2705
- {
2706
- message: "Select Pathname",
2707
- defaultValue: [],
2708
- options: (input) => {
2709
- const items = operationDefinitions.map((op) => ({ name: `${op.module.name} ${op.method.toUpperCase()} ${op.pathname}`, value: op }));
2710
- if (!input) return items;
2711
- const keys2 = input.trim().toLowerCase().split(/\s+/);
2712
- return items.filter((i) => {
2713
- const name = i.name.toLowerCase();
2714
- return keys2.every((q) => name.includes(q));
2715
- });
2716
- }
2717
- }
2718
- );
2719
- return selectedOperationDefinitions;
2720
- }
2721
-
2722
- // src/plugins/terminal-select/terminal-select.plugin.ts
2723
- var TerminalSelectPlugin = class _TerminalSelectPlugin {
2724
- constructor(options) {
2725
- this.options = options;
2726
- }
2727
- apply(compiler) {
2728
- compiler.hooks.afterDownload.tapPromise(_TerminalSelectPlugin.name, async (task) => {
2729
- const context = compiler.context;
2730
- const matcher = context.matcher;
2731
- const documents = context.documents;
2732
- const operationDefinitions = documents.flatMap((document) => document.operations);
2733
- const selectedOperationDefinitions = await selectOperationDefinitions(task, operationDefinitions);
2734
- if (this.options.clear) {
2735
- matcher.append({
2736
- persist: false,
2737
- ignore: true,
2738
- moduleName: "*",
2739
- operationMethod: "*",
2740
- operationPathname: "*"
2741
- });
2742
- }
2743
- for (const op of selectedOperationDefinitions) {
2744
- matcher.append({
2745
- persist: !!this.options.persist,
2746
- ignore: this.options.mode === "add",
2747
- moduleName: op.module.name,
2748
- operationMethod: op.method,
2749
- operationPathname: op.pathname
2750
- });
2751
- }
2752
- });
2753
- }
2754
- };
2755
-
2756
- // src/plugins/initialize/initialize.plugin.ts
2757
- var R23 = __toESM(require("ramda"), 1);
2758
- var InitializePlugin = class _InitializePlugin {
2759
- constructor(options) {
2760
- this.options = options;
2761
- }
2762
- apply(compiler) {
2763
- compiler.hooks.setup.tap(_InitializePlugin.name, (task) => {
2764
- new DownloadHttpFilePlugin().apply(compiler);
2765
- new DownloadLocalFilePlugin().apply(compiler);
2766
- new GenerateDeclarationPlugin().apply(compiler);
2767
- if (this.options.build) {
2768
- new ShakingPlugin().apply(compiler);
2769
- }
2770
- if (this.options.interactive) {
2771
- new TerminalSelectPlugin(
2772
- typeof this.options.interactive === "object" ? this.options.interactive : { mode: "except" }
2773
- ).apply(compiler);
2774
- }
2775
- const rc = compiler.context.rc;
2776
- if (rc.mode === "micro-function") {
2777
- new GenerateMicroFunctionPlugin().apply(compiler);
2778
- } else if (rc.mode === "nestjs-module") {
2779
- new GenerateNestjsModulePlugin().apply(compiler);
2780
- }
2781
- if (rc.plugins && rc.plugins.length) {
2782
- for (const plugin of rc.plugins) {
2783
- plugin.apply(compiler);
2784
- }
2785
- }
2786
- });
2787
- if (this.options.includes && this.options.includes.length) {
2788
- const modulesIncludes = this.options.includes;
2789
- compiler.hooks.afterSetup.tap(_InitializePlugin.name, (task) => {
2790
- const rc = compiler.context.rc;
2791
- const matcher = compiler.context.matcher;
2792
- const notExistModules = modulesIncludes.filter((moduleName) => !(moduleName in rc.modules));
2793
- if (notExistModules.length) {
2794
- throw new Error(`Cannot find module(s) ${notExistModules.join(", ")} in config file.`);
2795
- }
2796
- const ignoredModules = R23.difference(R23.keys(rc.modules), modulesIncludes);
2797
- for (const moduleName of ignoredModules) {
2798
- matcher.append({
2799
- persist: false,
2800
- ignore: true,
2801
- moduleName,
2802
- operationMethod: "*",
2803
- operationPathname: "*"
2804
- });
2805
- }
2806
- });
2807
- }
2808
- }
2809
- };
2810
-
2811
- // src/plugins/overwrite-query-options/overwrite-query-options.plugin.ts
2812
- var QsArrayFormatUnion = Object.values(QsArrayFormat);
2813
-
2814
- // src/compiler/compiler.ts
2815
- var Compiler = class {
2816
- constructor(options) {
2817
- this.options = options;
2818
- for (const hook of Object.values(this.hooks)) {
2819
- hook.intercept(perfectErrorMessage());
2820
- }
2821
- this.hooks.afterSetup.intercept(printInformation(0));
2822
- this.hooks.afterPersist.intercept(printInformation(0));
2823
- new InitializePlugin({
2824
- build: options.build,
2825
- interactive: options.interactive,
2826
- includes: options.includes
2827
- }).apply(this);
2828
- }
2829
- context = {};
2830
- hooks = {
2831
- setup: new import_tapable4.AsyncParallelHook(["task"]),
2832
- afterSetup: new import_tapable4.AsyncSeriesHook(["task"]),
2833
- beforeDownload: new import_tapable4.AsyncSeriesHook(["task"]),
2834
- download: new import_tapable4.AsyncSeriesBailHook(["address", "moduleDefinition", "task"]),
2835
- afterDownload: new import_tapable4.AsyncSeriesHook(["task"]),
2836
- beforeCompile: new import_tapable4.AsyncSeriesHook(["task"]),
2837
- compile: new import_tapable4.AsyncParallelHook(["task"]),
2838
- afterCompile: new import_tapable4.AsyncSeriesHook(["task"]),
2839
- beforePersist: new import_tapable4.AsyncSeriesHook(["task"]),
2840
- persist: new import_tapable4.AsyncParallelHook(["task"]),
2841
- afterPersist: new import_tapable4.AsyncSeriesHook(["task"]),
2842
- done: new import_tapable4.SyncHook()
2843
- };
2844
- async run() {
2845
- const options = this.options;
2846
- const tasks = new import_listr22.Listr(
2847
- [
2848
- createSetupTask(this, options),
2849
- createDownloadTask(this, { skipIgnoredModules: !options.interactive }),
2850
- createCompileTask(this, { enabled: !!options.build }),
2851
- createPersistTask(this)
2852
- ],
2853
- {
2854
- concurrent: false,
2855
- renderer: "default",
2856
- rendererOptions: {
2857
- suffixSkips: true,
2858
- collapseSubtasks: false,
2859
- collapseErrors: false
2860
- }
2861
- }
2862
- );
2863
- await tasks.run(this.context);
2864
- await this.hooks.done.promise();
2865
- }
2866
- };
2867
-
2868
- // src/cli.ts
2869
- if (import_semver.default.lt(process.version, "20.0.0")) {
2870
- throw new Error("Node.js version must be greater than 20");
2871
- }
2872
- var program = new import_commander.Command();
2873
- program.command("build").option("-c --config <config>", "The keq-cli config file").option("--module <modules...>", "Filter module(s) to generate").option("--debug", "Print debug information").option("--tolerant", "Tolerate wrong swagger/openapi structure").option("-i --interactive", "Interactive select the scope of generation").action(async (options) => {
2874
- const compiler = new Compiler({
2875
- build: true,
2876
- config: options.config,
2877
- includes: options.module,
2878
- debug: !!options.debug,
2879
- tolerant: !!options.tolerant,
2880
- interactive: !!options.interactive && {
2881
- mode: "except",
2882
- clear: true
2883
- }
2884
- });
2885
- await compiler.run();
2886
- });
2887
- program.command("ignore").addArgument(
2888
- new import_commander.Argument("<mode>", "The ignore mode").choices(["all", "add", "except"]).argRequired()
2889
- ).option("-c --config <config>", "The keq-cli config file").option("--debug", "Print debug information").option("--module <modules...>").option("--build", "Build after updating .keqignore file").addOption(
2890
- new import_commander.Option("--method <method>", "Only generate files of the specified operation method").choices([
2891
- ...SupportedMethods,
2892
- ...SupportedMethods.map((method) => method.toUpperCase())
2893
- ])
2894
- ).option("--pathname <pathnames>", "Only generate files of the specified operation pathname").option("-i --interactive", "Interactive select the scope of generation").action(async (mode, options) => {
2895
- let compiler;
2896
- if (mode === "all") {
2897
- if (options.build) throw new Error("'--build' cannot be used with 'all' mode");
2898
- compiler = new Compiler({
2899
- build: false,
2900
- config: options.config,
2901
- includes: options.module,
2902
- debug: !!options.debug,
2903
- interactive: false,
2904
- ignore: {
2905
- rules: [{
2906
- persist: true,
2907
- ignore: true,
2908
- moduleName: "*",
2909
- operationMethod: "*",
2910
- operationPathname: "*"
2911
- }]
2912
- }
2913
- });
2914
- } else if (options.interactive) {
2915
- if (options.interactive) {
2916
- if (options.method) throw new Error("'--method' cannot be used with '--interactive'");
2917
- if (options.pathname) throw new Error("'--pathname' cannot be used with '--interactive'");
2918
- }
2919
- compiler = new Compiler({
2920
- build: !!options.build,
2921
- config: options.config,
2922
- includes: options.module,
2923
- debug: !!options.debug,
2924
- interactive: {
2925
- mode,
2926
- persist: true
2927
- }
2928
- });
2929
- } else {
2930
- if (!options.method && !options.pathname) {
2931
- throw new Error("at least one of '-i --interactive', '--method' or '--pathname' must be specified");
2932
- }
2933
- const moduleNames = options.module || ["*"];
2934
- compiler = new Compiler({
2935
- build: !!options.build,
2936
- config: options.config,
2937
- debug: !!options.debug,
2938
- includes: options.module,
2939
- ignore: {
2940
- rules: moduleNames.map((moduleNames2) => ({
2941
- persist: true,
2942
- ignore: mode === "add",
2943
- moduleName: moduleNames2,
2944
- operationMethod: options.method,
2945
- operationPathname: options.pathname
2946
- }))
2947
- },
2948
- interactive: false
2949
- });
2950
- }
2951
- await compiler.run();
2952
- });
2953
- async function main5() {
2954
- program.on("command:*", function(operands) {
2955
- throw new Error(`Unknown command '${String(operands[0])}'`);
2956
- });
2957
- try {
2958
- await program.parseAsync(process.argv);
2959
- } catch (err) {
2960
- if (process.argv.includes("--debug")) {
2961
- console.error(err);
2962
- } else {
2963
- logger.error(err instanceof Error ? err.message : String(err));
2964
- }
2965
- }
2966
- }
2967
- void main5();
2968
- //# sourceMappingURL=cli.cjs.map