@redocly/client-generator 0.0.0-snapshot.1787656839 → 0.0.0-snapshot.1787659732

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 +51 -29
  2. package/lib/emitters/auth.d.ts +14 -0
  3. package/lib/emitters/auth.d.ts.map +1 -0
  4. package/lib/emitters/auth.js +30 -0
  5. package/lib/emitters/auth.js.map +1 -0
  6. package/lib/emitters/client-assembly.d.ts +15 -0
  7. package/lib/emitters/client-assembly.d.ts.map +1 -0
  8. package/lib/emitters/client-assembly.js +358 -0
  9. package/lib/emitters/client-assembly.js.map +1 -0
  10. package/lib/emitters/descriptor.d.ts +22 -0
  11. package/lib/emitters/descriptor.d.ts.map +1 -0
  12. package/lib/emitters/descriptor.js +199 -0
  13. package/lib/emitters/descriptor.js.map +1 -0
  14. package/lib/emitters/emit-options.d.ts +67 -0
  15. package/lib/emitters/emit-options.d.ts.map +1 -0
  16. package/lib/{generators/typescript/banner.js → emitters/emit-options.js} +3 -2
  17. package/lib/emitters/emit-options.js.map +1 -0
  18. package/lib/{generators/mock → emitters}/faker.d.ts +5 -4
  19. package/lib/emitters/faker.d.ts.map +1 -0
  20. package/lib/emitters/faker.js +221 -0
  21. package/lib/emitters/faker.js.map +1 -0
  22. package/lib/emitters/identifier.d.ts +34 -0
  23. package/lib/emitters/identifier.d.ts.map +1 -0
  24. package/lib/emitters/identifier.js +104 -0
  25. package/lib/emitters/identifier.js.map +1 -0
  26. package/lib/emitters/inline-runtime.d.ts +11 -0
  27. package/lib/emitters/inline-runtime.d.ts.map +1 -0
  28. package/lib/emitters/inline-runtime.js +99 -0
  29. package/lib/emitters/inline-runtime.js.map +1 -0
  30. package/lib/emitters/jsdoc.d.ts +9 -0
  31. package/lib/emitters/jsdoc.d.ts.map +1 -0
  32. package/lib/emitters/jsdoc.js +83 -0
  33. package/lib/emitters/jsdoc.js.map +1 -0
  34. package/lib/{generators/mock/render.d.ts → emitters/mock.d.ts} +3 -2
  35. package/lib/emitters/mock.d.ts.map +1 -0
  36. package/lib/emitters/mock.js +265 -0
  37. package/lib/emitters/mock.js.map +1 -0
  38. package/lib/emitters/operation-aliases.d.ts +27 -0
  39. package/lib/emitters/operation-aliases.d.ts.map +1 -0
  40. package/lib/emitters/operation-aliases.js +150 -0
  41. package/lib/emitters/operation-aliases.js.map +1 -0
  42. package/lib/emitters/operation-signature.d.ts +24 -0
  43. package/lib/emitters/operation-signature.d.ts.map +1 -0
  44. package/lib/emitters/operation-signature.js +42 -0
  45. package/lib/emitters/operation-signature.js.map +1 -0
  46. package/lib/emitters/operation-types.d.ts +32 -0
  47. package/lib/emitters/operation-types.d.ts.map +1 -0
  48. package/lib/emitters/operation-types.js +117 -0
  49. package/lib/emitters/operation-types.js.map +1 -0
  50. package/lib/emitters/operations.d.ts +41 -0
  51. package/lib/emitters/operations.d.ts.map +1 -0
  52. package/lib/emitters/operations.js +35 -0
  53. package/lib/emitters/operations.js.map +1 -0
  54. package/lib/{pagination.d.ts → emitters/pagination.d.ts} +15 -39
  55. package/lib/emitters/pagination.d.ts.map +1 -0
  56. package/lib/{pagination.js → emitters/pagination.js} +52 -13
  57. package/lib/emitters/pagination.js.map +1 -0
  58. package/lib/emitters/reserved-names.d.ts +5 -0
  59. package/lib/emitters/reserved-names.d.ts.map +1 -0
  60. package/lib/{reserved-names.js → emitters/reserved-names.js} +27 -16
  61. package/lib/emitters/reserved-names.js.map +1 -0
  62. package/lib/emitters/response-headers.d.ts +14 -0
  63. package/lib/emitters/response-headers.d.ts.map +1 -0
  64. package/lib/emitters/response-headers.js +91 -0
  65. package/lib/emitters/response-headers.js.map +1 -0
  66. package/lib/emitters/runtime-sources.d.ts +16 -0
  67. package/lib/emitters/runtime-sources.d.ts.map +1 -0
  68. package/lib/emitters/runtime-sources.js +16 -0
  69. package/lib/emitters/runtime-sources.js.map +1 -0
  70. package/lib/{generators/mock → emitters}/sample.d.ts +2 -1
  71. package/lib/emitters/sample.d.ts.map +1 -0
  72. package/lib/emitters/sample.js.map +1 -0
  73. package/lib/emitters/setup-bake.d.ts.map +1 -0
  74. package/lib/{setup-bake.js → emitters/setup-bake.js} +2 -11
  75. package/lib/emitters/setup-bake.js.map +1 -0
  76. package/lib/emitters/sse.d.ts +10 -0
  77. package/lib/emitters/sse.d.ts.map +1 -0
  78. package/lib/emitters/sse.js +46 -0
  79. package/lib/emitters/sse.js.map +1 -0
  80. package/lib/emitters/support.d.ts +18 -0
  81. package/lib/emitters/support.d.ts.map +1 -0
  82. package/lib/emitters/support.js +37 -0
  83. package/lib/emitters/support.js.map +1 -0
  84. package/lib/{generators/swr/render.d.ts → emitters/swr.d.ts} +4 -2
  85. package/lib/emitters/swr.d.ts.map +1 -0
  86. package/lib/emitters/swr.js +88 -0
  87. package/lib/emitters/swr.js.map +1 -0
  88. package/lib/{generators/tanstack-query/render.d.ts → emitters/tanstack-query.d.ts} +5 -6
  89. package/lib/emitters/tanstack-query.d.ts.map +1 -0
  90. package/lib/{generators/tanstack-query/render.js → emitters/tanstack-query.js} +21 -33
  91. package/lib/emitters/tanstack-query.js.map +1 -0
  92. package/lib/{generators/transformers/render.d.ts → emitters/transformers.d.ts} +2 -2
  93. package/lib/emitters/transformers.d.ts.map +1 -0
  94. package/lib/{generators/transformers/render.js → emitters/transformers.js} +165 -125
  95. package/lib/emitters/transformers.js.map +1 -0
  96. package/lib/emitters/ts.d.ts +42 -0
  97. package/lib/emitters/ts.d.ts.map +1 -0
  98. package/lib/emitters/ts.js +116 -0
  99. package/lib/emitters/ts.js.map +1 -0
  100. package/lib/emitters/type-guards.d.ts +21 -0
  101. package/lib/emitters/type-guards.d.ts.map +1 -0
  102. package/lib/{generators/typescript → emitters}/type-guards.js +52 -18
  103. package/lib/emitters/type-guards.js.map +1 -0
  104. package/lib/emitters/types.d.ts +15 -0
  105. package/lib/emitters/types.d.ts.map +1 -0
  106. package/lib/emitters/types.js +125 -0
  107. package/lib/emitters/types.js.map +1 -0
  108. package/lib/{contracts/typescript.d.ts → emitters/wrapper-support.d.ts} +24 -13
  109. package/lib/emitters/wrapper-support.d.ts.map +1 -0
  110. package/lib/emitters/wrapper-support.js +127 -0
  111. package/lib/emitters/wrapper-support.js.map +1 -0
  112. package/lib/{generators/zod/schemas.d.ts → emitters/zod.d.ts} +5 -4
  113. package/lib/emitters/zod.d.ts.map +1 -0
  114. package/lib/{generators/zod/schemas.js → emitters/zod.js} +154 -118
  115. package/lib/emitters/zod.js.map +1 -0
  116. package/lib/generate.d.ts +10 -10
  117. package/lib/generate.d.ts.map +1 -1
  118. package/lib/generate.js +106 -25
  119. package/lib/generate.js.map +1 -1
  120. package/lib/generators/anchor.d.ts +9 -0
  121. package/lib/generators/anchor.d.ts.map +1 -0
  122. package/lib/generators/anchor.js +10 -0
  123. package/lib/generators/anchor.js.map +1 -0
  124. package/lib/generators/index.d.ts +3 -2
  125. package/lib/generators/index.d.ts.map +1 -1
  126. package/lib/generators/index.js +53 -31
  127. package/lib/generators/index.js.map +1 -1
  128. package/lib/generators/{mock/index.d.ts → mock.d.ts} +2 -2
  129. package/lib/generators/mock.d.ts.map +1 -0
  130. package/lib/generators/{mock/index.js → mock.js} +8 -8
  131. package/lib/generators/mock.js.map +1 -0
  132. package/lib/generators/resolve.d.ts.map +1 -1
  133. package/lib/generators/resolve.js +13 -92
  134. package/lib/generators/resolve.js.map +1 -1
  135. package/lib/generators/sdk.d.ts +12 -0
  136. package/lib/generators/sdk.d.ts.map +1 -0
  137. package/lib/generators/sdk.js +26 -0
  138. package/lib/generators/sdk.js.map +1 -0
  139. package/lib/generators/{swr/index.d.ts → swr.d.ts} +3 -3
  140. package/lib/generators/swr.d.ts.map +1 -0
  141. package/lib/generators/{swr/index.js → swr.js} +10 -7
  142. package/lib/generators/swr.js.map +1 -0
  143. package/lib/generators/{tanstack-query/index.d.ts → tanstack-query.d.ts} +3 -3
  144. package/lib/generators/tanstack-query.d.ts.map +1 -0
  145. package/lib/generators/{tanstack-query/index.js → tanstack-query.js} +10 -11
  146. package/lib/generators/tanstack-query.js.map +1 -0
  147. package/lib/generators/{transformers/index.d.ts → transformers.d.ts} +2 -2
  148. package/lib/generators/transformers.d.ts.map +1 -0
  149. package/lib/generators/{transformers/index.js → transformers.js} +8 -11
  150. package/lib/generators/transformers.js.map +1 -0
  151. package/lib/generators/types.d.ts +12 -190
  152. package/lib/generators/types.d.ts.map +1 -1
  153. package/lib/generators/{zod/index.d.ts → zod.d.ts} +2 -2
  154. package/lib/generators/zod.d.ts.map +1 -0
  155. package/lib/generators/{zod/index.js → zod.js} +7 -5
  156. package/lib/generators/zod.js.map +1 -0
  157. package/lib/index.d.ts +3 -8
  158. package/lib/index.d.ts.map +1 -1
  159. package/lib/index.js +11 -18
  160. package/lib/index.js.map +1 -1
  161. package/lib/intermediate-representation/build.d.ts +1 -8
  162. package/lib/intermediate-representation/build.d.ts.map +1 -1
  163. package/lib/intermediate-representation/build.js +4 -59
  164. package/lib/intermediate-representation/build.js.map +1 -1
  165. package/lib/intermediate-representation/model.d.ts +1 -26
  166. package/lib/intermediate-representation/model.d.ts.map +1 -1
  167. package/lib/intermediate-representation/model.js.map +1 -1
  168. package/lib/intermediate-representation/sanitize-identifiers.d.ts +10 -1
  169. package/lib/intermediate-representation/sanitize-identifiers.d.ts.map +1 -1
  170. package/lib/intermediate-representation/sanitize-identifiers.js +38 -37
  171. package/lib/intermediate-representation/sanitize-identifiers.js.map +1 -1
  172. package/lib/plugin.d.ts +4 -4
  173. package/lib/plugin.d.ts.map +1 -1
  174. package/lib/plugin.js +9 -12
  175. package/lib/plugin.js.map +1 -1
  176. package/lib/runtime/auth.d.ts.map +1 -0
  177. package/lib/runtime/auth.js.map +1 -0
  178. package/lib/{generators/typescript/runtime → runtime}/create-client.d.ts +2 -7
  179. package/lib/runtime/create-client.d.ts.map +1 -0
  180. package/lib/{generators/typescript/runtime → runtime}/create-client.js +30 -84
  181. package/lib/runtime/create-client.js.map +1 -0
  182. package/lib/runtime/errors.d.ts.map +1 -0
  183. package/lib/runtime/errors.js.map +1 -0
  184. package/lib/runtime/index.d.ts.map +1 -0
  185. package/lib/runtime/index.js.map +1 -0
  186. package/lib/runtime/multipart.d.ts.map +1 -0
  187. package/lib/runtime/multipart.js.map +1 -0
  188. package/lib/{generators/typescript/runtime → runtime}/paginate.d.ts +2 -2
  189. package/lib/runtime/paginate.d.ts.map +1 -0
  190. package/lib/{generators/typescript/runtime → runtime}/paginate.js +12 -12
  191. package/lib/runtime/paginate.js.map +1 -0
  192. package/lib/runtime/parse.d.ts.map +1 -0
  193. package/lib/runtime/parse.js.map +1 -0
  194. package/lib/runtime/retry.d.ts.map +1 -0
  195. package/lib/runtime/retry.js.map +1 -0
  196. package/lib/runtime/send.d.ts.map +1 -0
  197. package/lib/runtime/send.js.map +1 -0
  198. package/lib/runtime/setup.d.ts.map +1 -0
  199. package/lib/runtime/setup.js.map +1 -0
  200. package/lib/runtime/sse.d.ts.map +1 -0
  201. package/lib/runtime/sse.js.map +1 -0
  202. package/lib/{generators/typescript/runtime → runtime}/types.d.ts +95 -17
  203. package/lib/runtime/types.d.ts.map +1 -0
  204. package/lib/runtime/types.js.map +1 -0
  205. package/lib/runtime/url.d.ts.map +1 -0
  206. package/lib/runtime/url.js.map +1 -0
  207. package/lib/runtime-contract.d.ts +2 -62
  208. package/lib/runtime-contract.d.ts.map +1 -1
  209. package/lib/runtime-contract.js +3 -3
  210. package/lib/runtime-contract.js.map +1 -1
  211. package/lib/types.d.ts +8 -38
  212. package/lib/types.d.ts.map +1 -1
  213. package/package.json +4 -40
  214. package/eject-assets/AGENTS.md +0 -137
  215. package/eject-assets/generators/cli/docs.ts +0 -224
  216. package/eject-assets/generators/cli/engine-source.ts +0 -21
  217. package/eject-assets/generators/cli/index.ts +0 -90
  218. package/eject-assets/generators/cli/render.ts +0 -348
  219. package/eject-assets/generators/go/client.ts +0 -57
  220. package/eject-assets/generators/go/descriptor.ts +0 -41
  221. package/eject-assets/generators/go/index.ts +0 -336
  222. package/eject-assets/generators/go/models.ts +0 -179
  223. package/eject-assets/generators/go/naming.ts +0 -49
  224. package/eject-assets/generators/go/operations.ts +0 -296
  225. package/eject-assets/generators/go/pagination.ts +0 -194
  226. package/eject-assets/generators/go/types.ts +0 -60
  227. package/eject-assets/generators/mock/faker.ts +0 -214
  228. package/eject-assets/generators/mock/index.ts +0 -35
  229. package/eject-assets/generators/mock/render.ts +0 -282
  230. package/eject-assets/generators/mock/sample.ts +0 -316
  231. package/eject-assets/generators/mock/values.ts +0 -63
  232. package/eject-assets/generators/php/client.ts +0 -63
  233. package/eject-assets/generators/php/descriptor.ts +0 -58
  234. package/eject-assets/generators/php/index.ts +0 -237
  235. package/eject-assets/generators/php/models.ts +0 -275
  236. package/eject-assets/generators/php/naming.ts +0 -51
  237. package/eject-assets/generators/php/operations.ts +0 -232
  238. package/eject-assets/generators/php/pagination.ts +0 -133
  239. package/eject-assets/generators/php/types.ts +0 -148
  240. package/eject-assets/generators/python/client.ts +0 -123
  241. package/eject-assets/generators/python/descriptor.ts +0 -52
  242. package/eject-assets/generators/python/index.ts +0 -251
  243. package/eject-assets/generators/python/models.ts +0 -242
  244. package/eject-assets/generators/python/naming.ts +0 -46
  245. package/eject-assets/generators/python/operations.ts +0 -147
  246. package/eject-assets/generators/python/pagination.ts +0 -128
  247. package/eject-assets/generators/python/types.ts +0 -54
  248. package/eject-assets/generators/swr/index.ts +0 -37
  249. package/eject-assets/generators/swr/render.ts +0 -78
  250. package/eject-assets/generators/tanstack-query/index.ts +0 -48
  251. package/eject-assets/generators/tanstack-query/render.ts +0 -346
  252. package/eject-assets/generators/transformers/index.ts +0 -46
  253. package/eject-assets/generators/transformers/render.ts +0 -506
  254. package/eject-assets/generators/typescript/banner.ts +0 -35
  255. package/eject-assets/generators/typescript/client.ts +0 -254
  256. package/eject-assets/generators/typescript/descriptor.ts +0 -137
  257. package/eject-assets/generators/typescript/index.ts +0 -101
  258. package/eject-assets/generators/typescript/inline-runtime.ts +0 -135
  259. package/eject-assets/generators/typescript/operation-signature.ts +0 -62
  260. package/eject-assets/generators/typescript/operation-types.ts +0 -17
  261. package/eject-assets/generators/typescript/operations.ts +0 -524
  262. package/eject-assets/generators/typescript/response-headers.ts +0 -74
  263. package/eject-assets/generators/typescript/type-guards.ts +0 -159
  264. package/eject-assets/generators/typescript/types.ts +0 -172
  265. package/eject-assets/generators/zod/index.ts +0 -32
  266. package/eject-assets/generators/zod/schemas.ts +0 -456
  267. package/eject-assets/skills/cli-generator/SKILL.md +0 -121
  268. package/eject-assets/skills/client-generators/SKILL.md +0 -142
  269. package/eject-assets/skills/go-generator/SKILL.md +0 -96
  270. package/eject-assets/skills/mock-generator/SKILL.md +0 -50
  271. package/eject-assets/skills/php-generator/SKILL.md +0 -112
  272. package/eject-assets/skills/python-generator/SKILL.md +0 -110
  273. package/eject-assets/skills/swr-generator/SKILL.md +0 -50
  274. package/eject-assets/skills/tanstack-query-generator/SKILL.md +0 -55
  275. package/eject-assets/skills/transformers-generator/SKILL.md +0 -47
  276. package/eject-assets/skills/typescript-generator/SKILL.md +0 -95
  277. package/eject-assets/skills/zod-generator/SKILL.md +0 -54
  278. package/lib/authoring/index.d.ts +0 -11
  279. package/lib/authoring/index.d.ts.map +0 -1
  280. package/lib/authoring/index.js +0 -42
  281. package/lib/authoring/index.js.map +0 -1
  282. package/lib/authoring/naming.d.ts +0 -34
  283. package/lib/authoring/naming.d.ts.map +0 -1
  284. package/lib/authoring/naming.js +0 -104
  285. package/lib/authoring/naming.js.map +0 -1
  286. package/lib/authoring/operation.d.ts +0 -47
  287. package/lib/authoring/operation.d.ts.map +0 -1
  288. package/lib/authoring/operation.js +0 -86
  289. package/lib/authoring/operation.js.map +0 -1
  290. package/lib/authoring/options.d.ts +0 -9
  291. package/lib/authoring/options.d.ts.map +0 -1
  292. package/lib/authoring/options.js +0 -5
  293. package/lib/authoring/options.js.map +0 -1
  294. package/lib/authoring/pagination.d.ts +0 -19
  295. package/lib/authoring/pagination.d.ts.map +0 -1
  296. package/lib/authoring/pagination.js +0 -45
  297. package/lib/authoring/pagination.js.map +0 -1
  298. package/lib/authoring/printer.d.ts +0 -16
  299. package/lib/authoring/printer.d.ts.map +0 -1
  300. package/lib/authoring/printer.js +0 -36
  301. package/lib/authoring/printer.js.map +0 -1
  302. package/lib/authoring/reference-page.d.ts +0 -31
  303. package/lib/authoring/reference-page.d.ts.map +0 -1
  304. package/lib/authoring/reference-page.js +0 -160
  305. package/lib/authoring/reference-page.js.map +0 -1
  306. package/lib/authoring/schema.d.ts +0 -51
  307. package/lib/authoring/schema.d.ts.map +0 -1
  308. package/lib/authoring/schema.js +0 -190
  309. package/lib/authoring/schema.js.map +0 -1
  310. package/lib/cli-contract.d.ts +0 -126
  311. package/lib/cli-contract.d.ts.map +0 -1
  312. package/lib/cli-contract.js +0 -25
  313. package/lib/cli-contract.js.map +0 -1
  314. package/lib/contracts/typescript.d.ts.map +0 -1
  315. package/lib/contracts/typescript.js +0 -87
  316. package/lib/contracts/typescript.js.map +0 -1
  317. package/lib/generators/cli/docs.d.ts +0 -19
  318. package/lib/generators/cli/docs.d.ts.map +0 -1
  319. package/lib/generators/cli/docs.js +0 -187
  320. package/lib/generators/cli/docs.js.map +0 -1
  321. package/lib/generators/cli/engine-source.d.ts +0 -5
  322. package/lib/generators/cli/engine-source.d.ts.map +0 -1
  323. package/lib/generators/cli/engine-source.js +0 -12
  324. package/lib/generators/cli/engine-source.js.map +0 -1
  325. package/lib/generators/cli/index.d.ts +0 -18
  326. package/lib/generators/cli/index.d.ts.map +0 -1
  327. package/lib/generators/cli/index.js +0 -67
  328. package/lib/generators/cli/index.js.map +0 -1
  329. package/lib/generators/cli/render.d.ts +0 -39
  330. package/lib/generators/cli/render.d.ts.map +0 -1
  331. package/lib/generators/cli/render.js +0 -281
  332. package/lib/generators/cli/render.js.map +0 -1
  333. package/lib/generators/cli/runtime/cli.d.ts +0 -42
  334. package/lib/generators/cli/runtime/cli.d.ts.map +0 -1
  335. package/lib/generators/cli/runtime/cli.js +0 -582
  336. package/lib/generators/cli/runtime/cli.js.map +0 -1
  337. package/lib/generators/compatibility.d.ts +0 -10
  338. package/lib/generators/compatibility.d.ts.map +0 -1
  339. package/lib/generators/compatibility.js +0 -45
  340. package/lib/generators/compatibility.js.map +0 -1
  341. package/lib/generators/go/client.d.ts +0 -5
  342. package/lib/generators/go/client.d.ts.map +0 -1
  343. package/lib/generators/go/client.js +0 -34
  344. package/lib/generators/go/client.js.map +0 -1
  345. package/lib/generators/go/descriptor.d.ts +0 -6
  346. package/lib/generators/go/descriptor.d.ts.map +0 -1
  347. package/lib/generators/go/descriptor.js +0 -26
  348. package/lib/generators/go/descriptor.js.map +0 -1
  349. package/lib/generators/go/index.d.ts +0 -14
  350. package/lib/generators/go/index.d.ts.map +0 -1
  351. package/lib/generators/go/index.js +0 -240
  352. package/lib/generators/go/index.js.map +0 -1
  353. package/lib/generators/go/models.d.ts +0 -4
  354. package/lib/generators/go/models.d.ts.map +0 -1
  355. package/lib/generators/go/models.js +0 -125
  356. package/lib/generators/go/models.js.map +0 -1
  357. package/lib/generators/go/naming.d.ts +0 -15
  358. package/lib/generators/go/naming.d.ts.map +0 -1
  359. package/lib/generators/go/naming.js +0 -36
  360. package/lib/generators/go/naming.js.map +0 -1
  361. package/lib/generators/go/operations.d.ts +0 -16
  362. package/lib/generators/go/operations.d.ts.map +0 -1
  363. package/lib/generators/go/operations.js +0 -200
  364. package/lib/generators/go/operations.js.map +0 -1
  365. package/lib/generators/go/pagination.d.ts +0 -5
  366. package/lib/generators/go/pagination.d.ts.map +0 -1
  367. package/lib/generators/go/pagination.js +0 -93
  368. package/lib/generators/go/pagination.js.map +0 -1
  369. package/lib/generators/go/types.d.ts +0 -4
  370. package/lib/generators/go/types.d.ts.map +0 -1
  371. package/lib/generators/go/types.js +0 -48
  372. package/lib/generators/go/types.js.map +0 -1
  373. package/lib/generators/meta.d.ts +0 -13
  374. package/lib/generators/meta.d.ts.map +0 -1
  375. package/lib/generators/meta.js +0 -157
  376. package/lib/generators/meta.js.map +0 -1
  377. package/lib/generators/mock/faker.d.ts.map +0 -1
  378. package/lib/generators/mock/faker.js +0 -180
  379. package/lib/generators/mock/faker.js.map +0 -1
  380. package/lib/generators/mock/index.d.ts.map +0 -1
  381. package/lib/generators/mock/index.js.map +0 -1
  382. package/lib/generators/mock/render.d.ts.map +0 -1
  383. package/lib/generators/mock/render.js +0 -228
  384. package/lib/generators/mock/render.js.map +0 -1
  385. package/lib/generators/mock/sample.d.ts.map +0 -1
  386. package/lib/generators/mock/sample.js.map +0 -1
  387. package/lib/generators/mock/values.d.ts +0 -33
  388. package/lib/generators/mock/values.d.ts.map +0 -1
  389. package/lib/generators/mock/values.js +0 -46
  390. package/lib/generators/mock/values.js.map +0 -1
  391. package/lib/generators/options.d.ts +0 -7
  392. package/lib/generators/options.d.ts.map +0 -1
  393. package/lib/generators/options.js +0 -74
  394. package/lib/generators/options.js.map +0 -1
  395. package/lib/generators/php/client.d.ts +0 -5
  396. package/lib/generators/php/client.d.ts.map +0 -1
  397. package/lib/generators/php/client.js +0 -38
  398. package/lib/generators/php/client.js.map +0 -1
  399. package/lib/generators/php/descriptor.d.ts +0 -7
  400. package/lib/generators/php/descriptor.d.ts.map +0 -1
  401. package/lib/generators/php/descriptor.js +0 -42
  402. package/lib/generators/php/descriptor.js.map +0 -1
  403. package/lib/generators/php/index.d.ts +0 -14
  404. package/lib/generators/php/index.d.ts.map +0 -1
  405. package/lib/generators/php/index.js +0 -166
  406. package/lib/generators/php/index.js.map +0 -1
  407. package/lib/generators/php/models.d.ts +0 -8
  408. package/lib/generators/php/models.d.ts.map +0 -1
  409. package/lib/generators/php/models.js +0 -200
  410. package/lib/generators/php/models.js.map +0 -1
  411. package/lib/generators/php/naming.d.ts +0 -16
  412. package/lib/generators/php/naming.d.ts.map +0 -1
  413. package/lib/generators/php/naming.js +0 -31
  414. package/lib/generators/php/naming.js.map +0 -1
  415. package/lib/generators/php/operations.d.ts +0 -21
  416. package/lib/generators/php/operations.d.ts.map +0 -1
  417. package/lib/generators/php/operations.js +0 -156
  418. package/lib/generators/php/operations.js.map +0 -1
  419. package/lib/generators/php/pagination.d.ts +0 -5
  420. package/lib/generators/php/pagination.d.ts.map +0 -1
  421. package/lib/generators/php/pagination.js +0 -68
  422. package/lib/generators/php/pagination.js.map +0 -1
  423. package/lib/generators/php/types.d.ts +0 -27
  424. package/lib/generators/php/types.d.ts.map +0 -1
  425. package/lib/generators/php/types.js +0 -128
  426. package/lib/generators/php/types.js.map +0 -1
  427. package/lib/generators/python/client.d.ts +0 -6
  428. package/lib/generators/python/client.d.ts.map +0 -1
  429. package/lib/generators/python/client.js +0 -80
  430. package/lib/generators/python/client.js.map +0 -1
  431. package/lib/generators/python/descriptor.d.ts +0 -9
  432. package/lib/generators/python/descriptor.d.ts.map +0 -1
  433. package/lib/generators/python/descriptor.js +0 -38
  434. package/lib/generators/python/descriptor.js.map +0 -1
  435. package/lib/generators/python/index.d.ts +0 -15
  436. package/lib/generators/python/index.d.ts.map +0 -1
  437. package/lib/generators/python/index.js +0 -197
  438. package/lib/generators/python/index.js.map +0 -1
  439. package/lib/generators/python/models.d.ts +0 -31
  440. package/lib/generators/python/models.d.ts.map +0 -1
  441. package/lib/generators/python/models.js +0 -203
  442. package/lib/generators/python/models.js.map +0 -1
  443. package/lib/generators/python/naming.d.ts +0 -22
  444. package/lib/generators/python/naming.d.ts.map +0 -1
  445. package/lib/generators/python/naming.js +0 -28
  446. package/lib/generators/python/naming.js.map +0 -1
  447. package/lib/generators/python/operations.d.ts +0 -4
  448. package/lib/generators/python/operations.d.ts.map +0 -1
  449. package/lib/generators/python/operations.js +0 -108
  450. package/lib/generators/python/operations.js.map +0 -1
  451. package/lib/generators/python/pagination.d.ts +0 -5
  452. package/lib/generators/python/pagination.d.ts.map +0 -1
  453. package/lib/generators/python/pagination.js +0 -95
  454. package/lib/generators/python/pagination.js.map +0 -1
  455. package/lib/generators/python/types.d.ts +0 -4
  456. package/lib/generators/python/types.d.ts.map +0 -1
  457. package/lib/generators/python/types.js +0 -45
  458. package/lib/generators/python/types.js.map +0 -1
  459. package/lib/generators/swr/index.d.ts.map +0 -1
  460. package/lib/generators/swr/index.js.map +0 -1
  461. package/lib/generators/swr/render.d.ts.map +0 -1
  462. package/lib/generators/swr/render.js +0 -57
  463. package/lib/generators/swr/render.js.map +0 -1
  464. package/lib/generators/tanstack-query/index.d.ts.map +0 -1
  465. package/lib/generators/tanstack-query/index.js.map +0 -1
  466. package/lib/generators/tanstack-query/render.d.ts.map +0 -1
  467. package/lib/generators/tanstack-query/render.js.map +0 -1
  468. package/lib/generators/transformers/index.d.ts.map +0 -1
  469. package/lib/generators/transformers/index.js.map +0 -1
  470. package/lib/generators/transformers/render.d.ts.map +0 -1
  471. package/lib/generators/transformers/render.js.map +0 -1
  472. package/lib/generators/typescript/banner.d.ts +0 -12
  473. package/lib/generators/typescript/banner.d.ts.map +0 -1
  474. package/lib/generators/typescript/banner.js.map +0 -1
  475. package/lib/generators/typescript/client.d.ts +0 -25
  476. package/lib/generators/typescript/client.d.ts.map +0 -1
  477. package/lib/generators/typescript/client.js +0 -207
  478. package/lib/generators/typescript/client.js.map +0 -1
  479. package/lib/generators/typescript/descriptor.d.ts +0 -11
  480. package/lib/generators/typescript/descriptor.d.ts.map +0 -1
  481. package/lib/generators/typescript/descriptor.js +0 -97
  482. package/lib/generators/typescript/descriptor.js.map +0 -1
  483. package/lib/generators/typescript/index.d.ts +0 -20
  484. package/lib/generators/typescript/index.d.ts.map +0 -1
  485. package/lib/generators/typescript/index.js +0 -80
  486. package/lib/generators/typescript/index.js.map +0 -1
  487. package/lib/generators/typescript/inline-runtime.d.ts +0 -21
  488. package/lib/generators/typescript/inline-runtime.d.ts.map +0 -1
  489. package/lib/generators/typescript/inline-runtime.js +0 -114
  490. package/lib/generators/typescript/inline-runtime.js.map +0 -1
  491. package/lib/generators/typescript/operation-signature.d.ts +0 -23
  492. package/lib/generators/typescript/operation-signature.d.ts.map +0 -1
  493. package/lib/generators/typescript/operation-signature.js +0 -41
  494. package/lib/generators/typescript/operation-signature.js.map +0 -1
  495. package/lib/generators/typescript/operation-types.d.ts +0 -9
  496. package/lib/generators/typescript/operation-types.d.ts.map +0 -1
  497. package/lib/generators/typescript/operation-types.js +0 -11
  498. package/lib/generators/typescript/operation-types.js.map +0 -1
  499. package/lib/generators/typescript/operations.d.ts +0 -60
  500. package/lib/generators/typescript/operations.d.ts.map +0 -1
  501. package/lib/generators/typescript/operations.js +0 -386
  502. package/lib/generators/typescript/operations.js.map +0 -1
  503. package/lib/generators/typescript/response-headers.d.ts +0 -12
  504. package/lib/generators/typescript/response-headers.d.ts.map +0 -1
  505. package/lib/generators/typescript/response-headers.js +0 -40
  506. package/lib/generators/typescript/response-headers.js.map +0 -1
  507. package/lib/generators/typescript/runtime/auth.d.ts.map +0 -1
  508. package/lib/generators/typescript/runtime/auth.js.map +0 -1
  509. package/lib/generators/typescript/runtime/create-client.d.ts.map +0 -1
  510. package/lib/generators/typescript/runtime/create-client.js.map +0 -1
  511. package/lib/generators/typescript/runtime/errors.d.ts.map +0 -1
  512. package/lib/generators/typescript/runtime/errors.js.map +0 -1
  513. package/lib/generators/typescript/runtime/index.d.ts.map +0 -1
  514. package/lib/generators/typescript/runtime/index.js.map +0 -1
  515. package/lib/generators/typescript/runtime/multipart.d.ts.map +0 -1
  516. package/lib/generators/typescript/runtime/multipart.js.map +0 -1
  517. package/lib/generators/typescript/runtime/paginate.d.ts.map +0 -1
  518. package/lib/generators/typescript/runtime/paginate.js.map +0 -1
  519. package/lib/generators/typescript/runtime/parse.d.ts.map +0 -1
  520. package/lib/generators/typescript/runtime/parse.js.map +0 -1
  521. package/lib/generators/typescript/runtime/retry.d.ts.map +0 -1
  522. package/lib/generators/typescript/runtime/retry.js.map +0 -1
  523. package/lib/generators/typescript/runtime/send.d.ts.map +0 -1
  524. package/lib/generators/typescript/runtime/send.js.map +0 -1
  525. package/lib/generators/typescript/runtime/setup.d.ts.map +0 -1
  526. package/lib/generators/typescript/runtime/setup.js.map +0 -1
  527. package/lib/generators/typescript/runtime/sse.d.ts.map +0 -1
  528. package/lib/generators/typescript/runtime/sse.js.map +0 -1
  529. package/lib/generators/typescript/runtime/types.d.ts.map +0 -1
  530. package/lib/generators/typescript/runtime/types.js.map +0 -1
  531. package/lib/generators/typescript/runtime/url.d.ts.map +0 -1
  532. package/lib/generators/typescript/runtime/url.js.map +0 -1
  533. package/lib/generators/typescript/type-guards.d.ts +0 -4
  534. package/lib/generators/typescript/type-guards.d.ts.map +0 -1
  535. package/lib/generators/typescript/type-guards.js.map +0 -1
  536. package/lib/generators/typescript/types.d.ts +0 -8
  537. package/lib/generators/typescript/types.d.ts.map +0 -1
  538. package/lib/generators/typescript/types.js +0 -132
  539. package/lib/generators/typescript/types.js.map +0 -1
  540. package/lib/generators/zod/index.d.ts.map +0 -1
  541. package/lib/generators/zod/index.js.map +0 -1
  542. package/lib/generators/zod/schemas.d.ts.map +0 -1
  543. package/lib/generators/zod/schemas.js.map +0 -1
  544. package/lib/pagination.d.ts.map +0 -1
  545. package/lib/pagination.js.map +0 -1
  546. package/lib/pipeline.d.ts +0 -17
  547. package/lib/pipeline.d.ts.map +0 -1
  548. package/lib/pipeline.js +0 -244
  549. package/lib/pipeline.js.map +0 -1
  550. package/lib/printers/go.d.ts +0 -33
  551. package/lib/printers/go.d.ts.map +0 -1
  552. package/lib/printers/go.js +0 -209
  553. package/lib/printers/go.js.map +0 -1
  554. package/lib/printers/index.d.ts +0 -5
  555. package/lib/printers/index.d.ts.map +0 -1
  556. package/lib/printers/index.js +0 -9
  557. package/lib/printers/index.js.map +0 -1
  558. package/lib/printers/php.d.ts +0 -21
  559. package/lib/printers/php.d.ts.map +0 -1
  560. package/lib/printers/php.js +0 -68
  561. package/lib/printers/php.js.map +0 -1
  562. package/lib/printers/python.d.ts +0 -31
  563. package/lib/printers/python.d.ts.map +0 -1
  564. package/lib/printers/python.js +0 -101
  565. package/lib/printers/python.js.map +0 -1
  566. package/lib/printers/typescript.d.ts +0 -82
  567. package/lib/printers/typescript.d.ts.map +0 -1
  568. package/lib/printers/typescript.js +0 -268
  569. package/lib/printers/typescript.js.map +0 -1
  570. package/lib/reserved-names.d.ts +0 -8
  571. package/lib/reserved-names.d.ts.map +0 -1
  572. package/lib/reserved-names.js.map +0 -1
  573. package/lib/runtime-sources/go.d.ts +0 -2
  574. package/lib/runtime-sources/go.d.ts.map +0 -1
  575. package/lib/runtime-sources/go.js +0 -3
  576. package/lib/runtime-sources/go.js.map +0 -1
  577. package/lib/runtime-sources/php.d.ts +0 -2
  578. package/lib/runtime-sources/php.d.ts.map +0 -1
  579. package/lib/runtime-sources/php.js +0 -3
  580. package/lib/runtime-sources/php.js.map +0 -1
  581. package/lib/runtime-sources/python.d.ts +0 -12
  582. package/lib/runtime-sources/python.d.ts.map +0 -1
  583. package/lib/runtime-sources/python.js +0 -12
  584. package/lib/runtime-sources/python.js.map +0 -1
  585. package/lib/runtime-sources/typescript.d.ts +0 -36
  586. package/lib/runtime-sources/typescript.d.ts.map +0 -1
  587. package/lib/runtime-sources/typescript.js +0 -152
  588. package/lib/runtime-sources/typescript.js.map +0 -1
  589. package/lib/runtime-sources.d.ts +0 -5
  590. package/lib/runtime-sources.d.ts.map +0 -1
  591. package/lib/runtime-sources.js +0 -10
  592. package/lib/runtime-sources.js.map +0 -1
  593. package/lib/setup-bake.d.ts.map +0 -1
  594. package/lib/setup-bake.js.map +0 -1
  595. /package/lib/{generators/mock → emitters}/sample.js +0 -0
  596. /package/lib/{setup-bake.d.ts → emitters/setup-bake.d.ts} +0 -0
  597. /package/lib/{generators/typescript/runtime → runtime}/auth.d.ts +0 -0
  598. /package/lib/{generators/typescript/runtime → runtime}/auth.js +0 -0
  599. /package/lib/{generators/typescript/runtime → runtime}/errors.d.ts +0 -0
  600. /package/lib/{generators/typescript/runtime → runtime}/errors.js +0 -0
  601. /package/lib/{generators/typescript/runtime → runtime}/index.d.ts +0 -0
  602. /package/lib/{generators/typescript/runtime → runtime}/index.js +0 -0
  603. /package/lib/{generators/typescript/runtime → runtime}/multipart.d.ts +0 -0
  604. /package/lib/{generators/typescript/runtime → runtime}/multipart.js +0 -0
  605. /package/lib/{generators/typescript/runtime → runtime}/parse.d.ts +0 -0
  606. /package/lib/{generators/typescript/runtime → runtime}/parse.js +0 -0
  607. /package/lib/{generators/typescript/runtime → runtime}/retry.d.ts +0 -0
  608. /package/lib/{generators/typescript/runtime → runtime}/retry.js +0 -0
  609. /package/lib/{generators/typescript/runtime → runtime}/send.d.ts +0 -0
  610. /package/lib/{generators/typescript/runtime → runtime}/send.js +0 -0
  611. /package/lib/{generators/typescript/runtime → runtime}/setup.d.ts +0 -0
  612. /package/lib/{generators/typescript/runtime → runtime}/setup.js +0 -0
  613. /package/lib/{generators/typescript/runtime → runtime}/sse.d.ts +0 -0
  614. /package/lib/{generators/typescript/runtime → runtime}/sse.js +0 -0
  615. /package/lib/{generators/typescript/runtime → runtime}/types.js +0 -0
  616. /package/lib/{generators/typescript/runtime → runtime}/url.d.ts +0 -0
  617. /package/lib/{generators/typescript/runtime → runtime}/url.js +0 -0
