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