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