package/README.md CHANGED
@@ -11,7 +11,7 @@ See https://github.com/Redocly/redocly-cli for the full project.
11
11
  The generated client uses only web-standard APIs (`fetch`, `AbortController`, `URLSearchParams`), so by default it is a single self-contained file with zero runtime dependencies that runs in browsers, Node ≥ 18, Bun, Deno, and edge runtimes.
12
12
  (Running the generator itself requires the Node version in this package's `engines` field.)
13
13
  Code is produced through the TypeScript compiler AST, not string templates; `typescript` is the only peer dependency — optional, needed only when you run generation, and it must be 6.x there (TypeScript 7's native compiler has no compiler API).
14
- Apps that only consume a generated client don't need it at all, and can compile the generated code with any TypeScript, including 7.
14
+ Apps that only consume a package-runtime client don't need it at all, and can compile the generated code with any TypeScript, including 7.
15
15
 
16
16
  This package is the engine behind the [`generate-client` command](https://redocly.com/docs/cli/commands/generate-client) — install [`@redocly/cli`](https://www.npmjs.com/package/@redocly/cli) to run it from the command line or `redocly.yaml`.
17
17
  How to use the generated client — auth, middleware, retries, pagination, Server-Sent Events, and the add-on generators (`zod`, `tanstack-query`, `swr`, `mock`, `transformers`) — is documented in [Use the generated client](https://redocly.com/docs/cli/guides/use-generated-client).
@@ -27,7 +27,7 @@ import { generateClient } from '@redocly/client-generator';
27
27
  const result = await generateClient({
28
28
  api: './openapi.yaml', // file path or URL; OpenAPI 3.0/3.1/3.2 or Swagger 2.0
29
29
  output: './src/api/client.ts',
30
- generators: ['typescript', 'zod'],
30
+ generators: ['sdk', 'zod'],
31
31
  });
32
32
 
33
33
  console.log(`Wrote ${result.files.length} file(s), ${result.bytes} bytes.`);
@@ -41,7 +41,8 @@ For type-safe authoring of a standalone options object, annotate it with `satisf
41
41
  The generated module exports its operation descriptors, so an app can build additional instances with independent configuration and credentials over the same generated code:
42
42
 
43
43
  ```ts
44
- import { createClient, OPERATIONS, type Ops } from './client.ts';
44
+ import { createClient } from '@redocly/client-generator';
45
+ import { OPERATIONS, type Ops } from './client.ts';
45
46
 
46
47
  const internal = createClient<Ops>(OPERATIONS, {
47
48
  serverUrl: 'https://api.example.com',
@@ -49,35 +50,48 @@ const internal = createClient<Ops>(OPERATIONS, {
49
50
  });
50
51
  ```
51
52
 
53
+ With `runtime: 'package'` the generated client also imports its whole engine from this package (instead of embedding it), so engine fixes arrive via `npm update` — install this package as a regular dependency of the consuming app.
54
+
52
55
  ### Write a custom generator
53
56
 
54
57
  A custom generator reads the same API model the built-ins consume, runs in the same pass, and returns files.
55
- Emitters print text: `Printer` handles indentation, and `tsType` is the same schema→type renderer the built-in sdk uses, so the mapping (refs, arrays, unions, formats, parenthesization) matches the generated client exactly:
58
+ Build real TypeScript with the emit toolkit from `@redocly/client-generator/generate` — the same `ts.factory` + printer the built-in generators use, so the schema→type mapping matches the sdk's exactly:
56
59
 
57
60
  ```ts
58
61
  // response-map-generator.ts
59
- import { defineGenerator, Printer } from '@redocly/client-generator';
60
- import { tsType } from '@redocly/client-generator/generate';
62
+ import { defineGenerator } from '@redocly/client-generator';
63
+ import { printStatements, schemaToTypeNode, ts } from '@redocly/client-generator/generate';
64
+
65
+ const { factory } = ts;
61
66
 
62
67
  export default defineGenerator({
63
68
  name: 'response-map',
64
- requires: ['typescript'],
65
- run({ model, output }) {
66
- const printer = new Printer();
69
+ requires: ['sdk'],
70
+ run({ model, outputPath }) {
67
71
  // One `ResponseShapes` entry per operation with a JSON success body.
68
- printer.block(
69
- 'export type ResponseShapes = {',
70
- () => {
71
- for (const service of model.services) {
72
- for (const op of service.operations) {
73
- const success = op.successResponses.find((r) => r.contentType.includes('json'));
74
- if (success) printer.line(`${op.name}: ${tsType(success.schema)};`);
75
- }
76
- }
77
- },
78
- '};'
72
+ const members = model.services
73
+ .flatMap((service) => service.operations)
74
+ .flatMap((op) => {
75
+ const success = op.successResponses.find((r) => r.contentType.includes('json'));
76
+ if (!success) return [];
77
+ return [
78
+ factory.createPropertySignature(
79
+ undefined,
80
+ op.name,
81
+ undefined,
82
+ schemaToTypeNode(success.schema)
83
+ ),
84
+ ];
85
+ });
86
+ const alias = factory.createTypeAliasDeclaration(
87
+ [factory.createModifier(ts.SyntaxKind.ExportKeyword)],
88
+ 'ResponseShapes',
89
+ undefined,
90
+ factory.createTypeLiteralNode(members)
79
91
  );
80
- return [{ path: output.path.replace(/\.ts$/, '.responses.ts'), content: printer.toString() }];
92
+ return [
93
+ { path: outputPath.replace(/\.ts$/, '.responses.ts'), content: printStatements([alias]) },
94
+ ];
81
95
  },
82
96
  });
83
97
  ```
@@ -113,7 +127,7 @@ type GenerateClientResult = {
113
127
  ### `collectGeneratedFiles`
114
128
 
115
129
  Runs the configured generators against a built model and returns the files in memory, without writing to disk.
116
- Imported from `@redocly/client-generator/generate` — the generation-time entry; the package root stays a small authoring surface:
130
+ Imported from `@redocly/client-generator/generate` — the generation-time entry; the package root stays runtime-only so package-mode clients never load the generator stack:
117
131
 
118
132
  ```ts
119
133
  function collectGeneratedFiles(
@@ -130,16 +144,13 @@ function collectGeneratedFiles(
130
144
 
131
145
  ### `defineGenerator`
132
146
 
133
- Authors a custom generator (`{ name, run }` plus optional `requires`/`errorModes`/`dateTypes` compatibility metadata, validated up front):
147
+ Authors a custom generator (`{ name, run }` plus optional `requires`/`errorModes`/`dateTypes`/`runtimes` compatibility metadata, validated up front):
134
148
 
135
149
  ```ts
136
150
  function defineGenerator(generator: CustomGenerator): CustomGenerator;
137
151
  ```
138
152
 
139
- The `@redocly/client-generator/generate` entry also exports the TypeScript renderers the built-ins use (`tsType`, `tsJsdoc`, `codeLiteral`, `operationSignature`, `pascalCase`, `safeIdent`).
140
- The package root exports the IR types plus the language-neutral toolkit.
141
- A custom generator emits TypeScript exactly as the first-party ones do.
142
- See the [`typescript-types-generator` example](https://github.com/Redocly/redocly-cli/tree/main/tests/e2e/generate-client/examples/typescript-types-generator).
153
+ The `@redocly/client-generator/generate` entry also exports the emit toolkit the built-ins use (`ts`, `printStatements`, `parseStatements`, `operationSignature`, `schemaToTypeNode`, `pascalCase`, …), and the package root exports the IR types, so a custom generator emits TypeScript exactly as the first-party ones do — see the [`ast-toolkit-generator` example](https://github.com/Redocly/redocly-cli/tree/main/tests/e2e/generate-client/examples/ast-toolkit-generator).
143
154
 
144
155
  ### `defineClientSetup`
145
156
 
@@ -154,9 +165,20 @@ function defineClientSetup(setup: {
154
165
 
155
166
  A setup module may import only from `@redocly/client-generator`, so it never adds a dependency to the client (the import is stripped at generation time).
156
167
 
168
+ ### `createClient`
169
+
170
+ The runtime factory that `runtime: 'package'` clients import, also usable directly to build extra instances over generated descriptors (see [Basic usage](#build-extra-client-instances)):
171
+
172
+ ```ts
173
+ function createClient<Ops>(
174
+ operations: Record<string, OperationDescriptor>,
175
+ config?: ClientConfig
176
+ ): Client<Ops>;
177
+ ```
178
+
157
179
  ## Examples
158
180
 
159
- Runnable examples — from a zero-install quickstart to middleware, publisher setup, SSE streaming, pagination, and custom generators — live in [`tests/e2e/generate-client/examples`](https://github.com/Redocly/redocly-cli/tree/main/tests/e2e/generate-client/examples).
181
+ Runnable examples — from a zero-install quickstart to middleware, publisher setup, SSE streaming, pagination, custom generators, and the package runtime — live in [`tests/e2e/generate-client/examples`](https://github.com/Redocly/redocly-cli/tree/main/tests/e2e/generate-client/examples).
160
182
  Each is a standalone Vite app with a checked-in, drift-checked generated client.
161
183
 
162
184
  ## Documentation
@@ -177,4 +199,4 @@ npm run unit # unit tests (this package is held at 100% cover
177
199
  VITEST_SUITE=e2e npx vitest run tests/e2e/generate-client/ # behavioral e2e
178
200
  ```
179
201
 
180
- Each generator that embeds a runtime keeps its sources in its own folder (`src/generators/<name>/runtime/` — real, unit-testable modules that generation embeds), the IR lives in `src/intermediate-representation/`, and the generators in `src/generators/`.
202
+ The client runtime lives in `src/runtime/` (real, unit-testable modules; package mode imports them, inline mode embeds them), the structural emitters in `src/emitters/`, the IR in `src/intermediate-representation/`, the generators in `src/generators/`, and the file-layout writers in `src/writers/`.
@@ -0,0 +1,14 @@
1
+ import type { SecuritySchemeModel } from '../intermediate-representation/model.js';
2
+ /**
3
+ * Public setter name for an apiKey scheme: `setApiKey` when it's the only apiKey
4
+ * scheme (of any `in`), else `setApiKey<Key>` to disambiguate.
5
+ */
6
+ export declare function apiKeySetterName(key: string, sole: boolean): string;
7
+ /**
8
+ * The public credential-setter names the client exports for a set of schemes,
9
+ * in emission order (`setBearer`, then `setBasicAuth`, then each apiKey setter).
10
+ * Also seeds the reserved-identifier set (`packageIdents`) so operation names
11
+ * can't collide with a setter.
12
+ */
13
+ export declare function authSetterNames(schemes: SecuritySchemeModel[]): string[];
14
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/emitters/auth.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAGnF;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAEnE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,mBAAmB,EAAE,GAAG,MAAM,EAAE,CAWxE"}
@@ -0,0 +1,30 @@
1
+ // The auth *naming* conventions of the generated surface. Credential injection itself
2
+ // lives in the runtime (src/runtime/auth.ts); the wiring emitter only derives the
3
+ // public setter names bound to the client instance's `auth` members.
4
+ import { pascalCase } from './support.js';
5
+ /**
6
+ * Public setter name for an apiKey scheme: `setApiKey` when it's the only apiKey
7
+ * scheme (of any `in`), else `setApiKey<Key>` to disambiguate.
8
+ */
9
+ export function apiKeySetterName(key, sole) {
10
+ return sole ? 'setApiKey' : `setApiKey${pascalCase(key)}`;
11
+ }
12
+ /**
13
+ * The public credential-setter names the client exports for a set of schemes,
14
+ * in emission order (`setBearer`, then `setBasicAuth`, then each apiKey setter).
15
+ * Also seeds the reserved-identifier set (`packageIdents`) so operation names
16
+ * can't collide with a setter.
17
+ */
18
+ export function authSetterNames(schemes) {
19
+ const names = [];
20
+ if (schemes.some((s) => s.kind === 'bearer'))
21
+ names.push('setBearer');
22
+ if (schemes.some((s) => s.kind === 'basic'))
23
+ names.push('setBasicAuth');
24
+ const apiKeySchemes = schemes.filter((s) => s.kind === 'apiKeyHeader' || s.kind === 'apiKeyQuery' || s.kind === 'apiKeyCookie');
25
+ for (const scheme of apiKeySchemes) {
26
+ names.push(apiKeySetterName(scheme.key, apiKeySchemes.length === 1));
27
+ }
28
+ return names;
29
+ }
30
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/emitters/auth.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,kFAAkF;AAClF,qEAAqE;AAGrE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW,EAAE,IAAa;IACzD,OAAO,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;AAC5D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,OAA8B;IAC5D,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtE,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC;QAAE,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACxE,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAClC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,IAAI,CAAC,CAAC,IAAI,KAAK,aAAa,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc,CAC1F,CAAC;IACF,KAAK,MAAM,MAAM,IAAI,aAAa,EAAE,CAAC;QACnC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,GAAG,EAAE,aAAa,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type ApiModel } from '../intermediate-representation/model.js';
2
+ import { type EmitOptions } from './emit-options.js';
3
+ export declare function emitClientSingleFile(model: ApiModel, options?: EmitOptions): string;
4
+ /**
5
+ * `split` mode: the same client with the schema types + type guards carved out into a
6
+ * sibling `<stem>.schemas.ts`. The entry file re-exports the schemas module
7
+ * (`export *`) and type-imports exactly the schema names its own code references, so
8
+ * both files hold under `noUnusedLocals`. `schemas` is absent when the document
9
+ * declares no schema statements (the entry is then self-contained).
10
+ */
11
+ export declare function emitClientSplit(model: ApiModel, options: EmitOptions, stem: string): {
12
+ entry: string;
13
+ schemas?: string;
14
+ };
15
+ //# sourceMappingURL=client-assembly.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-assembly.d.ts","sourceRoot":"","sources":["../../src/emitters/client-assembly.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,KAAK,QAAQ,EAGd,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAAU,KAAK,WAAW,EAA8B,MAAM,mBAAmB,CAAC;AA2BzF,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,GAAE,WAAgB,GAAG,MAAM,CAEvF;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE,QAAQ,EACf,OAAO,EAAE,WAAW,EACpB,IAAI,EAAE,MAAM,GACX;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAErC"}
@@ -0,0 +1,358 @@
1
+ // Client assembly, shared by both runtime distributions and both output modes. The
2
+ // wiring (descriptor map + `Ops` interface, emitters/descriptor.ts) is identical; only
3
+ // the runtime block differs — `runtime: 'package'` imports `createClient` from
4
+ // `@redocly/client-generator`, everything else (inline, the default) embeds the
5
+ // assembled runtime sources in its place (emitters/inline-runtime.ts). Single-file
6
+ // layout: runtime (import line | embedded block) → schema types → type guards →
7
+ // `<Op>*` aliases → Ops → OPERATIONS → (baked setup) → client instance → sugar →
8
+ // (package mode only) type re-exports — the embedded types are already exported in
9
+ // place, so the embed arm needs none. Split mode moves the schema types + guards into
10
+ // a sibling `<stem>.schemas.ts` the entry re-exports (`emitClientSplit`).
11
+ import { allOperations, } from '../intermediate-representation/model.js';
12
+ import { apiKeySetterName } from './auth.js';
13
+ import { descriptorStatements, opsInterfaceStatements, packageIdents } from './descriptor.js';
14
+ import { banner, HEADER, renderTitleComment } from './emit-options.js';
15
+ import { codeString, isIdentifier } from './identifier.js';
16
+ import { assembleInlineRuntime } from './inline-runtime.js';
17
+ import { renderOperationAliases, sseAliases } from './operation-aliases.js';
18
+ import { operationSignature } from './operation-signature.js';
19
+ import { computeResponse, errorTypeNodes, isTypedMultipart } from './operation-types.js';
20
+ import { renderArgList } from './operations.js';
21
+ import { resolveModelPagination } from './pagination.js';
22
+ import { responseHeadersTypeLiteral } from './response-headers.js';
23
+ import { isSseOp } from './sse.js';
24
+ import { pascalCase } from './support.js';
25
+ import { arrow, exportConstStatement, parseStatements, printNodes, printStatements, ts, typedArrow, } from './ts.js';
26
+ import { typeGuardStatements } from './type-guards.js';
27
+ import { typesStatements } from './types.js';
28
+ const { factory } = ts;
29
+ const PACKAGE_SPECIFIER = '@redocly/client-generator';
30
+ export function emitClientSingleFile(model, options = {}) {
31
+ return emitClient(model, options).entry;
32
+ }
33
+ /**
34
+ * `split` mode: the same client with the schema types + type guards carved out into a
35
+ * sibling `<stem>.schemas.ts`. The entry file re-exports the schemas module
36
+ * (`export *`) and type-imports exactly the schema names its own code references, so
37
+ * both files hold under `noUnusedLocals`. `schemas` is absent when the document
38
+ * declares no schema statements (the entry is then self-contained).
39
+ */
40
+ export function emitClientSplit(model, options, stem) {
41
+ return emitClient(model, options, stem);
42
+ }
43
+ /** The shared assembly; `splitStem` (when given) selects the two-file split layout. */
44
+ function emitClient(model, options, splitStem) {
45
+ const embed = options.runtime !== 'package';
46
+ const ops = allOperations(model.services);
47
+ const idents = packageIdents(model);
48
+ // Resolved (and VERIFIED) up front: an explicit rule that doesn't fit throws here,
49
+ // before any statement is built — one aggregated error for the whole model.
50
+ const pagination = resolveModelPagination(model, options.pagination);
51
+ const ctx = {
52
+ argsStyle: options.argsStyle ?? 'flat',
53
+ errorMode: options.errorMode ?? 'throw',
54
+ dateType: options.dateType ?? 'string',
55
+ schemaNames: new Set(model.schemas.map((s) => s.name)),
56
+ schemas: model.schemas,
57
+ pagination,
58
+ };
59
+ const flat = ctx.argsStyle === 'flat';
60
+ const hasSse = ops.some(isSseOp);
61
+ const hasRegular = ops.some((op) => !isSseOp(op));
62
+ const apiKeySchemes = model.securitySchemes.filter((s) => s.kind === 'apiKeyHeader' || s.kind === 'apiKeyQuery' || s.kind === 'apiKeyCookie');
63
+ const wiring = ops.length > 0
64
+ ? [
65
+ ...opsInterfaceStatements(model, idents, ctx),
66
+ ...descriptorStatements(model, idents, ctx.dateType, pagination),
67
+ ]
68
+ : // A spec with no operations still gets the uniform wiring shape.
69
+ parseStatements('export type Ops = Record<string, never>;\n' +
70
+ 'export const OPERATIONS = {} as const satisfies Record<string, OperationDescriptor>;');
71
+ const runtimeSection = embed
72
+ ? assembleInlineRuntime({
73
+ multipart: ops.some((op) => op.requestBody && isTypedMultipart(op.requestBody)),
74
+ // Auth sugar needs schemes; `resolveAuth` fires when a descriptor carries
75
+ // `security` — a valid spec implies the former, but embed on either.
76
+ auth: model.securitySchemes.length > 0 || ops.some((op) => op.security.length > 0),
77
+ sse: hasSse,
78
+ setup: !!options.setup,
79
+ paginate: pagination.size > 0,
80
+ })
81
+ : importLine(options, ctx, {
82
+ hasFlatSse: hasSse && flat,
83
+ hasFlatRegular: hasRegular && flat,
84
+ hasRegular,
85
+ hasApiKey: apiKeySchemes.length > 0,
86
+ });
87
+ const schemaStatements = [
88
+ ...typesStatements(model.schemas, ctx.dateType),
89
+ ...typeGuardStatements(model.schemas),
90
+ ];
91
+ const bodyStatements = [...ops.flatMap((op) => aliasStatements(op, ctx)), ...wiring];
92
+ const sugar = printNodes(sugarStatements(ops, idents, ctx, model.securitySchemes, apiKeySchemes));
93
+ // Embed mode exports its whole public surface in place; only the package arm re-exports.
94
+ const reexports = embed ? '' : reexportLines(ctx, hasSse);
95
+ // Layout puts the reader's OWN API first (types → aliases → Ops → OPERATIONS) and the
96
+ // machinery after it. In embed mode the runtime block sits between the descriptors and
97
+ // the `client` initializer — after it for readability, before `client` so every
98
+ // declaration the module-init call chain touches (hoisted functions AND any future
99
+ // top-level const) is already evaluated; in package mode the import line leads.
100
+ if (splitStem === undefined) {
101
+ return {
102
+ entry: banner([
103
+ HEADER,
104
+ renderTitleComment(model),
105
+ ...(embed ? [] : [runtimeSection]),
106
+ printStatements([...schemaStatements, ...bodyStatements]),
107
+ ...(embed ? [runtimeSection] : []),
108
+ clientSection(options, ctx, model),
109
+ sugar,
110
+ reexports,
111
+ ]),
112
+ };
113
+ }
114
+ const body = printStatements(bodyStatements);
115
+ const hasSchemas = schemaStatements.length > 0;
116
+ return {
117
+ entry: banner([
118
+ HEADER,
119
+ renderTitleComment(model),
120
+ hasSchemas
121
+ ? schemaLinks(body + '\n' + sugar, ctx.schemaNames, `./${splitStem}.schemas.${options.importExt ?? 'js'}`)
122
+ : '',
123
+ ...(embed ? [] : [runtimeSection]),
124
+ body,
125
+ ...(embed ? [runtimeSection] : []),
126
+ clientSection(options, ctx, model),
127
+ sugar,
128
+ reexports,
129
+ ]),
130
+ schemas: hasSchemas
131
+ ? banner([HEADER, renderTitleComment(model), printStatements(schemaStatements)])
132
+ : undefined,
133
+ };
134
+ }
135
+ /**
136
+ * The entry ⇄ schemas linkage of the split layout: a type-only import of exactly the
137
+ * schema names the entry's own code references, plus the public `export *` re-export.
138
+ * Referenced names are found by walking the printed entry code's identifiers (an AST
139
+ * pass over the emitted text, not a substring search — operation JSDoc may mention a
140
+ * schema name, and importing an unreferenced type would trip `noUnusedLocals`).
141
+ */
142
+ function schemaLinks(entryCode, schemaNames, specifier) {
143
+ const referenced = new Set();
144
+ // Only TYPE references count as uses of the type-only import: a value-position
145
+ // identifier that happens to share a schema's name (every descriptor's `id:` key,
146
+ // for a schema named `id`) must not drag the name in — strict consumer lint
147
+ // configs flag the resulting unused import.
148
+ const visit = (node) => {
149
+ if (ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName)) {
150
+ if (schemaNames.has(node.typeName.text))
151
+ referenced.add(node.typeName.text);
152
+ }
153
+ node.forEachChild(visit);
154
+ };
155
+ for (const statement of parseStatements(entryCode))
156
+ visit(statement);
157
+ const names = [...referenced].sort();
158
+ const importLine = names.length > 0 ? `import type { ${names.join(', ')} } from '${specifier}';\n` : '';
159
+ return `${importLine}export * from '${specifier}';`;
160
+ }
161
+ /** The single import from the runtime package — only names the file actually references. */
162
+ function importLine(options, ctx, refs) {
163
+ const values = ['createClient', ...(options.setup ? ['mergeSetup'] : [])];
164
+ const types = [
165
+ ...(options.setup ? ['ClientConfig', 'Middleware'] : []),
166
+ 'OperationDescriptor',
167
+ // Flat sugar signatures reference the per-call option types.
168
+ ...(refs.hasFlatRegular ? ['RequestOptions'] : []),
169
+ // Flat throw-mode sugar return types vary with the inferred request-option type.
170
+ ...(refs.hasFlatRegular && ctx.errorMode !== 'result' ? ['EnvelopeResult'] : []),
171
+ // `Ops` wraps results in `Result` in result mode — but only NON-SSE members
172
+ // (an SSE-only spec would otherwise import it unused and fail noUnusedLocals).
173
+ ...(ctx.errorMode === 'result' && refs.hasRegular ? ['Result'] : []),
174
+ ...(refs.hasFlatSse ? ['SseOptions'] : []),
175
+ // The apiKey sugar closures take a `TokenProvider`.
176
+ ...(refs.hasApiKey ? ['TokenProvider'] : []),
177
+ ].sort();
178
+ const names = [...values, ...types.map((t) => `type ${t}`)].join(', ');
179
+ return `import { ${names} } from '${PACKAGE_SPECIFIER}';`;
180
+ }
181
+ /** One operation's `<Op>*` aliases — the same emitters and suppression rules as inline mode. */
182
+ function aliasStatements(op, ctx) {
183
+ const { pathParams } = operationSignature(op);
184
+ const ordered = pathParams.map((p) => p.param);
185
+ const identMap = new Map(pathParams.map((p) => [p.param.name, p.ident]));
186
+ if (isSseOp(op))
187
+ return sseAliases(op, ordered, identMap, ctx, 'wire');
188
+ const { responseType } = computeResponse(op.successResponses, ctx.dateType);
189
+ const errorMembers = ctx.errorMode === 'result' ? errorTypeNodes(op.errorResponses, ctx.dateType) : [];
190
+ const errorAlias = errorMembers.length > 0 ? `${pascalCase(op.name)}Error` : '';
191
+ return renderOperationAliases(op, responseType, ordered, identMap, errorAlias, errorMembers, ctx, true, 'wire');
192
+ }
193
+ /** The (optional) baked setup + the default `client` instance. */
194
+ function clientSection(options, ctx, model) {
195
+ const serverUrl = options.serverUrl ?? model.serverUrl;
196
+ const fields = [
197
+ // Always baked when the document declares one: the runtime's fallback is a
198
+ // relative URL, which Node's fetch rejects.
199
+ ...(serverUrl !== undefined ? [`serverUrl: ${codeString(serverUrl)}`] : []),
200
+ ...(ctx.errorMode === 'result' ? ['errorMode: "result"'] : []),
201
+ // Client identification for API-owner telemetry; the runtime sends it only
202
+ // outside browsers, and `configure({ clientHeader: false })` disables it.
203
+ 'clientHeader: "redocly-client-generator"',
204
+ ];
205
+ const config = fields.length > 0 ? `{ ${fields.join(', ')} }` : '{}';
206
+ // Precedence, lowest → highest: spec defaults → baked publisher setup → app `configure()`.
207
+ // The inner merge flattens the setup into a ClientConfig; the outer layers it OVER the
208
+ // spec defaults (mergeSetup's second argument wins per-field; middleware composes).
209
+ const configArg = options.setup
210
+ ? `mergeSetup({ config: ${config} }, mergeSetup(__redoclySetup, {}))`
211
+ : config;
212
+ // The trailing type args narrow `ctx.operation` to the spec's literal unions.
213
+ // `OperationTag` mirrors descriptorStatements' gate: derived only when some
214
+ // operation is tagged (it would otherwise be `never`); zero-ops specs have no
215
+ // derived unions at all, so they keep the string defaults.
216
+ const ops = allOperations(model.services);
217
+ const hasTags = ops.some((op) => op.tags.length > 0);
218
+ const typeArgs = ops.length > 0
219
+ ? `<Ops, OperationId, OperationPath, ${hasTags ? 'OperationTag' : 'string'}>`
220
+ : '<Ops>';
221
+ const client = `export const client = createClient${typeArgs}(OPERATIONS, ${configArg});`;
222
+ if (!options.setup)
223
+ return client;
224
+ return ('// ─── Baked-in setup (--setup) ───\n' +
225
+ `const __redoclySetup: { config?: ClientConfig; middleware?: Middleware[] } = ${options.setup};\n` +
226
+ client);
227
+ }
228
+ /** Core destructure + per-scheme auth setters + per-operation call sugar. */
229
+ function sugarStatements(ops, idents, ctx, schemes, apiKeySchemes) {
230
+ const statements = [...parseStatements('export const { configure, use } = client;')];
231
+ // Auth sugar in `authSetterNames` order: bearer, basic, then each apiKey scheme.
232
+ // The runtime's auth members close over the instance config (no `this`), so
233
+ // direct bindings are safe.
234
+ if (schemes.some((s) => s.kind === 'bearer')) {
235
+ statements.push(...parseStatements('export const setBearer = client.auth.bearer;'));
236
+ }
237
+ if (schemes.some((s) => s.kind === 'basic')) {
238
+ statements.push(...parseStatements('export const setBasicAuth = client.auth.basic;'));
239
+ }
240
+ for (const scheme of apiKeySchemes) {
241
+ const name = apiKeySetterName(scheme.key, apiKeySchemes.length === 1);
242
+ statements.push(...parseStatements(`export const ${name} = (value: TokenProvider) => client.auth.apiKey(${codeString(scheme.key)}, value);`));
243
+ }
244
+ if (ops.length === 0)
245
+ return statements;
246
+ if (ctx.argsStyle === 'grouped') {
247
+ // Grouped style: the client methods already take the grouped args shape.
248
+ const names = ops.map((op) => idents.get(op.name)).join(', ');
249
+ statements.push(...parseStatements(`export const { ${names} } = client;`));
250
+ return statements;
251
+ }
252
+ for (const op of ops)
253
+ statements.push(flatSugarStatement(op, idents.get(op.name), ctx));
254
+ return statements;
255
+ }
256
+ /**
257
+ * One flat one-liner: today's positional signature forwarding to the grouped client
258
+ * method. Path values are keyed by the WIRE name (the runtime routes
259
+ * `args[param.name]`); a path param literally named `params`/`body`/`headers` would
260
+ * collide with the slot keys — a spec-acknowledged runtime-contract limitation.
261
+ * A paginated operation's arrow is wrapped in `Object.assign(…, { pages, items })`
262
+ * so the flat sugar preserves the method-attached iterators.
263
+ * Throw-mode (non-SSE) arrows are generic over `init` so `{ envelope: true }` narrows
264
+ * the return type to `Envelope<…>` (plain `RequestOptions` would collapse the overload).
265
+ */
266
+ function flatSugarStatement(op, ident, ctx) {
267
+ const { pathParams } = operationSignature(op);
268
+ const params = renderArgList(op, pathParams.map((p) => p.param), new Map(pathParams.map((p) => [p.param.name, p.ident])), ctx);
269
+ const props = pathParams.map(({ param, ident: paramIdent }) => param.name === paramIdent
270
+ ? factory.createShorthandPropertyAssignment(paramIdent)
271
+ : factory.createPropertyAssignment(isIdentifier(param.name) ? param.name : factory.createStringLiteral(param.name), factory.createIdentifier(paramIdent)));
272
+ if (op.queryParams.length > 0)
273
+ props.push(factory.createShorthandPropertyAssignment('params'));
274
+ if (op.requestBody)
275
+ props.push(factory.createShorthandPropertyAssignment('body'));
276
+ if (op.headerParams.length > 0) {
277
+ props.push(factory.createShorthandPropertyAssignment('headers'));
278
+ }
279
+ if (op.cookieParams.length > 0) {
280
+ props.push(factory.createShorthandPropertyAssignment('cookies'));
281
+ }
282
+ const call = factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier('client'), ident), undefined, [factory.createObjectLiteralExpression(props, false), factory.createIdentifier('init')]);
283
+ const fn = ctx.errorMode !== 'result' && !isSseOp(op)
284
+ ? envelopeAwareFlatArrow(op, params, call, ctx)
285
+ : arrow(params, call);
286
+ if (!ctx.pagination?.has(op.name))
287
+ return exportConstStatement(ident, fn);
288
+ const methodMember = (name) => factory.createPropertyAssignment(name, factory.createPropertyAccessExpression(factory.createPropertyAccessExpression(factory.createIdentifier('client'), ident), name));
289
+ return exportConstStatement(ident, factory.createCallExpression(factory.createPropertyAccessExpression(factory.createIdentifier('Object'), 'assign'), undefined, [
290
+ fn,
291
+ factory.createObjectLiteralExpression([methodMember('pages'), methodMember('items')], false),
292
+ ]));
293
+ }
294
+ /**
295
+ * `<I extends RequestOptions | undefined = undefined>(…, init?: I) =>
296
+ * Promise<EnvelopeResult<Result, Headers, I>>`
297
+ */
298
+ function envelopeAwareFlatArrow(op, params, call, ctx) {
299
+ // `renderArgList` always appends `init` last — retype it as optional generic `I`
300
+ // (no default: `init?: I = {}` is invalid, and `init: I = {}` fails under strict
301
+ // generic checks). Cast the call's Promise so the conditional return type sticks.
302
+ const initTyped = [
303
+ ...params.slice(0, -1),
304
+ factory.createParameterDeclaration(undefined, undefined, 'init', factory.createToken(ts.SyntaxKind.QuestionToken), factory.createTypeReferenceNode('I')),
305
+ ];
306
+ const resultType = flatResultType(op, ctx);
307
+ const headersType = flatHeadersType(op, ctx);
308
+ const returnType = factory.createTypeReferenceNode('Promise', [
309
+ factory.createTypeReferenceNode('EnvelopeResult', [
310
+ resultType,
311
+ headersType,
312
+ factory.createTypeReferenceNode('I'),
313
+ ]),
314
+ ]);
315
+ const typeParam = factory.createTypeParameterDeclaration(undefined, 'I', factory.createUnionTypeNode([
316
+ factory.createTypeReferenceNode('RequestOptions'),
317
+ factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword),
318
+ ]), factory.createKeywordTypeNode(ts.SyntaxKind.UndefinedKeyword));
319
+ const castCall = factory.createAsExpression(call, returnType);
320
+ return typedArrow([typeParam], initTyped, returnType, castCall);
321
+ }
322
+ function flatResultType(op, ctx) {
323
+ const { responseType } = computeResponse(op.successResponses, ctx.dateType);
324
+ const resultName = `${pascalCase(op.name)}Result`;
325
+ return ctx.schemaNames.has(resultName)
326
+ ? responseType
327
+ : factory.createTypeReferenceNode(resultName);
328
+ }
329
+ function flatHeadersType(op, ctx) {
330
+ const headers = op.successResponseHeaders;
331
+ if (!headers || headers.length === 0) {
332
+ return factory.createTypeReferenceNode('Record', [
333
+ factory.createKeywordTypeNode(ts.SyntaxKind.StringKeyword),
334
+ factory.createKeywordTypeNode(ts.SyntaxKind.NeverKeyword),
335
+ ]);
336
+ }
337
+ const alias = `${pascalCase(op.name)}ResponseHeaders`;
338
+ return ctx.schemaNames.has(alias)
339
+ ? responseHeadersTypeLiteral(headers, ctx.schemas)
340
+ : factory.createTypeReferenceNode(alias);
341
+ }
342
+ /** Public type surface re-exported for single-import DX (plus the `ApiError` class). */
343
+ function reexportLines(ctx, hasSse) {
344
+ const types = [
345
+ 'ClientConfig',
346
+ 'Envelope',
347
+ 'Middleware',
348
+ 'RequestOptions',
349
+ ...(ctx.errorMode === 'result' ? ['Result'] : []),
350
+ ...(hasSse ? ['ServerSentEvent', 'SseOptions'] : []),
351
+ ].sort();
352
+ return (
353
+ // `createClient` is re-exported so package-mode consumers can build additional
354
+ // instances from the generated module alone — symmetric with inline output.
355
+ `export { ApiError, createClient, defaultRetryOn, TimeoutError } from '${PACKAGE_SPECIFIER}';\n` +
356
+ `export type { ${types.join(', ')} } from '${PACKAGE_SPECIFIER}';`);
357
+ }
358
+ //# sourceMappingURL=client-assembly.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client-assembly.js","sourceRoot":"","sources":["../../src/emitters/client-assembly.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,uFAAuF;AACvF,+EAA+E;AAC/E,gFAAgF;AAChF,mFAAmF;AACnF,gFAAgF;AAChF,iFAAiF;AACjF,mFAAmF;AACnF,sFAAsF;AACtF,0EAA0E;AAE1E,OAAO,EACL,aAAa,GAId,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC9F,OAAO,EAAE,MAAM,EAAoB,MAAM,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACzF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,EAAE,sBAAsB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAoB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AACnC,OAAO,EAAE,UAAU,E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UAAU,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC;IACtD,OAAO,GAAG,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC;QAC/B,CAAC,CAAC,0BAA0B,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC;QAClD,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC;AAED,wFAAwF;AACxF,SAAS,aAAa,CAAC,GAAgB,EAAE,MAAe;IACtD,MAAM,KAAK,GAAG;QACZ,cAAc;QACd,UAAU;QACV,YAAY;QACZ,gBAAgB;QAChB,GAAG,CAAC,GAAG,CAAC,SAAS,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjD,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KACrD,CAAC,IAAI,EAAE,CAAC;IACT,OAAO;IACL,+EAA+E;IAC/E,4EAA4E;IAC5E,yEAAyE,iBAAiB,MAAM;QAChG,iBAAiB,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,iBAAiB,IAAI,CACnE,CAAC;AACJ,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { type ApiModel } from '../intermediate-representation/model.js';
2
+ import type { EmitContext } from './operations.js';
3
+ import type { ModelPagination } from './pagination.js';
4
+ import { ts } from './ts.js';
5
+ import { type DateType } from './types.js';
6
+ /**
7
+ * Operation-name → emitted-identifier plan. The full reserved set (wiring + imported
8
+ * bindings + auth sugar, computed from the model FIRST) is seeded before any operation
9
+ * is sanitized, so collisions rename the operation (`configure` → `configure_2`)
10
+ * deterministically regardless of document order.
11
+ */
12
+ export declare function packageIdents(model: ApiModel): Map<string, string>;
13
+ /** `export const OPERATIONS = {…} as const satisfies Record<string, OperationDescriptor>;` + unions. */
14
+ export declare function descriptorStatements(model: ApiModel, idents: Map<string, string>, dateType: DateType, pagination?: ModelPagination): ts.Statement[];
15
+ /**
16
+ * `export type Ops = { <ident>: { args: …; result: …; kind?: "sse" } }` — the type map
17
+ * `createClient<Ops>` consumes. A type alias (not an interface) on purpose: aliases get
18
+ * an implicit index signature, so `Ops` satisfies the runtime's `OpsShape` constraint;
19
+ * an interface would need an explicit `[key: string]` member.
20
+ */
21
+ export declare function opsInterfaceStatements(model: ApiModel, idents: Map<string, string>, ctx: EmitContext): ts.Statement[];
22
+ //# sourceMappingURL=descriptor.d.ts.map