@redocly/client-generator 0.3.7 → 0.4.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 (617) hide show
  1. package/README.md +32 -54
  2. package/eject-assets/AGENTS.md +137 -0
  3. package/eject-assets/generators/cli/docs.ts +224 -0
  4. package/eject-assets/generators/cli/engine-source.ts +21 -0
  5. package/eject-assets/generators/cli/index.ts +90 -0
  6. package/eject-assets/generators/cli/render.ts +348 -0
  7. package/eject-assets/generators/go/client.ts +57 -0
  8. package/eject-assets/generators/go/descriptor.ts +41 -0
  9. package/eject-assets/generators/go/index.ts +336 -0
  10. package/eject-assets/generators/go/models.ts +179 -0
  11. package/eject-assets/generators/go/naming.ts +49 -0
  12. package/eject-assets/generators/go/operations.ts +296 -0
  13. package/eject-assets/generators/go/pagination.ts +194 -0
  14. package/eject-assets/generators/go/types.ts +60 -0
  15. package/eject-assets/generators/mock/faker.ts +214 -0
  16. package/eject-assets/generators/mock/index.ts +35 -0
  17. package/eject-assets/generators/mock/render.ts +282 -0
  18. package/eject-assets/generators/mock/sample.ts +316 -0
  19. package/eject-assets/generators/mock/values.ts +63 -0
  20. package/eject-assets/generators/php/client.ts +63 -0
  21. package/eject-assets/generators/php/descriptor.ts +58 -0
  22. package/eject-assets/generators/php/index.ts +237 -0
  23. package/eject-assets/generators/php/models.ts +275 -0
  24. package/eject-assets/generators/php/naming.ts +51 -0
  25. package/eject-assets/generators/php/operations.ts +232 -0
  26. package/eject-assets/generators/php/pagination.ts +133 -0
  27. package/eject-assets/generators/php/types.ts +148 -0
  28. package/eject-assets/generators/python/client.ts +123 -0
  29. package/eject-assets/generators/python/descriptor.ts +52 -0
  30. package/eject-assets/generators/python/index.ts +251 -0
  31. package/eject-assets/generators/python/models.ts +242 -0
  32. package/eject-assets/generators/python/naming.ts +46 -0
  33. package/eject-assets/generators/python/operations.ts +147 -0
  34. package/eject-assets/generators/python/pagination.ts +128 -0
  35. package/eject-assets/generators/python/types.ts +54 -0
  36. package/eject-assets/generators/swr/index.ts +37 -0
  37. package/eject-assets/generators/swr/render.ts +78 -0
  38. package/eject-assets/generators/tanstack-query/index.ts +48 -0
  39. package/eject-assets/generators/tanstack-query/render.ts +346 -0
  40. package/eject-assets/generators/transformers/index.ts +46 -0
  41. package/eject-assets/generators/transformers/render.ts +506 -0
  42. package/eject-assets/generators/typescript/banner.ts +35 -0
  43. package/eject-assets/generators/typescript/client.ts +254 -0
  44. package/eject-assets/generators/typescript/descriptor.ts +137 -0
  45. package/eject-assets/generators/typescript/index.ts +101 -0
  46. package/eject-assets/generators/typescript/inline-runtime.ts +135 -0
  47. package/eject-assets/generators/typescript/operation-signature.ts +62 -0
  48. package/eject-assets/generators/typescript/operation-types.ts +17 -0
  49. package/eject-assets/generators/typescript/operations.ts +524 -0
  50. package/eject-assets/generators/typescript/response-headers.ts +74 -0
  51. package/eject-assets/generators/typescript/type-guards.ts +159 -0
  52. package/eject-assets/generators/typescript/types.ts +172 -0
  53. package/eject-assets/generators/zod/index.ts +32 -0
  54. package/eject-assets/generators/zod/schemas.ts +456 -0
  55. package/eject-assets/skills/cli-generator/SKILL.md +121 -0
  56. package/eject-assets/skills/client-generators/SKILL.md +142 -0
  57. package/eject-assets/skills/go-generator/SKILL.md +96 -0
  58. package/eject-assets/skills/mock-generator/SKILL.md +50 -0
  59. package/eject-assets/skills/php-generator/SKILL.md +112 -0
  60. package/eject-assets/skills/python-generator/SKILL.md +110 -0
  61. package/eject-assets/skills/swr-generator/SKILL.md +50 -0
  62. package/eject-assets/skills/tanstack-query-generator/SKILL.md +55 -0
  63. package/eject-assets/skills/transformers-generator/SKILL.md +47 -0
  64. package/eject-assets/skills/typescript-generator/SKILL.md +95 -0
  65. package/eject-assets/skills/zod-generator/SKILL.md +54 -0
  66. package/lib/authoring/index.d.ts +11 -0
  67. package/lib/authoring/index.d.ts.map +1 -0
  68. package/lib/authoring/index.js +42 -0
  69. package/lib/authoring/index.js.map +1 -0
  70. package/lib/authoring/naming.d.ts +34 -0
  71. package/lib/authoring/naming.d.ts.map +1 -0
  72. package/lib/authoring/naming.js +104 -0
  73. package/lib/authoring/naming.js.map +1 -0
  74. package/lib/authoring/operation.d.ts +47 -0
  75. package/lib/authoring/operation.d.ts.map +1 -0
  76. package/lib/authoring/operation.js +86 -0
  77. package/lib/authoring/operation.js.map +1 -0
  78. package/lib/authoring/options.d.ts +9 -0
  79. package/lib/authoring/options.d.ts.map +1 -0
  80. package/lib/authoring/options.js +5 -0
  81. package/lib/authoring/options.js.map +1 -0
  82. package/lib/authoring/pagination.d.ts +19 -0
  83. package/lib/authoring/pagination.d.ts.map +1 -0
  84. package/lib/authoring/pagination.js +45 -0
  85. package/lib/authoring/pagination.js.map +1 -0
  86. package/lib/authoring/printer.d.ts +16 -0
  87. package/lib/authoring/printer.d.ts.map +1 -0
  88. package/lib/authoring/printer.js +36 -0
  89. package/lib/authoring/printer.js.map +1 -0
  90. package/lib/authoring/reference-page.d.ts +31 -0
  91. package/lib/authoring/reference-page.d.ts.map +1 -0
  92. package/lib/authoring/reference-page.js +160 -0
  93. package/lib/authoring/reference-page.js.map +1 -0
  94. package/lib/authoring/schema.d.ts +51 -0
  95. package/lib/authoring/schema.d.ts.map +1 -0
  96. package/lib/authoring/schema.js +190 -0
  97. package/lib/authoring/schema.js.map +1 -0
  98. package/lib/cli-contract.d.ts +126 -0
  99. package/lib/cli-contract.d.ts.map +1 -0
  100. package/lib/cli-contract.js +25 -0
  101. package/lib/cli-contract.js.map +1 -0
  102. package/lib/{emitters/wrapper-support.d.ts → contracts/typescript.d.ts} +13 -24
  103. package/lib/contracts/typescript.d.ts.map +1 -0
  104. package/lib/contracts/typescript.js +87 -0
  105. package/lib/contracts/typescript.js.map +1 -0
  106. package/lib/generate.d.ts +10 -10
  107. package/lib/generate.d.ts.map +1 -1
  108. package/lib/generate.js +25 -106
  109. package/lib/generate.js.map +1 -1
  110. package/lib/generators/cli/docs.d.ts +19 -0
  111. package/lib/generators/cli/docs.d.ts.map +1 -0
  112. package/lib/generators/cli/docs.js +187 -0
  113. package/lib/generators/cli/docs.js.map +1 -0
  114. package/lib/generators/cli/engine-source.d.ts +5 -0
  115. package/lib/generators/cli/engine-source.d.ts.map +1 -0
  116. package/lib/generators/cli/engine-source.js +12 -0
  117. package/lib/generators/cli/engine-source.js.map +1 -0
  118. package/lib/generators/cli/index.d.ts +18 -0
  119. package/lib/generators/cli/index.d.ts.map +1 -0
  120. package/lib/generators/cli/index.js +67 -0
  121. package/lib/generators/cli/index.js.map +1 -0
  122. package/lib/generators/cli/render.d.ts +39 -0
  123. package/lib/generators/cli/render.d.ts.map +1 -0
  124. package/lib/generators/cli/render.js +281 -0
  125. package/lib/generators/cli/render.js.map +1 -0
  126. package/lib/generators/cli/runtime/cli.d.ts +42 -0
  127. package/lib/generators/cli/runtime/cli.d.ts.map +1 -0
  128. package/lib/generators/cli/runtime/cli.js +582 -0
  129. package/lib/generators/cli/runtime/cli.js.map +1 -0
  130. package/lib/generators/compatibility.d.ts +10 -0
  131. package/lib/generators/compatibility.d.ts.map +1 -0
  132. package/lib/generators/compatibility.js +45 -0
  133. package/lib/generators/compatibility.js.map +1 -0
  134. package/lib/generators/go/client.d.ts +5 -0
  135. package/lib/generators/go/client.d.ts.map +1 -0
  136. package/lib/generators/go/client.js +34 -0
  137. package/lib/generators/go/client.js.map +1 -0
  138. package/lib/generators/go/descriptor.d.ts +6 -0
  139. package/lib/generators/go/descriptor.d.ts.map +1 -0
  140. package/lib/generators/go/descriptor.js +26 -0
  141. package/lib/generators/go/descriptor.js.map +1 -0
  142. package/lib/generators/go/index.d.ts +14 -0
  143. package/lib/generators/go/index.d.ts.map +1 -0
  144. package/lib/generators/go/index.js +240 -0
  145. package/lib/generators/go/index.js.map +1 -0
  146. package/lib/generators/go/models.d.ts +4 -0
  147. package/lib/generators/go/models.d.ts.map +1 -0
  148. package/lib/generators/go/models.js +125 -0
  149. package/lib/generators/go/models.js.map +1 -0
  150. package/lib/generators/go/naming.d.ts +15 -0
  151. package/lib/generators/go/naming.d.ts.map +1 -0
  152. package/lib/generators/go/naming.js +36 -0
  153. package/lib/generators/go/naming.js.map +1 -0
  154. package/lib/generators/go/operations.d.ts +16 -0
  155. package/lib/generators/go/operations.d.ts.map +1 -0
  156. package/lib/generators/go/operations.js +200 -0
  157. package/lib/generators/go/operations.js.map +1 -0
  158. package/lib/generators/go/pagination.d.ts +5 -0
  159. package/lib/generators/go/pagination.d.ts.map +1 -0
  160. package/lib/generators/go/pagination.js +93 -0
  161. package/lib/generators/go/pagination.js.map +1 -0
  162. package/lib/generators/go/types.d.ts +4 -0
  163. package/lib/generators/go/types.d.ts.map +1 -0
  164. package/lib/generators/go/types.js +48 -0
  165. package/lib/generators/go/types.js.map +1 -0
  166. package/lib/generators/index.d.ts +2 -3
  167. package/lib/generators/index.d.ts.map +1 -1
  168. package/lib/generators/index.js +31 -53
  169. package/lib/generators/index.js.map +1 -1
  170. package/lib/generators/meta.d.ts +13 -0
  171. package/lib/generators/meta.d.ts.map +1 -0
  172. package/lib/generators/meta.js +157 -0
  173. package/lib/generators/meta.js.map +1 -0
  174. package/lib/{emitters → generators/mock}/faker.d.ts +4 -5
  175. package/lib/generators/mock/faker.d.ts.map +1 -0
  176. package/lib/generators/mock/faker.js +180 -0
  177. package/lib/generators/mock/faker.js.map +1 -0
  178. package/lib/generators/{mock.d.ts → mock/index.d.ts} +2 -2
  179. package/lib/generators/mock/index.d.ts.map +1 -0
  180. package/lib/generators/{mock.js → mock/index.js} +8 -8
  181. package/lib/generators/mock/index.js.map +1 -0
  182. package/lib/{emitters/mock.d.ts → generators/mock/render.d.ts} +2 -3
  183. package/lib/generators/mock/render.d.ts.map +1 -0
  184. package/lib/generators/mock/render.js +228 -0
  185. package/lib/generators/mock/render.js.map +1 -0
  186. package/lib/{emitters → generators/mock}/sample.d.ts +1 -2
  187. package/lib/generators/mock/sample.d.ts.map +1 -0
  188. package/lib/generators/mock/sample.js.map +1 -0
  189. package/lib/generators/mock/values.d.ts +33 -0
  190. package/lib/generators/mock/values.d.ts.map +1 -0
  191. package/lib/generators/mock/values.js +46 -0
  192. package/lib/generators/mock/values.js.map +1 -0
  193. package/lib/generators/options.d.ts +7 -0
  194. package/lib/generators/options.d.ts.map +1 -0
  195. package/lib/generators/options.js +74 -0
  196. package/lib/generators/options.js.map +1 -0
  197. package/lib/generators/php/client.d.ts +5 -0
  198. package/lib/generators/php/client.d.ts.map +1 -0
  199. package/lib/generators/php/client.js +38 -0
  200. package/lib/generators/php/client.js.map +1 -0
  201. package/lib/generators/php/descriptor.d.ts +7 -0
  202. package/lib/generators/php/descriptor.d.ts.map +1 -0
  203. package/lib/generators/php/descriptor.js +42 -0
  204. package/lib/generators/php/descriptor.js.map +1 -0
  205. package/lib/generators/php/index.d.ts +14 -0
  206. package/lib/generators/php/index.d.ts.map +1 -0
  207. package/lib/generators/php/index.js +166 -0
  208. package/lib/generators/php/index.js.map +1 -0
  209. package/lib/generators/php/models.d.ts +8 -0
  210. package/lib/generators/php/models.d.ts.map +1 -0
  211. package/lib/generators/php/models.js +200 -0
  212. package/lib/generators/php/models.js.map +1 -0
  213. package/lib/generators/php/naming.d.ts +16 -0
  214. package/lib/generators/php/naming.d.ts.map +1 -0
  215. package/lib/generators/php/naming.js +31 -0
  216. package/lib/generators/php/naming.js.map +1 -0
  217. package/lib/generators/php/operations.d.ts +21 -0
  218. package/lib/generators/php/operations.d.ts.map +1 -0
  219. package/lib/generators/php/operations.js +156 -0
  220. package/lib/generators/php/operations.js.map +1 -0
  221. package/lib/generators/php/pagination.d.ts +5 -0
  222. package/lib/generators/php/pagination.d.ts.map +1 -0
  223. package/lib/generators/php/pagination.js +68 -0
  224. package/lib/generators/php/pagination.js.map +1 -0
  225. package/lib/generators/php/types.d.ts +27 -0
  226. package/lib/generators/php/types.d.ts.map +1 -0
  227. package/lib/generators/php/types.js +128 -0
  228. package/lib/generators/php/types.js.map +1 -0
  229. package/lib/generators/python/client.d.ts +6 -0
  230. package/lib/generators/python/client.d.ts.map +1 -0
  231. package/lib/generators/python/client.js +80 -0
  232. package/lib/generators/python/client.js.map +1 -0
  233. package/lib/generators/python/descriptor.d.ts +9 -0
  234. package/lib/generators/python/descriptor.d.ts.map +1 -0
  235. package/lib/generators/python/descriptor.js +38 -0
  236. package/lib/generators/python/descriptor.js.map +1 -0
  237. package/lib/generators/python/index.d.ts +15 -0
  238. package/lib/generators/python/index.d.ts.map +1 -0
  239. package/lib/generators/python/index.js +197 -0
  240. package/lib/generators/python/index.js.map +1 -0
  241. package/lib/generators/python/models.d.ts +31 -0
  242. package/lib/generators/python/models.d.ts.map +1 -0
  243. package/lib/generators/python/models.js +203 -0
  244. package/lib/generators/python/models.js.map +1 -0
  245. package/lib/generators/python/naming.d.ts +22 -0
  246. package/lib/generators/python/naming.d.ts.map +1 -0
  247. package/lib/generators/python/naming.js +28 -0
  248. package/lib/generators/python/naming.js.map +1 -0
  249. package/lib/generators/python/operations.d.ts +4 -0
  250. package/lib/generators/python/operations.d.ts.map +1 -0
  251. package/lib/generators/python/operations.js +108 -0
  252. package/lib/generators/python/operations.js.map +1 -0
  253. package/lib/generators/python/pagination.d.ts +5 -0
  254. package/lib/generators/python/pagination.d.ts.map +1 -0
  255. package/lib/generators/python/pagination.js +95 -0
  256. package/lib/generators/python/pagination.js.map +1 -0
  257. package/lib/generators/python/types.d.ts +4 -0
  258. package/lib/generators/python/types.d.ts.map +1 -0
  259. package/lib/generators/python/types.js +45 -0
  260. package/lib/generators/python/types.js.map +1 -0
  261. package/lib/generators/resolve.d.ts.map +1 -1
  262. package/lib/generators/resolve.js +92 -13
  263. package/lib/generators/resolve.js.map +1 -1
  264. package/lib/generators/{swr.d.ts → swr/index.d.ts} +3 -3
  265. package/lib/generators/swr/index.d.ts.map +1 -0
  266. package/lib/generators/{swr.js → swr/index.js} +7 -10
  267. package/lib/generators/swr/index.js.map +1 -0
  268. package/lib/{emitters/swr.d.ts → generators/swr/render.d.ts} +2 -4
  269. package/lib/generators/swr/render.d.ts.map +1 -0
  270. package/lib/generators/swr/render.js +57 -0
  271. package/lib/generators/swr/render.js.map +1 -0
  272. package/lib/generators/{tanstack-query.d.ts → tanstack-query/index.d.ts} +3 -3
  273. package/lib/generators/tanstack-query/index.d.ts.map +1 -0
  274. package/lib/generators/{tanstack-query.js → tanstack-query/index.js} +11 -10
  275. package/lib/generators/tanstack-query/index.js.map +1 -0
  276. package/lib/{emitters/tanstack-query.d.ts → generators/tanstack-query/render.d.ts} +6 -5
  277. package/lib/generators/tanstack-query/render.d.ts.map +1 -0
  278. package/lib/{emitters/tanstack-query.js → generators/tanstack-query/render.js} +33 -21
  279. package/lib/generators/tanstack-query/render.js.map +1 -0
  280. package/lib/generators/{transformers.d.ts → transformers/index.d.ts} +2 -2
  281. package/lib/generators/transformers/index.d.ts.map +1 -0
  282. package/lib/generators/{transformers.js → transformers/index.js} +11 -8
  283. package/lib/generators/transformers/index.js.map +1 -0
  284. package/lib/{emitters/transformers.d.ts → generators/transformers/render.d.ts} +2 -2
  285. package/lib/generators/transformers/render.d.ts.map +1 -0
  286. package/lib/{emitters/transformers.js → generators/transformers/render.js} +125 -165
  287. package/lib/generators/transformers/render.js.map +1 -0
  288. package/lib/generators/types.d.ts +190 -12
  289. package/lib/generators/types.d.ts.map +1 -1
  290. package/lib/generators/typescript/banner.d.ts +12 -0
  291. package/lib/generators/typescript/banner.d.ts.map +1 -0
  292. package/lib/{emitters/emit-options.js → generators/typescript/banner.js} +2 -3
  293. package/lib/generators/typescript/banner.js.map +1 -0
  294. package/lib/generators/typescript/client.d.ts +25 -0
  295. package/lib/generators/typescript/client.d.ts.map +1 -0
  296. package/lib/generators/typescript/client.js +207 -0
  297. package/lib/generators/typescript/client.js.map +1 -0
  298. package/lib/generators/typescript/descriptor.d.ts +11 -0
  299. package/lib/generators/typescript/descriptor.d.ts.map +1 -0
  300. package/lib/generators/typescript/descriptor.js +97 -0
  301. package/lib/generators/typescript/descriptor.js.map +1 -0
  302. package/lib/generators/typescript/index.d.ts +20 -0
  303. package/lib/generators/typescript/index.d.ts.map +1 -0
  304. package/lib/generators/typescript/index.js +80 -0
  305. package/lib/generators/typescript/index.js.map +1 -0
  306. package/lib/generators/typescript/inline-runtime.d.ts +21 -0
  307. package/lib/generators/typescript/inline-runtime.d.ts.map +1 -0
  308. package/lib/generators/typescript/inline-runtime.js +114 -0
  309. package/lib/generators/typescript/inline-runtime.js.map +1 -0
  310. package/lib/generators/typescript/operation-signature.d.ts +23 -0
  311. package/lib/generators/typescript/operation-signature.d.ts.map +1 -0
  312. package/lib/generators/typescript/operation-signature.js +41 -0
  313. package/lib/generators/typescript/operation-signature.js.map +1 -0
  314. package/lib/generators/typescript/operation-types.d.ts +9 -0
  315. package/lib/generators/typescript/operation-types.d.ts.map +1 -0
  316. package/lib/generators/typescript/operation-types.js +11 -0
  317. package/lib/generators/typescript/operation-types.js.map +1 -0
  318. package/lib/generators/typescript/operations.d.ts +60 -0
  319. package/lib/generators/typescript/operations.d.ts.map +1 -0
  320. package/lib/generators/typescript/operations.js +386 -0
  321. package/lib/generators/typescript/operations.js.map +1 -0
  322. package/lib/generators/typescript/response-headers.d.ts +12 -0
  323. package/lib/generators/typescript/response-headers.d.ts.map +1 -0
  324. package/lib/generators/typescript/response-headers.js +40 -0
  325. package/lib/generators/typescript/response-headers.js.map +1 -0
  326. package/lib/generators/typescript/runtime/auth.d.ts.map +1 -0
  327. package/lib/generators/typescript/runtime/auth.js.map +1 -0
  328. package/lib/{runtime → generators/typescript/runtime}/create-client.d.ts +7 -2
  329. package/lib/generators/typescript/runtime/create-client.d.ts.map +1 -0
  330. package/lib/{runtime → generators/typescript/runtime}/create-client.js +84 -30
  331. package/lib/generators/typescript/runtime/create-client.js.map +1 -0
  332. package/lib/generators/typescript/runtime/errors.d.ts.map +1 -0
  333. package/lib/generators/typescript/runtime/errors.js.map +1 -0
  334. package/lib/generators/typescript/runtime/index.d.ts.map +1 -0
  335. package/lib/generators/typescript/runtime/index.js.map +1 -0
  336. package/lib/generators/typescript/runtime/multipart.d.ts.map +1 -0
  337. package/lib/generators/typescript/runtime/multipart.js.map +1 -0
  338. package/lib/{runtime → generators/typescript/runtime}/paginate.d.ts +2 -2
  339. package/lib/generators/typescript/runtime/paginate.d.ts.map +1 -0
  340. package/lib/{runtime → generators/typescript/runtime}/paginate.js +12 -12
  341. package/lib/generators/typescript/runtime/paginate.js.map +1 -0
  342. package/lib/generators/typescript/runtime/parse.d.ts.map +1 -0
  343. package/lib/generators/typescript/runtime/parse.js.map +1 -0
  344. package/lib/generators/typescript/runtime/retry.d.ts.map +1 -0
  345. package/lib/generators/typescript/runtime/retry.js.map +1 -0
  346. package/lib/generators/typescript/runtime/send.d.ts.map +1 -0
  347. package/lib/generators/typescript/runtime/send.js.map +1 -0
  348. package/lib/generators/typescript/runtime/setup.d.ts.map +1 -0
  349. package/lib/generators/typescript/runtime/setup.js.map +1 -0
  350. package/lib/generators/typescript/runtime/sse.d.ts.map +1 -0
  351. package/lib/generators/typescript/runtime/sse.js.map +1 -0
  352. package/lib/{runtime → generators/typescript/runtime}/types.d.ts +17 -95
  353. package/lib/generators/typescript/runtime/types.d.ts.map +1 -0
  354. package/lib/generators/typescript/runtime/types.js.map +1 -0
  355. package/lib/generators/typescript/runtime/url.d.ts.map +1 -0
  356. package/lib/generators/typescript/runtime/url.js.map +1 -0
  357. package/lib/generators/typescript/type-guards.d.ts +4 -0
  358. package/lib/generators/typescript/type-guards.d.ts.map +1 -0
  359. package/lib/{emitters → generators/typescript}/type-guards.js +18 -52
  360. package/lib/generators/typescript/type-guards.js.map +1 -0
  361. package/lib/generators/typescript/types.d.ts +8 -0
  362. package/lib/generators/typescript/types.d.ts.map +1 -0
  363. package/lib/generators/typescript/types.js +132 -0
  364. package/lib/generators/typescript/types.js.map +1 -0
  365. package/lib/generators/{zod.d.ts → zod/index.d.ts} +2 -2
  366. package/lib/generators/zod/index.d.ts.map +1 -0
  367. package/lib/generators/{zod.js → zod/index.js} +5 -7
  368. package/lib/generators/zod/index.js.map +1 -0
  369. package/lib/{emitters/zod.d.ts → generators/zod/schemas.d.ts} +4 -5
  370. package/lib/generators/zod/schemas.d.ts.map +1 -0
  371. package/lib/{emitters/zod.js → generators/zod/schemas.js} +118 -154
  372. package/lib/generators/zod/schemas.js.map +1 -0
  373. package/lib/index.d.ts +8 -3
  374. package/lib/index.d.ts.map +1 -1
  375. package/lib/index.js +18 -11
  376. package/lib/index.js.map +1 -1
  377. package/lib/intermediate-representation/build.d.ts +8 -1
  378. package/lib/intermediate-representation/build.d.ts.map +1 -1
  379. package/lib/intermediate-representation/build.js +59 -4
  380. package/lib/intermediate-representation/build.js.map +1 -1
  381. package/lib/intermediate-representation/model.d.ts +26 -1
  382. package/lib/intermediate-representation/model.d.ts.map +1 -1
  383. package/lib/intermediate-representation/model.js.map +1 -1
  384. package/lib/intermediate-representation/sanitize-identifiers.d.ts +1 -10
  385. package/lib/intermediate-representation/sanitize-identifiers.d.ts.map +1 -1
  386. package/lib/intermediate-representation/sanitize-identifiers.js +37 -38
  387. package/lib/intermediate-representation/sanitize-identifiers.js.map +1 -1
  388. package/lib/{emitters/pagination.d.ts → pagination.d.ts} +39 -15
  389. package/lib/pagination.d.ts.map +1 -0
  390. package/lib/{emitters/pagination.js → pagination.js} +13 -52
  391. package/lib/pagination.js.map +1 -0
  392. package/lib/pipeline.d.ts +17 -0
  393. package/lib/pipeline.d.ts.map +1 -0
  394. package/lib/pipeline.js +244 -0
  395. package/lib/pipeline.js.map +1 -0
  396. package/lib/plugin.d.ts +4 -4
  397. package/lib/plugin.d.ts.map +1 -1
  398. package/lib/plugin.js +12 -9
  399. package/lib/plugin.js.map +1 -1
  400. package/lib/printers/go.d.ts +33 -0
  401. package/lib/printers/go.d.ts.map +1 -0
  402. package/lib/printers/go.js +209 -0
  403. package/lib/printers/go.js.map +1 -0
  404. package/lib/printers/index.d.ts +5 -0
  405. package/lib/printers/index.d.ts.map +1 -0
  406. package/lib/printers/index.js +9 -0
  407. package/lib/printers/index.js.map +1 -0
  408. package/lib/printers/php.d.ts +21 -0
  409. package/lib/printers/php.d.ts.map +1 -0
  410. package/lib/printers/php.js +68 -0
  411. package/lib/printers/php.js.map +1 -0
  412. package/lib/printers/python.d.ts +31 -0
  413. package/lib/printers/python.d.ts.map +1 -0
  414. package/lib/printers/python.js +101 -0
  415. package/lib/printers/python.js.map +1 -0
  416. package/lib/printers/typescript.d.ts +82 -0
  417. package/lib/printers/typescript.d.ts.map +1 -0
  418. package/lib/printers/typescript.js +268 -0
  419. package/lib/printers/typescript.js.map +1 -0
  420. package/lib/reserved-names.d.ts +8 -0
  421. package/lib/reserved-names.d.ts.map +1 -0
  422. package/lib/{emitters/reserved-names.js → reserved-names.js} +16 -27
  423. package/lib/reserved-names.js.map +1 -0
  424. package/lib/runtime-contract.d.ts +62 -2
  425. package/lib/runtime-contract.d.ts.map +1 -1
  426. package/lib/runtime-contract.js +3 -3
  427. package/lib/runtime-contract.js.map +1 -1
  428. package/lib/runtime-sources/go.d.ts +2 -0
  429. package/lib/runtime-sources/go.d.ts.map +1 -0
  430. package/lib/runtime-sources/go.js +3 -0
  431. package/lib/runtime-sources/go.js.map +1 -0
  432. package/lib/runtime-sources/php.d.ts +2 -0
  433. package/lib/runtime-sources/php.d.ts.map +1 -0
  434. package/lib/runtime-sources/php.js +3 -0
  435. package/lib/runtime-sources/php.js.map +1 -0
  436. package/lib/runtime-sources/python.d.ts +12 -0
  437. package/lib/runtime-sources/python.d.ts.map +1 -0
  438. package/lib/runtime-sources/python.js +12 -0
  439. package/lib/runtime-sources/python.js.map +1 -0
  440. package/lib/runtime-sources/typescript.d.ts +36 -0
  441. package/lib/runtime-sources/typescript.d.ts.map +1 -0
  442. package/lib/runtime-sources/typescript.js +152 -0
  443. package/lib/runtime-sources/typescript.js.map +1 -0
  444. package/lib/runtime-sources.d.ts +5 -0
  445. package/lib/runtime-sources.d.ts.map +1 -0
  446. package/lib/runtime-sources.js +10 -0
  447. package/lib/runtime-sources.js.map +1 -0
  448. package/lib/setup-bake.d.ts.map +1 -0
  449. package/lib/{emitters/setup-bake.js → setup-bake.js} +11 -2
  450. package/lib/setup-bake.js.map +1 -0
  451. package/lib/types.d.ts +38 -8
  452. package/lib/types.d.ts.map +1 -1
  453. package/package.json +40 -4
  454. package/lib/emitters/auth.d.ts +0 -14
  455. package/lib/emitters/auth.d.ts.map +0 -1
  456. package/lib/emitters/auth.js +0 -30
  457. package/lib/emitters/auth.js.map +0 -1
  458. package/lib/emitters/client-assembly.d.ts +0 -15
  459. package/lib/emitters/client-assembly.d.ts.map +0 -1
  460. package/lib/emitters/client-assembly.js +0 -358
  461. package/lib/emitters/client-assembly.js.map +0 -1
  462. package/lib/emitters/descriptor.d.ts +0 -22
  463. package/lib/emitters/descriptor.d.ts.map +0 -1
  464. package/lib/emitters/descriptor.js +0 -199
  465. package/lib/emitters/descriptor.js.map +0 -1
  466. package/lib/emitters/emit-options.d.ts +0 -67
  467. package/lib/emitters/emit-options.d.ts.map +0 -1
  468. package/lib/emitters/emit-options.js.map +0 -1
  469. package/lib/emitters/faker.d.ts.map +0 -1
  470. package/lib/emitters/faker.js +0 -221
  471. package/lib/emitters/faker.js.map +0 -1
  472. package/lib/emitters/identifier.d.ts +0 -34
  473. package/lib/emitters/identifier.d.ts.map +0 -1
  474. package/lib/emitters/identifier.js +0 -104
  475. package/lib/emitters/identifier.js.map +0 -1
  476. package/lib/emitters/inline-runtime.d.ts +0 -11
  477. package/lib/emitters/inline-runtime.d.ts.map +0 -1
  478. package/lib/emitters/inline-runtime.js +0 -99
  479. package/lib/emitters/inline-runtime.js.map +0 -1
  480. package/lib/emitters/jsdoc.d.ts +0 -9
  481. package/lib/emitters/jsdoc.d.ts.map +0 -1
  482. package/lib/emitters/jsdoc.js +0 -83
  483. package/lib/emitters/jsdoc.js.map +0 -1
  484. package/lib/emitters/mock.d.ts.map +0 -1
  485. package/lib/emitters/mock.js +0 -265
  486. package/lib/emitters/mock.js.map +0 -1
  487. package/lib/emitters/operation-aliases.d.ts +0 -27
  488. package/lib/emitters/operation-aliases.d.ts.map +0 -1
  489. package/lib/emitters/operation-aliases.js +0 -150
  490. package/lib/emitters/operation-aliases.js.map +0 -1
  491. package/lib/emitters/operation-signature.d.ts +0 -24
  492. package/lib/emitters/operation-signature.d.ts.map +0 -1
  493. package/lib/emitters/operation-signature.js +0 -42
  494. package/lib/emitters/operation-signature.js.map +0 -1
  495. package/lib/emitters/operation-types.d.ts +0 -32
  496. package/lib/emitters/operation-types.d.ts.map +0 -1
  497. package/lib/emitters/operation-types.js +0 -117
  498. package/lib/emitters/operation-types.js.map +0 -1
  499. package/lib/emitters/operations.d.ts +0 -41
  500. package/lib/emitters/operations.d.ts.map +0 -1
  501. package/lib/emitters/operations.js +0 -35
  502. package/lib/emitters/operations.js.map +0 -1
  503. package/lib/emitters/pagination.d.ts.map +0 -1
  504. package/lib/emitters/pagination.js.map +0 -1
  505. package/lib/emitters/reserved-names.d.ts +0 -5
  506. package/lib/emitters/reserved-names.d.ts.map +0 -1
  507. package/lib/emitters/reserved-names.js.map +0 -1
  508. package/lib/emitters/response-headers.d.ts +0 -14
  509. package/lib/emitters/response-headers.d.ts.map +0 -1
  510. package/lib/emitters/response-headers.js +0 -91
  511. package/lib/emitters/response-headers.js.map +0 -1
  512. package/lib/emitters/runtime-sources.d.ts +0 -16
  513. package/lib/emitters/runtime-sources.d.ts.map +0 -1
  514. package/lib/emitters/runtime-sources.js +0 -16
  515. package/lib/emitters/runtime-sources.js.map +0 -1
  516. package/lib/emitters/sample.d.ts.map +0 -1
  517. package/lib/emitters/sample.js.map +0 -1
  518. package/lib/emitters/setup-bake.d.ts.map +0 -1
  519. package/lib/emitters/setup-bake.js.map +0 -1
  520. package/lib/emitters/sse.d.ts +0 -10
  521. package/lib/emitters/sse.d.ts.map +0 -1
  522. package/lib/emitters/sse.js +0 -46
  523. package/lib/emitters/sse.js.map +0 -1
  524. package/lib/emitters/support.d.ts +0 -18
  525. package/lib/emitters/support.d.ts.map +0 -1
  526. package/lib/emitters/support.js +0 -37
  527. package/lib/emitters/support.js.map +0 -1
  528. package/lib/emitters/swr.d.ts.map +0 -1
  529. package/lib/emitters/swr.js +0 -88
  530. package/lib/emitters/swr.js.map +0 -1
  531. package/lib/emitters/tanstack-query.d.ts.map +0 -1
  532. package/lib/emitters/tanstack-query.js.map +0 -1
  533. package/lib/emitters/transformers.d.ts.map +0 -1
  534. package/lib/emitters/transformers.js.map +0 -1
  535. package/lib/emitters/ts.d.ts +0 -42
  536. package/lib/emitters/ts.d.ts.map +0 -1
  537. package/lib/emitters/ts.js +0 -116
  538. package/lib/emitters/ts.js.map +0 -1
  539. package/lib/emitters/type-guards.d.ts +0 -21
  540. package/lib/emitters/type-guards.d.ts.map +0 -1
  541. package/lib/emitters/type-guards.js.map +0 -1
  542. package/lib/emitters/types.d.ts +0 -15
  543. package/lib/emitters/types.d.ts.map +0 -1
  544. package/lib/emitters/types.js +0 -125
  545. package/lib/emitters/types.js.map +0 -1
  546. package/lib/emitters/wrapper-support.d.ts.map +0 -1
  547. package/lib/emitters/wrapper-support.js +0 -127
  548. package/lib/emitters/wrapper-support.js.map +0 -1
  549. package/lib/emitters/zod.d.ts.map +0 -1
  550. package/lib/emitters/zod.js.map +0 -1
  551. package/lib/generators/anchor.d.ts +0 -9
  552. package/lib/generators/anchor.d.ts.map +0 -1
  553. package/lib/generators/anchor.js +0 -10
  554. package/lib/generators/anchor.js.map +0 -1
  555. package/lib/generators/mock.d.ts.map +0 -1
  556. package/lib/generators/mock.js.map +0 -1
  557. package/lib/generators/sdk.d.ts +0 -12
  558. package/lib/generators/sdk.d.ts.map +0 -1
  559. package/lib/generators/sdk.js +0 -26
  560. package/lib/generators/sdk.js.map +0 -1
  561. package/lib/generators/swr.d.ts.map +0 -1
  562. package/lib/generators/swr.js.map +0 -1
  563. package/lib/generators/tanstack-query.d.ts.map +0 -1
  564. package/lib/generators/tanstack-query.js.map +0 -1
  565. package/lib/generators/transformers.d.ts.map +0 -1
  566. package/lib/generators/transformers.js.map +0 -1
  567. package/lib/generators/zod.d.ts.map +0 -1
  568. package/lib/generators/zod.js.map +0 -1
  569. package/lib/runtime/auth.d.ts.map +0 -1
  570. package/lib/runtime/auth.js.map +0 -1
  571. package/lib/runtime/create-client.d.ts.map +0 -1
  572. package/lib/runtime/create-client.js.map +0 -1
  573. package/lib/runtime/errors.d.ts.map +0 -1
  574. package/lib/runtime/errors.js.map +0 -1
  575. package/lib/runtime/index.d.ts.map +0 -1
  576. package/lib/runtime/index.js.map +0 -1
  577. package/lib/runtime/multipart.d.ts.map +0 -1
  578. package/lib/runtime/multipart.js.map +0 -1
  579. package/lib/runtime/paginate.d.ts.map +0 -1
  580. package/lib/runtime/paginate.js.map +0 -1
  581. package/lib/runtime/parse.d.ts.map +0 -1
  582. package/lib/runtime/parse.js.map +0 -1
  583. package/lib/runtime/retry.d.ts.map +0 -1
  584. package/lib/runtime/retry.js.map +0 -1
  585. package/lib/runtime/send.d.ts.map +0 -1
  586. package/lib/runtime/send.js.map +0 -1
  587. package/lib/runtime/setup.d.ts.map +0 -1
  588. package/lib/runtime/setup.js.map +0 -1
  589. package/lib/runtime/sse.d.ts.map +0 -1
  590. package/lib/runtime/sse.js.map +0 -1
  591. package/lib/runtime/types.d.ts.map +0 -1
  592. package/lib/runtime/types.js.map +0 -1
  593. package/lib/runtime/url.d.ts.map +0 -1
  594. package/lib/runtime/url.js.map +0 -1
  595. /package/lib/{emitters → generators/mock}/sample.js +0 -0
  596. /package/lib/{runtime → generators/typescript/runtime}/auth.d.ts +0 -0
  597. /package/lib/{runtime → generators/typescript/runtime}/auth.js +0 -0
  598. /package/lib/{runtime → generators/typescript/runtime}/errors.d.ts +0 -0
  599. /package/lib/{runtime → generators/typescript/runtime}/errors.js +0 -0
  600. /package/lib/{runtime → generators/typescript/runtime}/index.d.ts +0 -0
  601. /package/lib/{runtime → generators/typescript/runtime}/index.js +0 -0
  602. /package/lib/{runtime → generators/typescript/runtime}/multipart.d.ts +0 -0
  603. /package/lib/{runtime → generators/typescript/runtime}/multipart.js +0 -0
  604. /package/lib/{runtime → generators/typescript/runtime}/parse.d.ts +0 -0
  605. /package/lib/{runtime → generators/typescript/runtime}/parse.js +0 -0
  606. /package/lib/{runtime → generators/typescript/runtime}/retry.d.ts +0 -0
  607. /package/lib/{runtime → generators/typescript/runtime}/retry.js +0 -0
  608. /package/lib/{runtime → generators/typescript/runtime}/send.d.ts +0 -0
  609. /package/lib/{runtime → generators/typescript/runtime}/send.js +0 -0
  610. /package/lib/{runtime → generators/typescript/runtime}/setup.d.ts +0 -0
  611. /package/lib/{runtime → generators/typescript/runtime}/setup.js +0 -0
  612. /package/lib/{runtime → generators/typescript/runtime}/sse.d.ts +0 -0
  613. /package/lib/{runtime → generators/typescript/runtime}/sse.js +0 -0
  614. /package/lib/{runtime → generators/typescript/runtime}/types.js +0 -0
  615. /package/lib/{runtime → generators/typescript/runtime}/url.d.ts +0 -0
  616. /package/lib/{runtime → generators/typescript/runtime}/url.js +0 -0
  617. /package/lib/{emitters/setup-bake.d.ts → setup-bake.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/generators/cli/render.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,2EAA2E;AAE3E,OAAO,EAEL,MAAM,EAIN,YAAY,EACZ,SAAS,GAKV,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,gDAAgD,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE/C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qFAAqF;AACrF,4CAA4C;AAC5C,MAAM,MAAM,GAAG;8EAC+D,CAAC;AAE/E,SAAS,KAAK,CAAC,IAAY;IACzB,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC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AAO;SACX,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ;;EAEJ,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;EAUlB,WAAW,EAAE;KACV,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CACtB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,42 @@
1
+ import { type CliCommand, type CliGlobals, type CliWiring, type CommandSource, type CustomCommand } from '../../../cli-contract.js';
2
+ export type { CliFlag } from '../../../cli-contract.js';
3
+ export type { CliCommand } from '../../../cli-contract.js';
4
+ export type { CliAuthScheme } from '../../../cli-contract.js';
5
+ export type { CliWiring } from '../../../cli-contract.js';
6
+ export type { CliGlobals } from '../../../cli-contract.js';
7
+ export type CliInvocation = {
8
+ kind: 'help';
9
+ topic?: CliCommand | string;
10
+ } | {
11
+ kind: 'schema';
12
+ command: CliCommand;
13
+ } | {
14
+ kind: 'run';
15
+ command: CliCommand;
16
+ positionals: Record<string, string>;
17
+ params: Record<string, unknown>;
18
+ globals: CliGlobals;
19
+ } | {
20
+ kind: 'usage-error';
21
+ message: string;
22
+ };
23
+ export type { CustomCommand } from '../../../cli-contract.js';
24
+ export type { CommandContext } from '../../../cli-contract.js';
25
+ export type { CommandSource } from '../../../cli-contract.js';
26
+ /**
27
+ * The name to print in help: the command the CLI was invoked as. A global install resolves
28
+ * `argv[1]` to the bin itself, so its basename is exactly what the user typed. A Windows
29
+ * `.cmd` shim, a `node dist/cafe.cli.js`, and a `tsx client.cli.ts` run all pass the script
30
+ * path instead — printing that would name a command nobody can type, so a script extension
31
+ * and the `.cli` marker come off: `cafe.cli.js` prints `cafe`.
32
+ */
33
+ export declare function invokedName(scriptPath: string | undefined, fallback: string): string;
34
+ export { groupSlug } from '../../../cli-contract.js';
35
+ /** Resolve argv against the command table. Pure — no I/O, no env. */
36
+ export declare function parseInvocation(commands: CliCommand[], argv: string[]): CliInvocation;
37
+ export { constantCase } from '../../../cli-contract.js';
38
+ /** Parse argv, resolve env auth, dispatch through the client, print, return the exit code. */
39
+ export declare function runCli(commands: Array<CliCommand | CustomCommand>, wiring: CliWiring, argv: string[]): Promise<number>;
40
+ /** The composed form: one binary over several sources, each namespaced with its own wiring. */
41
+ export declare function runCli(sources: CommandSource[], argv: string[]): Promise<number>;
42
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../../src/generators/cli/runtime/cli.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,UAAU,EAEf,KAAK,UAAU,EACf,KAAK,SAAS,EAEd,KAAK,aAAa,EAClB,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,YAAY,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAE1D,YAAY,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE3D,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,UAAU,GAAG,MAAM,CAAA;CAAE,GAC7C;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GACvC;IACE,IAAI,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE,UAAU,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,OAAO,EAAE,UAAU,CAAC;CACrB,GACD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE7C,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAyC9D;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMpF;AAED,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAkCrD,qEAAqE;AACrE,wBAAgB,eAAe,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,aAAa,CAuIrF;AAED,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAoLxD,8FAA8F;AAC9F,wBAAsB,MAAM,CAC1B,QAAQ,EAAE,KAAK,CAAC,UAAU,GAAG,aAAa,CAAC,EAC3C,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,MAAM,EAAE,GACb,OAAO,CAAC,MAAM,CAAC,CAAC;AACnB,+FAA+F;AAC/F,wBAAsB,MAAM,CAAC,OAAO,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,582 @@
1
+ // The generated-CLI engine: a pure argv parser plus a dispatcher that drives the
2
+ // instance client and maps outcomes to the documented exit-code contract
3
+ // (0 success, 1 API error, 2 auth, 3 validation, 4 usage). Node-only by nature,
4
+ // but every effect (env, stdin, files, output) is injected through the wiring so
5
+ // the module itself stays dependency-free and fully unit-testable; the emitted
6
+ // entry fills the defaults with real `node:fs`/`process` bindings.
7
+ import { constantCase, groupSlug, } from '../../../cli-contract.js';
8
+ /** Custom commands as the command shape the parser reads; generated ones pass through. */
9
+ function normalizeCommands(commands) {
10
+ return commands.map((command) => 'handler' in command
11
+ ? { method: '', path: '', positionals: [], flags: [], ...command }
12
+ : command);
13
+ }
14
+ /**
15
+ * The name of a custom command that shadows another command. Rejected at startup: an
16
+ * operator typing an operationId must never silently run something else.
17
+ */
18
+ function shadowedCommandName(commands) {
19
+ const seen = new Map();
20
+ for (const command of commands) {
21
+ const key = `${command.group ?? ''}\u0000${command.name}`;
22
+ seen.set(key, [...(seen.get(key) ?? []), command]);
23
+ }
24
+ for (const clashing of seen.values()) {
25
+ if (clashing.length > 1 && clashing.some((command) => command.handler !== undefined)) {
26
+ return clashing[0].name;
27
+ }
28
+ }
29
+ return undefined;
30
+ }
31
+ const GLOBAL_FLAGS = {
32
+ 'server-url': { key: 'serverUrl' },
33
+ format: { key: 'format' },
34
+ 'dry-run': { key: 'dryRun', boolean: true },
35
+ 'page-all': { key: 'pageAll', boolean: true },
36
+ output: { key: 'output' },
37
+ token: { key: 'token' },
38
+ json: { key: 'json' },
39
+ };
40
+ /**
41
+ * The name to print in help: the command the CLI was invoked as. A global install resolves
42
+ * `argv[1]` to the bin itself, so its basename is exactly what the user typed. A Windows
43
+ * `.cmd` shim, a `node dist/cafe.cli.js`, and a `tsx client.cli.ts` run all pass the script
44
+ * path instead — printing that would name a command nobody can type, so a script extension
45
+ * and the `.cli` marker come off: `cafe.cli.js` prints `cafe`.
46
+ */
47
+ export function invokedName(scriptPath, fallback) {
48
+ if (scriptPath === undefined)
49
+ return fallback;
50
+ const base = scriptPath.replace(/^.*[\\/]/, '');
51
+ const withoutExtension = base.replace(/\.(mjs|cjs|js|mts|cts|ts|cmd|bat|ps1|exe)$/i, '');
52
+ const name = withoutExtension.replace(/\.cli$/i, '');
53
+ return name === '' ? fallback : name;
54
+ }
55
+ export { groupSlug } from '../../../cli-contract.js';
56
+ /** A description on ONE line: newlines in an OpenAPI description wreck help alignment. */
57
+ function oneLine(text) {
58
+ return text.replace(/\s+/g, ' ').trim();
59
+ }
60
+ /**
61
+ * The parsed argv as one call input, in the style the wired client takes: grouped by layer
62
+ * (the default) or merged into one object.
63
+ */
64
+ function callInputs(command, positionals, params, body, argsStyle) {
65
+ const inputs = {};
66
+ // A command the generator marked `grouped` keeps the namespaced shape even here.
67
+ if (argsStyle === 'flat' && command.argsStyle !== 'grouped') {
68
+ Object.assign(inputs, positionals, params);
69
+ if (body !== undefined) {
70
+ if (command.body?.merged === true)
71
+ Object.assign(inputs, body);
72
+ else
73
+ inputs.body = body;
74
+ }
75
+ }
76
+ else {
77
+ if (Object.keys(positionals).length > 0)
78
+ inputs.path = positionals;
79
+ if (Object.keys(params).length > 0)
80
+ inputs.query = params;
81
+ if (body !== undefined)
82
+ inputs.body = body;
83
+ }
84
+ return Object.keys(inputs).length > 0 ? inputs : undefined;
85
+ }
86
+ /** Resolve argv against the command table. Pure — no I/O, no env. */
87
+ export function parseInvocation(commands, argv) {
88
+ if (argv.length === 0 || argv[0] === '--help')
89
+ return { kind: 'help' };
90
+ if (argv[0] === 'schema') {
91
+ const command = commands.find((candidate) => candidate.name === argv[1]);
92
+ return command
93
+ ? { kind: 'schema', command }
94
+ : { kind: 'usage-error', message: `Unknown command: schema ${argv[1] ?? ''}`.trim() };
95
+ }
96
+ const slugs = new Set(commands.filter((c) => c.group).map((c) => groupSlug(c.group)));
97
+ // An untagged operation is only ever addressed by its bare name, so when that name is also
98
+ // a group slug the name wins — reading it as the group would leave the command unreachable.
99
+ // A tagged operation in the same position keeps yielding to group help: it is still
100
+ // reachable as `<its group> <name>`.
101
+ const untagged = commands.some((c) => c.group === undefined && c.name === argv[0]);
102
+ let command;
103
+ let rest;
104
+ if (!untagged && slugs.has(argv[0])) {
105
+ if (argv[1] === '--help' || argv[1] === undefined)
106
+ return { kind: 'help', topic: argv[0] };
107
+ command = commands.find((c) => c.group && groupSlug(c.group) === argv[0] && c.name === argv[1]);
108
+ if (!command)
109
+ return { kind: 'usage-error', message: `Unknown command: ${argv[0]} ${argv[1]}` };
110
+ rest = argv.slice(2);
111
+ }
112
+ else {
113
+ // An ungrouped command, or a bare operationId — knowing the group shouldn't be
114
+ // required when the name alone is unambiguous.
115
+ const named = commands.filter((c) => c.name === argv[0]);
116
+ command =
117
+ named.find((c) => c.group === undefined) ?? (named.length === 1 ? named[0] : undefined);
118
+ if (!command) {
119
+ const ambiguous = named.length > 1;
120
+ return {
121
+ kind: 'usage-error',
122
+ message: ambiguous
123
+ ? `Ambiguous command: ${argv[0]} — prefix it with its group (${named
124
+ .map((c) => groupSlug(c.group))
125
+ .join(', ')})`
126
+ : `Unknown command: ${argv[0]}`,
127
+ };
128
+ }
129
+ rest = argv.slice(1);
130
+ }
131
+ if (rest.includes('--help'))
132
+ return { kind: 'help', topic: command };
133
+ const positionals = {};
134
+ const params = {};
135
+ const globals = {};
136
+ let positionalIndex = 0;
137
+ for (let index = 0; index < rest.length; index++) {
138
+ const token = rest[index];
139
+ if (!token.startsWith('--')) {
140
+ const slot = command.positionals[positionalIndex++];
141
+ if (!slot)
142
+ return { kind: 'usage-error', message: `Unexpected argument: ${token}` };
143
+ positionals[slot.name] = token;
144
+ continue;
145
+ }
146
+ const equals = token.indexOf('=');
147
+ const flagName = equals === -1 ? token.slice(2) : token.slice(2, equals);
148
+ const inlineValue = equals === -1 ? undefined : token.slice(equals + 1);
149
+ const takeValue = () => inlineValue !== undefined ? inlineValue : rest[++index];
150
+ const global = GLOBAL_FLAGS[flagName];
151
+ if (global) {
152
+ if (global.boolean) {
153
+ globals[global.key] = true;
154
+ continue;
155
+ }
156
+ const value = takeValue();
157
+ if (value === undefined) {
158
+ return { kind: 'usage-error', message: `Flag --${flagName} expects a value` };
159
+ }
160
+ if (global.key === 'format' && value !== 'json' && value !== 'ndjson') {
161
+ return { kind: 'usage-error', message: `--format must be one of: json, ndjson` };
162
+ }
163
+ globals[global.key] = value;
164
+ continue;
165
+ }
166
+ const flag = command.flags.find((candidate) => candidate.name === flagName);
167
+ if (!flag)
168
+ return { kind: 'usage-error', message: `Unknown flag: --${flagName}` };
169
+ if (flag.type === 'boolean') {
170
+ params[flag.param] = true;
171
+ continue;
172
+ }
173
+ const value = takeValue();
174
+ if (value === undefined) {
175
+ return { kind: 'usage-error', message: `Flag --${flagName} expects a value` };
176
+ }
177
+ if (flag.enum && !flag.enum.includes(value)) {
178
+ return {
179
+ kind: 'usage-error',
180
+ message: `--${flagName} must be one of: ${flag.enum.join(', ')}`,
181
+ };
182
+ }
183
+ if (flag.type === 'number') {
184
+ const numeric = Number(value);
185
+ if (Number.isNaN(numeric)) {
186
+ return { kind: 'usage-error', message: `--${flagName} expects a number, got "${value}"` };
187
+ }
188
+ params[flag.param] = numeric;
189
+ }
190
+ else if (flag.type === 'array') {
191
+ const existing = params[flag.param];
192
+ params[flag.param] = Array.isArray(existing) ? [...existing, value] : [value];
193
+ }
194
+ else {
195
+ params[flag.param] = value;
196
+ }
197
+ }
198
+ for (const slot of command.positionals) {
199
+ if (!(slot.name in positionals)) {
200
+ return { kind: 'usage-error', message: `Missing required argument: <${slot.name}>` };
201
+ }
202
+ }
203
+ for (const flag of command.flags) {
204
+ if (flag.required && !(flag.param in params)) {
205
+ return { kind: 'usage-error', message: `Missing required flag: --${flag.name}` };
206
+ }
207
+ }
208
+ if (globals.json !== undefined && !command.body) {
209
+ return { kind: 'usage-error', message: `${command.name} does not accept a request body` };
210
+ }
211
+ if (command.body?.required && globals.json === undefined) {
212
+ return {
213
+ kind: 'usage-error',
214
+ message: `${command.name} requires a request body: pass --json '<json>', --json @file.json, or --json @-`,
215
+ };
216
+ }
217
+ if (globals.pageAll && !command.paginated) {
218
+ return {
219
+ kind: 'usage-error',
220
+ message: `${command.name} is not paginated; --page-all only applies to paginated operations`,
221
+ };
222
+ }
223
+ return { kind: 'run', command, positionals, params, globals };
224
+ }
225
+ export { constantCase } from '../../../cli-contract.js';
226
+ function resolveAuth(wiring, token) {
227
+ const env = wiring.env ?? {};
228
+ const prefix = wiring.envPrefix;
229
+ const auth = {};
230
+ for (const scheme of wiring.schemes ?? []) {
231
+ if (scheme.kind === 'bearer') {
232
+ const value = token ?? env[`${prefix}_TOKEN`];
233
+ if (value !== undefined)
234
+ auth.bearer = value;
235
+ }
236
+ else if (scheme.kind === 'basic') {
237
+ const username = env[`${prefix}_USERNAME`];
238
+ const password = env[`${prefix}_PASSWORD`];
239
+ if (username !== undefined && password !== undefined)
240
+ auth.basic = { username, password };
241
+ }
242
+ else {
243
+ const value = env[`${prefix}_API_KEY_${constantCase(scheme.key)}`];
244
+ if (value !== undefined) {
245
+ auth.apiKey = {
246
+ ...auth.apiKey,
247
+ [scheme.key]: value,
248
+ };
249
+ }
250
+ }
251
+ }
252
+ return auth;
253
+ }
254
+ /**
255
+ * One command's complete contract as plain data — what `schema <command>` prints. It has
256
+ * to carry the parameters: 'GET' operations have no body, so without them the output says
257
+ * nothing a caller could act on, and the only alternative is scraping `--help`, which is
258
+ * prose written for humans.
259
+ */
260
+ function commandContract(command) {
261
+ return {
262
+ operationId: command.name,
263
+ ...(command.group === undefined ? {} : { group: groupSlug(command.group) }),
264
+ ...(command.summary === undefined ? {} : { summary: oneLine(command.summary) }),
265
+ ...(command.method === '' ? {} : { method: command.method }),
266
+ ...(command.path === '' ? {} : { path: command.path }),
267
+ parameters: {
268
+ path: command.positionals.map((positional) => ({
269
+ name: positional.name,
270
+ type: positional.type ?? 'string',
271
+ required: true,
272
+ ...(positional.description === undefined
273
+ ? {}
274
+ : { description: oneLine(positional.description) }),
275
+ })),
276
+ // `name` is what you type (`--max-total`); `param` is the wire name it becomes.
277
+ query: command.flags.map((flag) => ({
278
+ name: flag.name,
279
+ param: flag.param,
280
+ type: flag.type,
281
+ required: flag.required,
282
+ ...(flag.enum === undefined ? {} : { enum: flag.enum }),
283
+ ...(flag.description === undefined ? {} : { description: oneLine(flag.description) }),
284
+ })),
285
+ },
286
+ ...(command.body === undefined ? {} : { body: command.body }),
287
+ ...(command.unsupportedBody === undefined ? {} : { unsupportedBody: command.unsupportedBody }),
288
+ ...(command.paginated === true ? { paginated: true } : {}),
289
+ ...(command.sse === true ? { sse: true } : {}),
290
+ ...(command.blob === true ? { blob: true } : {}),
291
+ ...(command.schemas ?? {}),
292
+ };
293
+ }
294
+ function renderHelp(commands, name, schemes, prefix, topic) {
295
+ if (topic !== undefined && typeof topic !== 'string') {
296
+ const command = topic;
297
+ const usage = [
298
+ name,
299
+ ...(command.group ? [groupSlug(command.group)] : []),
300
+ command.name,
301
+ ...command.positionals.map((slot) => `<${slot.name}>`),
302
+ ...(command.flags.length > 0 ? ['[flags]'] : []),
303
+ ...(command.body ? ["--json '<json>' | @file | @-"] : []),
304
+ ].join(' ');
305
+ const lines = [`Usage: ${usage}`];
306
+ if (command.summary)
307
+ lines.push('', command.summary);
308
+ if (command.unsupportedBody !== undefined) {
309
+ lines.push('', `This operation takes a ${command.unsupportedBody} body, which the CLI cannot build — call it through the generated client instead.`);
310
+ }
311
+ if (command.flags.length > 0) {
312
+ lines.push('', 'Flags:');
313
+ for (const flag of command.flags) {
314
+ const choices = flag.enum ? ` (one of: ${flag.enum.join(', ')})` : '';
315
+ const required = flag.required ? ' [required]' : '';
316
+ lines.push(` --${flag.name} <${flag.type}>${choices}${required} ${oneLine(flag.description ?? '')}`.trimEnd());
317
+ }
318
+ }
319
+ return lines;
320
+ }
321
+ const scope = typeof topic === 'string'
322
+ ? commands.filter((c) => c.group && groupSlug(c.group) === topic)
323
+ : commands;
324
+ const lines = typeof topic === 'string'
325
+ ? [`Usage: ${name} ${topic} <command> …`, '', 'Commands:']
326
+ : [`Usage: ${name} [group] <command> …`, '', 'Commands:'];
327
+ const seenGroups = new Set();
328
+ const grouped = commands.some((c) => c.group);
329
+ for (const command of scope) {
330
+ if (typeof topic !== 'string' && command.group) {
331
+ const slug = groupSlug(command.group);
332
+ if (seenGroups.has(slug))
333
+ continue;
334
+ seenGroups.add(slug);
335
+ // The slug is what you type; the tag is what you recognize.
336
+ const title = slug === command.group ? '' : ` (${command.group})`;
337
+ lines.push(` ${slug} <command>${title}`);
338
+ continue;
339
+ }
340
+ lines.push(` ${[command.group === undefined ? undefined : groupSlug(command.group), command.name]
341
+ .filter(Boolean)
342
+ .join(' ')} ${oneLine(command.summary ?? '')}`.trimEnd());
343
+ }
344
+ // Flags that apply to every command, and the env vars credentials come from: a flag
345
+ // absent from --help may as well not exist — and one this API cannot use should not be
346
+ // listed at all, since the operator would spend the debugging session on their token.
347
+ const kinds = new Set(schemes.map((scheme) => scheme.kind));
348
+ const credentials = [
349
+ ...(kinds.has('bearer') ? [`${prefix}_TOKEN`] : []),
350
+ ...(kinds.has('basic') ? [`${prefix}_USERNAME`, `${prefix}_PASSWORD`] : []),
351
+ ...schemes
352
+ .filter((scheme) => scheme.kind === 'apiKey')
353
+ .map((scheme) => `${prefix}_API_KEY_${constantCase(scheme.key)}`),
354
+ ];
355
+ lines.push('', 'Global flags:', ' --server-url <url> Override the baked server URL', ' --format <json|ndjson> Output format', ' --dry-run Print the prepared request without sending it', ' --page-all Follow pagination, one JSON page per line', ' --output <path> Write the response body to a file (required for binary)', ...(kinds.has('bearer') ? [' --token <token> Bearer token'] : []), ` --json <json|@file|@-> Request body`, ...(credentials.length > 0 ? ['', 'Environment:', ` ${credentials.join(', ')}`] : []), '', `Run ${name} ${grouped ? '<group> <command>' : '<command>'} --help for command details; ${name} schema <command> prints its schemas.`);
356
+ return lines;
357
+ }
358
+ function loadBody(source, wiring) {
359
+ const raw = source === '@-'
360
+ ? (wiring.stdin ?? (() => ''))()
361
+ : source.startsWith('@')
362
+ ? (wiring.readFile ?? (() => ''))(source.slice(1))
363
+ : source;
364
+ return JSON.parse(raw);
365
+ }
366
+ /** Replace header values containing a known credential with `***`. */
367
+ function redactHeaders(headers, secrets) {
368
+ const redacted = {};
369
+ for (const [name, value] of Object.entries(headers)) {
370
+ redacted[name] = secrets.some((secret) => secret !== '' && value.includes(secret))
371
+ ? '***'
372
+ : value;
373
+ }
374
+ return redacted;
375
+ }
376
+ export async function runCli(commandsOrSources, wiringOrArgv, argv) {
377
+ if (Array.isArray(wiringOrArgv)) {
378
+ return runSources(commandsOrSources, wiringOrArgv);
379
+ }
380
+ return runSingle(commandsOrSources, wiringOrArgv, argv ?? []);
381
+ }
382
+ /** Route the first token to its source; the namespace-less source owns the root. */
383
+ async function runSources(sources, argv) {
384
+ // A source without wiring inherits the first wired one, so the documented root-source
385
+ // shape `{ commands: [login] }` works: the login shares the composed binary's identity.
386
+ const inherited = sources.find((source) => source.wiring !== undefined)?.wiring;
387
+ const wiringOf = (source) => source.wiring ?? inherited;
388
+ // Top-level output goes through the first source: with a root source that is the one
389
+ // carrying the shared commands, otherwise the first API listed.
390
+ const top = wiringOf(sources[0]);
391
+ const fail = (code, message) => {
392
+ top.stderr(JSON.stringify({ error: { code, message } }));
393
+ return code;
394
+ };
395
+ const namespaced = sources.filter((source) => source.namespace !== undefined);
396
+ const root = sources.find((source) => source.namespace === undefined);
397
+ if (root !== undefined) {
398
+ const clash = root.commands.find((command) => namespaced.some((source) => source.namespace === command.name));
399
+ if (clash !== undefined) {
400
+ return fail(4, `Root command "${clash.name}" collides with the "${clash.name}" namespace — rename one of them.`);
401
+ }
402
+ }
403
+ if (argv.length === 0 || argv[0] === '--help') {
404
+ for (const line of renderComposedHelp(sources, top.name))
405
+ top.stdout(line);
406
+ return 0;
407
+ }
408
+ const source = namespaced.find((candidate) => candidate.namespace === argv[0]);
409
+ if (source !== undefined)
410
+ return runSingle(source.commands, wiringOf(source), argv.slice(1));
411
+ const rootTakes = root !== undefined &&
412
+ (argv[0] === 'schema' ||
413
+ root.commands.some((command) => command.name === argv[0] ||
414
+ (command.group !== undefined && groupSlug(command.group) === argv[0])));
415
+ if (rootTakes)
416
+ return runSingle(root.commands, wiringOf(root), argv);
417
+ return fail(4, `Unknown command: ${argv[0]} — expected an API namespace (${namespaced
418
+ .map((candidate) => candidate.namespace)
419
+ .join(', ')})${root !== undefined ? ' or a root command' : ''}`);
420
+ }
421
+ /** The composed top-level help: namespaces, root commands, and how to descend. */
422
+ function renderComposedHelp(sources, name) {
423
+ const lines = [`Usage: ${name} <api> <command> …`, '', 'APIs:'];
424
+ for (const source of sources) {
425
+ if (source.namespace !== undefined)
426
+ lines.push(` ${source.namespace}`);
427
+ }
428
+ const root = sources.find((source) => source.namespace === undefined);
429
+ if (root !== undefined && root.commands.length > 0) {
430
+ lines.push('', 'Commands:');
431
+ for (const command of root.commands) {
432
+ lines.push(` ${command.name} ${oneLine(command.summary ?? '')}`.trimEnd());
433
+ }
434
+ }
435
+ lines.push('', `Run ${name} <api> --help for that API's commands.`);
436
+ return lines;
437
+ }
438
+ async function runSingle(rawCommands, wiring, argv) {
439
+ const { stdout, stderr } = wiring;
440
+ const commands = normalizeCommands(rawCommands);
441
+ const shadowed = shadowedCommandName(commands);
442
+ if (shadowed !== undefined) {
443
+ stderr(JSON.stringify({
444
+ error: {
445
+ code: 4,
446
+ message: `Custom command "${shadowed}" collides with another command of the same name — rename it.`,
447
+ },
448
+ }));
449
+ return 4;
450
+ }
451
+ const fail = (code, error) => {
452
+ stderr(JSON.stringify({ error: { code, ...error } }));
453
+ return code;
454
+ };
455
+ const invocation = parseInvocation(commands, argv);
456
+ if (invocation.kind === 'usage-error')
457
+ return fail(4, { message: invocation.message });
458
+ if (invocation.kind === 'help') {
459
+ for (const line of renderHelp(commands, wiring.name, wiring.schemes ?? [], wiring.envPrefix, invocation.topic))
460
+ stdout(line);
461
+ return 0;
462
+ }
463
+ if (invocation.kind === 'schema') {
464
+ stdout(JSON.stringify(commandContract(invocation.command), null, 2));
465
+ return 0;
466
+ }
467
+ const { command, positionals, params, globals } = invocation;
468
+ // A credential the user passed explicitly must never be dropped in silence: without a
469
+ // bearer scheme the request would go out unauthenticated and come back 401, which reads
470
+ // as "my token is wrong" rather than "that flag does nothing here".
471
+ const schemes = wiring.schemes ?? [];
472
+ if (globals.token !== undefined && !schemes.some((scheme) => scheme.kind === 'bearer')) {
473
+ const declared = schemes.map((scheme) => `${scheme.key} (${scheme.kind})`).join(', ');
474
+ return fail(4, {
475
+ message: `--token is a bearer credential, and this API declares no bearer scheme. ` +
476
+ (declared === '' ? 'It declares no security schemes at all.' : `It accepts: ${declared}.`),
477
+ });
478
+ }
479
+ if (command.blob && globals.output === undefined) {
480
+ return fail(4, {
481
+ message: `${command.name} downloads a file: pass --output <path>`,
482
+ operationId: command.name,
483
+ });
484
+ }
485
+ let body;
486
+ if (globals.json !== undefined) {
487
+ try {
488
+ body = loadBody(globals.json, wiring);
489
+ }
490
+ catch (error) {
491
+ return fail(4, {
492
+ message: `Invalid --json body: ${error.message}`,
493
+ operationId: command.name,
494
+ });
495
+ }
496
+ }
497
+ const auth = resolveAuth(wiring, globals.token);
498
+ if (Object.keys(auth).length > 0)
499
+ wiring.configure({ auth });
500
+ if (globals.serverUrl !== undefined)
501
+ wiring.configure({ serverUrl: globals.serverUrl });
502
+ // Redaction matches these against header VALUES — so basic auth must contribute the
503
+ // form the wire actually carries (`Basic ${base64(user:pass)}`), not just the raw
504
+ // password, which never appears in the encoded header.
505
+ const basic = auth.basic;
506
+ const secrets = [
507
+ ...(typeof auth.bearer === 'string' ? [auth.bearer] : []),
508
+ ...(basic ? [basic.password, btoa(`${basic.username}:${basic.password}`)] : []),
509
+ ...Object.values(auth.apiKey ?? {}),
510
+ ];
511
+ let captured;
512
+ if (globals.dryRun) {
513
+ wiring.configure({
514
+ fetch: async (url, init) => {
515
+ captured = {
516
+ url,
517
+ method: init.method,
518
+ headers: redactHeaders(init.headers ?? {}, secrets),
519
+ ...(init.body !== undefined && init.body !== null ? { body: String(init.body) } : {}),
520
+ };
521
+ return new Response('{}', { status: 200, headers: { 'content-type': 'application/json' } });
522
+ },
523
+ });
524
+ }
525
+ const argument = callInputs(command, positionals, params, body, wiring.argsStyle);
526
+ // The client's methods are typed per-operation; the dispatcher only needs "callable
527
+ // by name", so one localized widening here keeps the emitted wiring cast-free.
528
+ const methods = wiring.client;
529
+ try {
530
+ const resolved = command;
531
+ if (resolved.handler !== undefined) {
532
+ return await resolved.handler({ positionals, params, globals, wiring });
533
+ }
534
+ if (globals.pageAll && !globals.dryRun) {
535
+ const paginated = methods[command.name];
536
+ for await (const page of paginated.pages(argument))
537
+ stdout(JSON.stringify(page));
538
+ return 0;
539
+ }
540
+ const method = methods[command.name];
541
+ const result = await method(argument);
542
+ if (globals.dryRun) {
543
+ // An SSE method returns a lazy stream — drain the stubbed response so its fetch
544
+ // actually runs and captures the request.
545
+ if (command.sse)
546
+ for await (const _event of result)
547
+ ;
548
+ stdout(JSON.stringify(captured, null, 2));
549
+ return 0;
550
+ }
551
+ if (command.sse) {
552
+ for await (const event of result)
553
+ stdout(JSON.stringify(event));
554
+ return 0;
555
+ }
556
+ if (command.blob) {
557
+ const bytes = new Uint8Array(await result.arrayBuffer());
558
+ (wiring.writeFile ?? (() => { }))(globals.output, bytes);
559
+ stdout(JSON.stringify({ saved: globals.output, bytes: bytes.length }));
560
+ return 0;
561
+ }
562
+ if (result !== undefined && result !== null)
563
+ stdout(JSON.stringify(result, null, 2));
564
+ return 0;
565
+ }
566
+ catch (error) {
567
+ const thrown = error;
568
+ const detail = {
569
+ message: thrown.message,
570
+ operationId: command.name,
571
+ ...(thrown.status !== undefined ? { status: thrown.status } : {}),
572
+ ...(thrown.issues !== undefined ? { issues: thrown.issues } : {}),
573
+ };
574
+ if (thrown.name === 'ZodValidationError')
575
+ return fail(3, detail);
576
+ if (thrown.name === 'ApiError' && (thrown.status === 401 || thrown.status === 403)) {
577
+ return fail(2, detail);
578
+ }
579
+ return fail(1, detail);
580
+ }
581
+ }
582
+ //# sourceMappingURL=cli.js.map