@ir-kit/openapi-kotlin 2.0.0 → 2.1.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 (296) hide show
  1. package/README.md +13 -13
  2. package/dist/ast/index.d.ts +168 -0
  3. package/dist/ast/index.d.ts.map +1 -0
  4. package/dist/ast/index.js +194 -0
  5. package/dist/ast/index.js.map +1 -0
  6. package/dist/generate.d.ts.map +1 -1
  7. package/dist/generate.js +7 -7
  8. package/dist/generate.js.map +1 -1
  9. package/dist/index.d.ts +1 -1
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/ir/identifiers.d.ts +7 -0
  14. package/dist/ir/identifiers.d.ts.map +1 -1
  15. package/dist/ir/identifiers.js +92 -3
  16. package/dist/ir/identifiers.js.map +1 -1
  17. package/dist/ir/impl/body.d.ts +4 -3
  18. package/dist/ir/impl/body.d.ts.map +1 -1
  19. package/dist/ir/impl/body.js +11 -8
  20. package/dist/ir/impl/body.js.map +1 -1
  21. package/dist/ir/impl/decode.d.ts +3 -2
  22. package/dist/ir/impl/decode.d.ts.map +1 -1
  23. package/dist/ir/impl/decode.js +16 -16
  24. package/dist/ir/impl/decode.js.map +1 -1
  25. package/dist/ir/impl/headers.d.ts +1 -1
  26. package/dist/ir/impl/headers.d.ts.map +1 -1
  27. package/dist/ir/impl/headers.js +3 -3
  28. package/dist/ir/impl/headers.js.map +1 -1
  29. package/dist/ir/impl/index.d.ts +5 -2
  30. package/dist/ir/impl/index.d.ts.map +1 -1
  31. package/dist/ir/impl/index.js +6 -7
  32. package/dist/ir/impl/index.js.map +1 -1
  33. package/dist/ir/impl/request.d.ts +6 -6
  34. package/dist/ir/impl/request.d.ts.map +1 -1
  35. package/dist/ir/impl/request.js +18 -8
  36. package/dist/ir/impl/request.js.map +1 -1
  37. package/dist/ir/impl/serializer.d.ts +4 -2
  38. package/dist/ir/impl/serializer.d.ts.map +1 -1
  39. package/dist/ir/impl/serializer.js +41 -60
  40. package/dist/ir/impl/serializer.js.map +1 -1
  41. package/dist/ir/impl/url.d.ts +1 -1
  42. package/dist/ir/impl/url.d.ts.map +1 -1
  43. package/dist/ir/impl/url.js +4 -4
  44. package/dist/ir/impl/url.js.map +1 -1
  45. package/dist/ir/index.d.ts +1 -1
  46. package/dist/ir/index.d.ts.map +1 -1
  47. package/dist/ir/index.js +1 -1
  48. package/dist/ir/index.js.map +1 -1
  49. package/dist/ir/operation/body.d.ts +1 -1
  50. package/dist/ir/operation/body.d.ts.map +1 -1
  51. package/dist/ir/operation/body.js +3 -3
  52. package/dist/ir/operation/body.js.map +1 -1
  53. package/dist/ir/operation/params.d.ts +1 -1
  54. package/dist/ir/operation/params.d.ts.map +1 -1
  55. package/dist/ir/operation/params.js +3 -3
  56. package/dist/ir/operation/params.js.map +1 -1
  57. package/dist/ir/operation/response.d.ts +3 -1
  58. package/dist/ir/operation/response.d.ts.map +1 -1
  59. package/dist/ir/operation/response.js +3 -4
  60. package/dist/ir/operation/response.js.map +1 -1
  61. package/dist/ir/operation/signature.d.ts +4 -2
  62. package/dist/ir/operation/signature.d.ts.map +1 -1
  63. package/dist/ir/operation/signature.js +5 -4
  64. package/dist/ir/operation/signature.js.map +1 -1
  65. package/dist/ir/operations.d.ts +7 -1
  66. package/dist/ir/operations.d.ts.map +1 -1
  67. package/dist/ir/operations.js +13 -7
  68. package/dist/ir/operations.js.map +1 -1
  69. package/dist/ir/runtime/index.d.ts +1 -1
  70. package/dist/ir/runtime/index.d.ts.map +1 -1
  71. package/dist/ir/runtime/index.js +1 -1
  72. package/dist/ir/runtime/index.js.map +1 -1
  73. package/dist/ir/runtime/templates.d.ts +1 -21
  74. package/dist/ir/runtime/templates.d.ts.map +1 -1
  75. package/dist/ir/runtime/templates.js +24 -428
  76. package/dist/ir/runtime/templates.js.map +1 -1
  77. package/dist/ir/schema.d.ts +3 -2
  78. package/dist/ir/schema.d.ts.map +1 -1
  79. package/dist/ir/schema.js +24 -11
  80. package/dist/ir/schema.js.map +1 -1
  81. package/dist/ir/type/context.d.ts +1 -1
  82. package/dist/ir/type/context.d.ts.map +1 -1
  83. package/dist/ir/type/index.d.ts +5 -3
  84. package/dist/ir/type/index.d.ts.map +1 -1
  85. package/dist/ir/type/index.js +12 -8
  86. package/dist/ir/type/index.js.map +1 -1
  87. package/dist/ir/type/primitive.d.ts +1 -1
  88. package/dist/ir/type/primitive.d.ts.map +1 -1
  89. package/dist/ir/type/primitive.js +1 -1
  90. package/dist/ir/type/primitive.js.map +1 -1
  91. package/dist/ir/type-ops.d.ts +2 -2
  92. package/dist/ir/type-ops.d.ts.map +1 -1
  93. package/dist/ir/type-ops.js +13 -17
  94. package/dist/ir/type-ops.js.map +1 -1
  95. package/dist/kt-compiler/index.d.ts +3 -6
  96. package/dist/kt-compiler/index.d.ts.map +1 -1
  97. package/dist/kt-compiler/index.js +7 -22
  98. package/dist/kt-compiler/index.js.map +1 -1
  99. package/dist/project/build.d.ts +1 -1
  100. package/dist/project/build.d.ts.map +1 -1
  101. package/dist/project/build.js +6 -8
  102. package/dist/project/build.js.map +1 -1
  103. package/dist/project/imports.d.ts +12 -12
  104. package/dist/project/imports.d.ts.map +1 -1
  105. package/dist/project/imports.js +60 -138
  106. package/dist/project/imports.js.map +1 -1
  107. package/dist/project/layout.d.ts +1 -1
  108. package/dist/project/layout.d.ts.map +1 -1
  109. package/dist/project/layout.js +1 -3
  110. package/dist/project/layout.js.map +1 -1
  111. package/package.json +11 -9
  112. package/runtime/APIClient.kt +140 -0
  113. package/runtime/APIError.kt +42 -0
  114. package/runtime/APIInterceptors.kt +14 -0
  115. package/runtime/APIKeyLocation.kt +7 -0
  116. package/runtime/Auth.kt +86 -0
  117. package/runtime/MultipartFormBody.kt +41 -0
  118. package/runtime/QueryStyle.kt +12 -0
  119. package/runtime/RequestOptions.kt +29 -0
  120. package/runtime/URLEncoding.kt +45 -0
  121. package/dist/kt-compiler/decl/class.d.ts +0 -6
  122. package/dist/kt-compiler/decl/class.d.ts.map +0 -1
  123. package/dist/kt-compiler/decl/class.js +0 -38
  124. package/dist/kt-compiler/decl/class.js.map +0 -1
  125. package/dist/kt-compiler/decl/dataClass.d.ts +0 -3
  126. package/dist/kt-compiler/decl/dataClass.d.ts.map +0 -1
  127. package/dist/kt-compiler/decl/dataClass.js +0 -18
  128. package/dist/kt-compiler/decl/dataClass.js.map +0 -1
  129. package/dist/kt-compiler/decl/enum.d.ts +0 -3
  130. package/dist/kt-compiler/decl/enum.d.ts.map +0 -1
  131. package/dist/kt-compiler/decl/enum.js +0 -32
  132. package/dist/kt-compiler/decl/enum.js.map +0 -1
  133. package/dist/kt-compiler/decl/fun.d.ts +0 -11
  134. package/dist/kt-compiler/decl/fun.d.ts.map +0 -1
  135. package/dist/kt-compiler/decl/fun.js +0 -69
  136. package/dist/kt-compiler/decl/fun.js.map +0 -1
  137. package/dist/kt-compiler/decl/index.d.ts +0 -13
  138. package/dist/kt-compiler/decl/index.d.ts.map +0 -1
  139. package/dist/kt-compiler/decl/index.js +0 -39
  140. package/dist/kt-compiler/decl/index.js.map +0 -1
  141. package/dist/kt-compiler/decl/interface.d.ts +0 -3
  142. package/dist/kt-compiler/decl/interface.d.ts.map +0 -1
  143. package/dist/kt-compiler/decl/interface.js +0 -15
  144. package/dist/kt-compiler/decl/interface.js.map +0 -1
  145. package/dist/kt-compiler/decl/object.d.ts +0 -3
  146. package/dist/kt-compiler/decl/object.d.ts.map +0 -1
  147. package/dist/kt-compiler/decl/object.js +0 -19
  148. package/dist/kt-compiler/decl/object.js.map +0 -1
  149. package/dist/kt-compiler/decl/prop.d.ts +0 -20
  150. package/dist/kt-compiler/decl/prop.d.ts.map +0 -1
  151. package/dist/kt-compiler/decl/prop.js +0 -42
  152. package/dist/kt-compiler/decl/prop.js.map +0 -1
  153. package/dist/kt-compiler/decl/sealedClass.d.ts +0 -3
  154. package/dist/kt-compiler/decl/sealedClass.d.ts.map +0 -1
  155. package/dist/kt-compiler/decl/sealedClass.js +0 -32
  156. package/dist/kt-compiler/decl/sealedClass.js.map +0 -1
  157. package/dist/kt-compiler/decl/topLevel.d.ts +0 -3
  158. package/dist/kt-compiler/decl/topLevel.d.ts.map +0 -1
  159. package/dist/kt-compiler/decl/topLevel.js +0 -5
  160. package/dist/kt-compiler/decl/topLevel.js.map +0 -1
  161. package/dist/kt-compiler/decl/typeAlias.d.ts +0 -3
  162. package/dist/kt-compiler/decl/typeAlias.d.ts.map +0 -1
  163. package/dist/kt-compiler/decl/typeAlias.js +0 -6
  164. package/dist/kt-compiler/decl/typeAlias.js.map +0 -1
  165. package/dist/kt-compiler/expr.d.ts +0 -4
  166. package/dist/kt-compiler/expr.d.ts.map +0 -1
  167. package/dist/kt-compiler/expr.js +0 -123
  168. package/dist/kt-compiler/expr.js.map +0 -1
  169. package/dist/kt-compiler/format.d.ts +0 -20
  170. package/dist/kt-compiler/format.d.ts.map +0 -1
  171. package/dist/kt-compiler/format.js +0 -27
  172. package/dist/kt-compiler/format.js.map +0 -1
  173. package/dist/kt-compiler/stmt.d.ts +0 -4
  174. package/dist/kt-compiler/stmt.d.ts.map +0 -1
  175. package/dist/kt-compiler/stmt.js +0 -72
  176. package/dist/kt-compiler/stmt.js.map +0 -1
  177. package/dist/kt-compiler/type.d.ts +0 -3
  178. package/dist/kt-compiler/type.d.ts.map +0 -1
  179. package/dist/kt-compiler/type.js +0 -28
  180. package/dist/kt-compiler/type.js.map +0 -1
  181. package/dist/kt-dsl/decl/class.d.ts +0 -50
  182. package/dist/kt-dsl/decl/class.d.ts.map +0 -1
  183. package/dist/kt-dsl/decl/class.js +0 -33
  184. package/dist/kt-dsl/decl/class.js.map +0 -1
  185. package/dist/kt-dsl/decl/dataClass.d.ts +0 -36
  186. package/dist/kt-dsl/decl/dataClass.d.ts.map +0 -1
  187. package/dist/kt-dsl/decl/dataClass.js +0 -25
  188. package/dist/kt-dsl/decl/dataClass.js.map +0 -1
  189. package/dist/kt-dsl/decl/enum.d.ts +0 -60
  190. package/dist/kt-dsl/decl/enum.d.ts.map +0 -1
  191. package/dist/kt-dsl/decl/enum.js +0 -38
  192. package/dist/kt-dsl/decl/enum.js.map +0 -1
  193. package/dist/kt-dsl/decl/index.d.ts +0 -11
  194. package/dist/kt-dsl/decl/index.d.ts.map +0 -1
  195. package/dist/kt-dsl/decl/index.js +0 -11
  196. package/dist/kt-dsl/decl/index.js.map +0 -1
  197. package/dist/kt-dsl/decl/interface.d.ts +0 -33
  198. package/dist/kt-dsl/decl/interface.d.ts.map +0 -1
  199. package/dist/kt-dsl/decl/interface.js +0 -24
  200. package/dist/kt-dsl/decl/interface.js.map +0 -1
  201. package/dist/kt-dsl/decl/object.d.ts +0 -34
  202. package/dist/kt-dsl/decl/object.d.ts.map +0 -1
  203. package/dist/kt-dsl/decl/object.js +0 -24
  204. package/dist/kt-dsl/decl/object.js.map +0 -1
  205. package/dist/kt-dsl/decl/prop.d.ts +0 -47
  206. package/dist/kt-dsl/decl/prop.d.ts.map +0 -1
  207. package/dist/kt-dsl/decl/prop.js +0 -28
  208. package/dist/kt-dsl/decl/prop.js.map +0 -1
  209. package/dist/kt-dsl/decl/sealedClass.d.ts +0 -68
  210. package/dist/kt-dsl/decl/sealedClass.d.ts.map +0 -1
  211. package/dist/kt-dsl/decl/sealedClass.js +0 -52
  212. package/dist/kt-dsl/decl/sealedClass.js.map +0 -1
  213. package/dist/kt-dsl/decl/topLevel.d.ts +0 -19
  214. package/dist/kt-dsl/decl/topLevel.d.ts.map +0 -1
  215. package/dist/kt-dsl/decl/topLevel.js +0 -17
  216. package/dist/kt-dsl/decl/topLevel.js.map +0 -1
  217. package/dist/kt-dsl/decl/typeAlias.d.ts +0 -23
  218. package/dist/kt-dsl/decl/typeAlias.d.ts.map +0 -1
  219. package/dist/kt-dsl/decl/typeAlias.js +0 -18
  220. package/dist/kt-dsl/decl/typeAlias.js.map +0 -1
  221. package/dist/kt-dsl/decl/types.d.ts +0 -10
  222. package/dist/kt-dsl/decl/types.d.ts.map +0 -1
  223. package/dist/kt-dsl/decl/types.js +0 -2
  224. package/dist/kt-dsl/decl/types.js.map +0 -1
  225. package/dist/kt-dsl/expr/access.d.ts +0 -48
  226. package/dist/kt-dsl/expr/access.d.ts.map +0 -1
  227. package/dist/kt-dsl/expr/access.js +0 -59
  228. package/dist/kt-dsl/expr/access.js.map +0 -1
  229. package/dist/kt-dsl/expr/call.d.ts +0 -38
  230. package/dist/kt-dsl/expr/call.d.ts.map +0 -1
  231. package/dist/kt-dsl/expr/call.js +0 -38
  232. package/dist/kt-dsl/expr/call.js.map +0 -1
  233. package/dist/kt-dsl/expr/index.d.ts +0 -7
  234. package/dist/kt-dsl/expr/index.d.ts.map +0 -1
  235. package/dist/kt-dsl/expr/index.js +0 -7
  236. package/dist/kt-dsl/expr/index.js.map +0 -1
  237. package/dist/kt-dsl/expr/literal.d.ts +0 -100
  238. package/dist/kt-dsl/expr/literal.d.ts.map +0 -1
  239. package/dist/kt-dsl/expr/literal.js +0 -108
  240. package/dist/kt-dsl/expr/literal.js.map +0 -1
  241. package/dist/kt-dsl/expr/misc.d.ts +0 -45
  242. package/dist/kt-dsl/expr/misc.d.ts.map +0 -1
  243. package/dist/kt-dsl/expr/misc.js +0 -63
  244. package/dist/kt-dsl/expr/misc.js.map +0 -1
  245. package/dist/kt-dsl/expr/op.d.ts +0 -25
  246. package/dist/kt-dsl/expr/op.d.ts.map +0 -1
  247. package/dist/kt-dsl/expr/op.js +0 -24
  248. package/dist/kt-dsl/expr/op.js.map +0 -1
  249. package/dist/kt-dsl/expr/types.d.ts +0 -93
  250. package/dist/kt-dsl/expr/types.d.ts.map +0 -1
  251. package/dist/kt-dsl/expr/types.js +0 -2
  252. package/dist/kt-dsl/expr/types.js.map +0 -1
  253. package/dist/kt-dsl/file.d.ts +0 -14
  254. package/dist/kt-dsl/file.d.ts.map +0 -1
  255. package/dist/kt-dsl/file.js +0 -9
  256. package/dist/kt-dsl/file.js.map +0 -1
  257. package/dist/kt-dsl/fun.d.ts +0 -73
  258. package/dist/kt-dsl/fun.d.ts.map +0 -1
  259. package/dist/kt-dsl/fun.js +0 -50
  260. package/dist/kt-dsl/fun.js.map +0 -1
  261. package/dist/kt-dsl/index.d.ts +0 -8
  262. package/dist/kt-dsl/index.d.ts.map +0 -1
  263. package/dist/kt-dsl/index.js +0 -8
  264. package/dist/kt-dsl/index.js.map +0 -1
  265. package/dist/kt-dsl/stmt/binding.d.ts +0 -56
  266. package/dist/kt-dsl/stmt/binding.d.ts.map +0 -1
  267. package/dist/kt-dsl/stmt/binding.js +0 -70
  268. package/dist/kt-dsl/stmt/binding.js.map +0 -1
  269. package/dist/kt-dsl/stmt/control.d.ts +0 -80
  270. package/dist/kt-dsl/stmt/control.d.ts.map +0 -1
  271. package/dist/kt-dsl/stmt/control.js +0 -77
  272. package/dist/kt-dsl/stmt/control.js.map +0 -1
  273. package/dist/kt-dsl/stmt/index.d.ts +0 -4
  274. package/dist/kt-dsl/stmt/index.d.ts.map +0 -1
  275. package/dist/kt-dsl/stmt/index.js +0 -4
  276. package/dist/kt-dsl/stmt/index.js.map +0 -1
  277. package/dist/kt-dsl/stmt/types.d.ts +0 -62
  278. package/dist/kt-dsl/stmt/types.d.ts.map +0 -1
  279. package/dist/kt-dsl/stmt/types.js +0 -2
  280. package/dist/kt-dsl/stmt/types.js.map +0 -1
  281. package/dist/kt-dsl/type/builders.d.ts +0 -75
  282. package/dist/kt-dsl/type/builders.d.ts.map +0 -1
  283. package/dist/kt-dsl/type/builders.js +0 -83
  284. package/dist/kt-dsl/type/builders.js.map +0 -1
  285. package/dist/kt-dsl/type/index.d.ts +0 -3
  286. package/dist/kt-dsl/type/index.d.ts.map +0 -1
  287. package/dist/kt-dsl/type/index.js +0 -3
  288. package/dist/kt-dsl/type/index.js.map +0 -1
  289. package/dist/kt-dsl/type/types.d.ts +0 -25
  290. package/dist/kt-dsl/type/types.d.ts.map +0 -1
  291. package/dist/kt-dsl/type/types.js +0 -2
  292. package/dist/kt-dsl/type/types.js.map +0 -1
  293. package/dist/kt-dsl/visibility.d.ts +0 -2
  294. package/dist/kt-dsl/visibility.d.ts.map +0 -1
  295. package/dist/kt-dsl/visibility.js +0 -2
  296. package/dist/kt-dsl/visibility.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"layout.js","sourceRoot":"","sources":["../../src/project/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,WAAW,CAAC;AAsB/C,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,IAAsB;IAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;IAClE,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,OAAO,CAAC;IACtC,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;IACjD,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAC3D,CAAC;AAED;;;;GAIG;AACH,SAAS,eAAe,CAAC,GAAW;IAClC,MAAM,UAAU,GAAG,SAAS,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC;IACnD,IACE,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC;QAChC,UAAU,KAAK,IAAI;QACnB,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,EAC5B,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,2CAA2C,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,IAAI,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,IAAI,KAAK,aAAa,EAAE,CAAC;QAChC,OAAO,GAAG,IAAI,CAAC,QAAQ,IAAI,YAAY,eAAe,CAAC;IACzD,CAAC;IACD,OAAO,GAAG,IAAI,CAAC,IAAI,KAAK,CAAC;AAC3B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ir-kit/openapi-kotlin",
3
- "version": "2.0.0",
3
+ "version": "2.1.0",
4
4
  "description": "Generate idiomatic Kotlin (OkHttp + kotlinx-serialization + suspend) client SDKs from an OpenAPI 3.x spec.",
5
5
  "keywords": [
6
6
  "openapi",
@@ -12,9 +12,9 @@
12
12
  "sdk",
13
13
  "client"
14
14
  ],
15
- "homepage": "https://github.com/ir-kit/ir-kit/tree/main/packages/openapi/kotlin",
15
+ "homepage": "https://github.com/ahmedrowaihi/ir-kit/tree/main/packages/openapi/kotlin",
16
16
  "bugs": {
17
- "url": "https://github.com/ir-kit/ir-kit/issues"
17
+ "url": "https://github.com/ahmedrowaihi/ir-kit/issues"
18
18
  },
19
19
  "license": "MIT",
20
20
  "author": {
@@ -23,7 +23,7 @@
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
26
- "url": "git+https://github.com/ir-kit/ir-kit.git",
26
+ "url": "git+https://github.com/ahmedrowaihi/ir-kit.git",
27
27
  "directory": "packages/openapi/kotlin"
28
28
  },
29
29
  "type": "module",
@@ -39,6 +39,7 @@
39
39
  },
40
40
  "files": [
41
41
  "dist",
42
+ "runtime/*.kt",
42
43
  "README.md",
43
44
  "LICENSE.md"
44
45
  ],
@@ -49,19 +50,20 @@
49
50
  "peerDependencies": {
50
51
  "@hey-api/shared": ">=0.3.0",
51
52
  "@hey-api/spec-types": ">=0.2.0",
52
- "@ir-kit/openapi-tools": ">=0.3.0"
53
+ "@ir-kit/openapi-tools": ">=0.3.1"
53
54
  },
54
55
  "dependencies": {
55
- "@ir-kit/codegen-core": "0.1.0",
56
- "@ir-kit/openapi": "0.3.0",
57
- "@ir-kit/openapi-loader": "0.2.0"
56
+ "@ir-kit/codegen-core": "0.2.0",
57
+ "@ir-kit/compiler-kotlin": "0.1.0",
58
+ "@ir-kit/openapi": "0.4.0",
59
+ "@ir-kit/openapi-loader": "0.3.0"
58
60
  },
59
61
  "devDependencies": {
60
62
  "@hey-api/shared": "^0.4.2",
61
63
  "@hey-api/spec-types": "^0.2.0",
62
64
  "@types/node": "^22",
63
65
  "vitest": "^4.0.0",
64
- "@ir-kit/openapi-tools": "0.3.0",
66
+ "@ir-kit/openapi-tools": "0.3.1",
65
67
  "@ir-kit/tsconfig": "0.0.0"
66
68
  },
67
69
  "engines": {
@@ -0,0 +1,140 @@
1
+ package dev.irkit.runtime
2
+
3
+ import kotlinx.coroutines.Dispatchers
4
+ import kotlinx.coroutines.withContext
5
+ import kotlinx.serialization.json.Json
6
+ import okhttp3.HttpUrl
7
+ import okhttp3.OkHttpClient
8
+ import okhttp3.Request
9
+ import okhttp3.Response
10
+ import java.util.concurrent.TimeUnit
11
+
12
+ /**
13
+ * Runtime helper every per-tag impl class delegates to. Owns the
14
+ * transport-level concerns — `OkHttpClient`, `Json`, the interceptor
15
+ * pipeline — and provides one source of truth for status-code
16
+ * dispatch and decoding.
17
+ *
18
+ * - `execute<T>(request, deserializer, …)` — decodes a 2xx body to `T`.
19
+ * - `executeUnit(request, …)` — discards the body.
20
+ * - `executeWithResponse<T>(request, deserializer,`
21
+ * `…)` — decode + raw `Response`.
22
+ * - `executeUnitWithResponse(request, …)` — raw `Response` only.
23
+ * - `executeRaw(request, …)` — raw `(ByteArray, Response)`,
24
+ * used by multi-2xx ops.
25
+ *
26
+ * Status-code dispatch lives in `sendAndDispatch`; 2xx returns the
27
+ * body bytes, 4xx/5xx throw the matching `APIError` subclass.
28
+ */
29
+ public class APIClient(
30
+ public var baseUrl: HttpUrl,
31
+ public val httpClient: OkHttpClient = OkHttpClient(),
32
+ public val json: Json =
33
+ Json {
34
+ ignoreUnknownKeys = true
35
+ encodeDefaults = true
36
+ },
37
+ public val interceptors: APIInterceptors = APIInterceptors(),
38
+ public val auth: MutableMap<String, Auth> = mutableMapOf(),
39
+ ) {
40
+ public suspend fun <T> execute(
41
+ request: Request,
42
+ deserializer: kotlinx.serialization.DeserializationStrategy<T>,
43
+ timeout: Long? = null,
44
+ extraInterceptors: List<suspend (Request) -> Request> = emptyList(),
45
+ responseValidator: (suspend (ByteArray, Response) -> Unit)? = null,
46
+ responseTransformer: (suspend (ByteArray) -> ByteArray)? = null,
47
+ ): T {
48
+ val (data, response) = sendAndDispatch(request, timeout, extraInterceptors)
49
+ responseValidator?.invoke(data, response)
50
+ val body = responseTransformer?.invoke(data) ?: data
51
+ return try {
52
+ json.decodeFromString(deserializer, body.decodeToString())
53
+ } catch (e: Throwable) {
54
+ throw APIError.DecodingFailed(e)
55
+ }
56
+ }
57
+
58
+ public suspend fun executeUnit(
59
+ request: Request,
60
+ timeout: Long? = null,
61
+ extraInterceptors: List<suspend (Request) -> Request> = emptyList(),
62
+ responseValidator: (suspend (ByteArray, Response) -> Unit)? = null,
63
+ ) {
64
+ val (data, response) = sendAndDispatch(request, timeout, extraInterceptors)
65
+ responseValidator?.invoke(data, response)
66
+ }
67
+
68
+ public suspend fun <T> executeWithResponse(
69
+ request: Request,
70
+ deserializer: kotlinx.serialization.DeserializationStrategy<T>,
71
+ timeout: Long? = null,
72
+ extraInterceptors: List<suspend (Request) -> Request> = emptyList(),
73
+ responseValidator: (suspend (ByteArray, Response) -> Unit)? = null,
74
+ responseTransformer: (suspend (ByteArray) -> ByteArray)? = null,
75
+ ): Pair<T, Response> {
76
+ val (data, response) = sendAndDispatch(request, timeout, extraInterceptors)
77
+ responseValidator?.invoke(data, response)
78
+ val body = responseTransformer?.invoke(data) ?: data
79
+ return try {
80
+ json.decodeFromString(deserializer, body.decodeToString()) to response
81
+ } catch (e: Throwable) {
82
+ throw APIError.DecodingFailed(e)
83
+ }
84
+ }
85
+
86
+ public suspend fun executeUnitWithResponse(
87
+ request: Request,
88
+ timeout: Long? = null,
89
+ extraInterceptors: List<suspend (Request) -> Request> = emptyList(),
90
+ responseValidator: (suspend (ByteArray, Response) -> Unit)? = null,
91
+ ): Response {
92
+ val (data, response) = sendAndDispatch(request, timeout, extraInterceptors)
93
+ responseValidator?.invoke(data, response)
94
+ return response
95
+ }
96
+
97
+ public suspend fun executeRaw(
98
+ request: Request,
99
+ timeout: Long? = null,
100
+ extraInterceptors: List<suspend (Request) -> Request> = emptyList(),
101
+ responseValidator: (suspend (ByteArray, Response) -> Unit)? = null,
102
+ responseTransformer: (suspend (ByteArray) -> ByteArray)? = null,
103
+ ): Pair<ByteArray, Response> {
104
+ val (data, response) = sendAndDispatch(request, timeout, extraInterceptors)
105
+ responseValidator?.invoke(data, response)
106
+ val body = responseTransformer?.invoke(data) ?: data
107
+ return body to response
108
+ }
109
+
110
+ private suspend fun sendAndDispatch(
111
+ request: Request,
112
+ timeout: Long?,
113
+ extraInterceptors: List<suspend (Request) -> Request>,
114
+ ): Pair<ByteArray, Response> {
115
+ var req = request
116
+ for (interceptor in interceptors.request) req = interceptor(req)
117
+ for (interceptor in extraInterceptors) req = interceptor(req)
118
+ val callClient =
119
+ if (timeout == null) {
120
+ httpClient
121
+ } else {
122
+ httpClient.newBuilder().callTimeout(timeout, TimeUnit.MILLISECONDS).build()
123
+ }
124
+ val response =
125
+ try {
126
+ withContext(Dispatchers.IO) {
127
+ callClient.newCall(req).execute()
128
+ }
129
+ } catch (e: Throwable) {
130
+ throw APIError.Transport(e)
131
+ }
132
+ val body = response.body?.bytes() ?: ByteArray(0)
133
+ return when (val code = response.code) {
134
+ in 200..299 -> body to response
135
+ in 400..499 -> throw APIError.ClientError(code, body)
136
+ in 500..599 -> throw APIError.ServerError(code, body)
137
+ else -> throw APIError.UnexpectedStatus(code, body)
138
+ }
139
+ }
140
+ }
@@ -0,0 +1,42 @@
1
+ package dev.irkit.runtime
2
+
3
+ /**
4
+ * The typed error every impl method throws on non-2xx responses.
5
+ *
6
+ * - `ClientError(statusCode, body)` — 4XX
7
+ * - `ServerError(statusCode, body)` — 5XX
8
+ * - `UnexpectedStatus(statusCode, body)` — 1XX/3XX/anything outside 2-5
9
+ * - `DecodingFailed(cause)` — kotlinx-serialization threw on a 2XX body
10
+ * - `Transport(cause)` — OkHttp / network-layer failure
11
+ *
12
+ * Consumers `catch` and pattern-match. Bodies are surfaced as raw
13
+ * `ByteArray` so callers can decode error envelopes themselves with the
14
+ * codec they prefer.
15
+ */
16
+ public sealed class APIError(
17
+ message: String? = null,
18
+ cause: Throwable? = null,
19
+ ) : RuntimeException(message, cause) {
20
+ public class ClientError(
21
+ public val statusCode: Int,
22
+ public val body: ByteArray,
23
+ ) : APIError("Client error: $statusCode")
24
+
25
+ public class ServerError(
26
+ public val statusCode: Int,
27
+ public val body: ByteArray,
28
+ ) : APIError("Server error: $statusCode")
29
+
30
+ public class UnexpectedStatus(
31
+ public val statusCode: Int,
32
+ public val body: ByteArray,
33
+ ) : APIError("Unexpected status: $statusCode")
34
+
35
+ public class DecodingFailed(
36
+ cause: Throwable,
37
+ ) : APIError("Decoding failed: ${cause.message}", cause)
38
+
39
+ public class Transport(
40
+ cause: Throwable,
41
+ ) : APIError("Transport failure: ${cause.message}", cause)
42
+ }
@@ -0,0 +1,14 @@
1
+ package dev.irkit.runtime
2
+
3
+ import okhttp3.Request
4
+
5
+ /**
6
+ * Bag of per-request mutation hooks. Mirrors hey-api's TS client where
7
+ * `client.interceptors.request.use(fn)` registers an interceptor that
8
+ * runs against every outgoing request. Multiple interceptors compose —
9
+ * auth, logging, and tracing all coexist as separate entries instead
10
+ * of being chained inside one closure.
11
+ */
12
+ public class APIInterceptors {
13
+ public val request: MutableList<suspend (Request) -> Request> = mutableListOf()
14
+ }
@@ -0,0 +1,7 @@
1
+ package dev.irkit.runtime
2
+
3
+ public enum class APIKeyLocation {
4
+ HEADER,
5
+ QUERY,
6
+ COOKIE,
7
+ }
@@ -0,0 +1,86 @@
1
+ package dev.irkit.runtime
2
+
3
+ import okhttp3.HttpUrl
4
+ import okhttp3.Request
5
+ import java.util.Base64
6
+
7
+ /**
8
+ * Auth schemes consumers reach for in practice:
9
+ *
10
+ * - `Bearer(token)` — `Authorization: Bearer <token>`.
11
+ * - `ApiKey(name, value, in)` — header / query / cookie placement,
12
+ * matching the spec's
13
+ * `securitySchemes.<name>.in`.
14
+ * - `Basic(username, password)` — `Authorization: Basic <base64>`.
15
+ *
16
+ * Per-operation auth is auto-wired by the generator when an op has
17
+ * `security` requirements; it walks the requirement names and applies
18
+ * any matching scheme value the consumer has placed on `APIClient.auth`.
19
+ *
20
+ * `apply` mutates the request builder in-place for header / cookie
21
+ * auth and returns the (possibly rewritten) `HttpUrl` so query auth
22
+ * can re-thread its name=value into the URL.
23
+ */
24
+ public sealed class Auth {
25
+ public abstract fun apply(
26
+ builder: Request.Builder,
27
+ url: HttpUrl,
28
+ ): HttpUrl
29
+
30
+ public data class Bearer(
31
+ public val token: String,
32
+ ) : Auth() {
33
+ override fun apply(
34
+ builder: Request.Builder,
35
+ url: HttpUrl,
36
+ ): HttpUrl {
37
+ builder.header("Authorization", "Bearer $token")
38
+ return url
39
+ }
40
+ }
41
+
42
+ public data class ApiKey(
43
+ public val name: String,
44
+ public val value: String,
45
+ public val location: APIKeyLocation,
46
+ ) : Auth() {
47
+ override fun apply(
48
+ builder: Request.Builder,
49
+ url: HttpUrl,
50
+ ): HttpUrl =
51
+ when (location) {
52
+ APIKeyLocation.HEADER -> {
53
+ builder.header(name, value)
54
+ url
55
+ }
56
+
57
+ APIKeyLocation.QUERY -> {
58
+ url.newBuilder().addQueryParameter(name, value).build()
59
+ }
60
+
61
+ APIKeyLocation.COOKIE -> {
62
+ val cookie = "$name=$value"
63
+ val existing = builder.build().header("Cookie")
64
+ builder.header("Cookie", existing?.let { "$it; $cookie" } ?: cookie)
65
+ url
66
+ }
67
+ }
68
+ }
69
+
70
+ public data class Basic(
71
+ public val username: String,
72
+ public val password: String,
73
+ ) : Auth() {
74
+ override fun apply(
75
+ builder: Request.Builder,
76
+ url: HttpUrl,
77
+ ): HttpUrl {
78
+ val encoded =
79
+ Base64
80
+ .getEncoder()
81
+ .encodeToString("$username:$password".toByteArray(Charsets.UTF_8))
82
+ builder.header("Authorization", "Basic $encoded")
83
+ return url
84
+ }
85
+ }
86
+ }
@@ -0,0 +1,41 @@
1
+ package dev.irkit.runtime
2
+
3
+ import okhttp3.MediaType.Companion.toMediaTypeOrNull
4
+ import okhttp3.MultipartBody
5
+ import okhttp3.RequestBody
6
+ import okhttp3.RequestBody.Companion.toRequestBody
7
+
8
+ /**
9
+ * Thin wrapper over OkHttp's `MultipartBody.Builder` — keeps the impl
10
+ * code symmetric with the JSON / form-urlencoded paths.
11
+ *
12
+ * - `appendText(name, value)` — text part.
13
+ * - `appendFile(name, filename, bytes,`
14
+ * `mimeType)` — binary part.
15
+ * - `build()` — finalizes and returns a
16
+ * `RequestBody` ready to pass
17
+ * into `.method("POST", body)`.
18
+ */
19
+ public class MultipartFormBody {
20
+ private val builder: MultipartBody.Builder =
21
+ MultipartBody.Builder().setType(MultipartBody.FORM)
22
+
23
+ public fun appendText(
24
+ name: String,
25
+ value: String,
26
+ ) {
27
+ builder.addFormDataPart(name, value)
28
+ }
29
+
30
+ public fun appendFile(
31
+ name: String,
32
+ filename: String,
33
+ bytes: ByteArray,
34
+ mimeType: String = "application/octet-stream",
35
+ ) {
36
+ val body: RequestBody = bytes.toRequestBody(mimeType.toMediaTypeOrNull())
37
+ builder.addFormDataPart(name, filename, body)
38
+ }
39
+
40
+ public fun build(): RequestBody = builder.build()
41
+ }
@@ -0,0 +1,12 @@
1
+ package dev.irkit.runtime
2
+
3
+ /**
4
+ * Query-array serialization style — matches the OpenAPI 3 `style` field
5
+ * for query parameters whose value is an array. The default is `form`
6
+ * with explode=true; the others appear when the spec opts into them.
7
+ */
8
+ public enum class QueryStyle {
9
+ FORM,
10
+ SPACE_DELIMITED,
11
+ PIPE_DELIMITED,
12
+ }
@@ -0,0 +1,29 @@
1
+ package dev.irkit.runtime
2
+
3
+ import okhttp3.HttpUrl
4
+ import okhttp3.Request
5
+ import okhttp3.Response
6
+
7
+ /**
8
+ * Per-call options bag — every generated method takes a
9
+ * `RequestOptions` last param. Mirrors hey-api's TS SDK options shape.
10
+ *
11
+ * - `client` — override the impl's bound `APIClient`.
12
+ * - `baseUrl` — override `client.baseUrl` for one call.
13
+ * - `timeout` — per-call call-timeout in milliseconds.
14
+ * - `headers` — extra/override headers, applied last.
15
+ * - `requestInterceptors` — extra suspend interceptors, run after
16
+ * client-level ones.
17
+ * - `responseValidator` — runs after a 2xx response; throwing
18
+ * converts the call into an exception.
19
+ * - `responseTransformer` — rewrite the response body before decode.
20
+ */
21
+ public data class RequestOptions(
22
+ public val client: APIClient? = null,
23
+ public val baseUrl: HttpUrl? = null,
24
+ public val timeout: Long? = null,
25
+ public val headers: Map<String, String> = emptyMap(),
26
+ public val requestInterceptors: List<suspend (Request) -> Request> = emptyList(),
27
+ public val responseValidator: (suspend (ByteArray, Response) -> Unit)? = null,
28
+ public val responseTransformer: (suspend (ByteArray) -> ByteArray)? = null,
29
+ )
@@ -0,0 +1,45 @@
1
+ package dev.irkit.runtime
2
+
3
+ import okhttp3.HttpUrl
4
+
5
+ /**
6
+ * Helpers used by generated impl code to add OpenAPI-shaped query
7
+ * parameters onto an `HttpUrl.Builder` without each call site having to
8
+ * know the style/explode rules.
9
+ *
10
+ * - `addScalar` skips when the value is `null` so optional-and-missing
11
+ * params don't emit a key at all.
12
+ * - `addArray` honours `style` + `explode`: explode=true emits one
13
+ * `?name=v` per element; explode=false joins per the style separator.
14
+ */
15
+ public object URLEncoding {
16
+ public fun addScalar(
17
+ builder: HttpUrl.Builder,
18
+ name: String,
19
+ value: Any?,
20
+ ) {
21
+ if (value == null) return
22
+ builder.addQueryParameter(name, value.toString())
23
+ }
24
+
25
+ public fun addArray(
26
+ builder: HttpUrl.Builder,
27
+ name: String,
28
+ values: List<Any>?,
29
+ style: QueryStyle = QueryStyle.FORM,
30
+ explode: Boolean = true,
31
+ ) {
32
+ if (values == null) return
33
+ if (explode) {
34
+ for (v in values) builder.addQueryParameter(name, v.toString())
35
+ return
36
+ }
37
+ val sep =
38
+ when (style) {
39
+ QueryStyle.FORM -> ","
40
+ QueryStyle.SPACE_DELIMITED -> " "
41
+ QueryStyle.PIPE_DELIMITED -> "|"
42
+ }
43
+ builder.addQueryParameter(name, values.joinToString(sep) { it.toString() })
44
+ }
45
+ }
@@ -1,6 +0,0 @@
1
- import type { KtClass } from "../../kt-dsl/decl/class.js";
2
- import { printType } from "../type.js";
3
- export declare function printClass(d: KtClass): string;
4
- /** Used by sealed-subclass lowering. */
5
- export { printType };
6
- //# sourceMappingURL=class.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"class.d.ts","sourceRoot":"","sources":["../../../src/kt-compiler/decl/class.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAIvC,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,CAiC7C;AAED,wCAAwC;AACxC,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,38 +0,0 @@
1
- import { INDENT, superTypeTail, visibilityPrefix } from "../format.js";
2
- import { printStmt } from "../stmt.js";
3
- import { printType } from "../type.js";
4
- import { printFun, printFunParam } from "./fun.js";
5
- import { printAnnotations, printPrimaryProp, printProp } from "./prop.js";
6
- export function printClass(d) {
7
- const annLines = printAnnotations(d.annotations, "");
8
- const vis = visibilityPrefix(d.visibility);
9
- const modifiers = d.modifiers.length > 0 ? `${d.modifiers.join(" ")} ` : "";
10
- const primaryProps = d.properties.filter((p) => p.inPrimary);
11
- const bodyProps = d.properties.filter((p) => !p.inPrimary);
12
- const ctorEntries = [];
13
- for (const p of primaryProps)
14
- ctorEntries.push(printPrimaryProp(p, INDENT));
15
- for (const p of d.ctorParams)
16
- ctorEntries.push(`${INDENT}${printFunParam(p)}`);
17
- const ctor = ctorEntries.length === 0 ? "" : `(\n${ctorEntries.join(",\n")},\n)`;
18
- const head = `${annLines}${vis}${modifiers}class ${d.name}${ctor}${superTypeTail(d.superTypes)}`;
19
- const sections = [];
20
- if (bodyProps.length > 0) {
21
- sections.push(bodyProps.map((p) => printProp(p, INDENT)).join("\n"));
22
- }
23
- if (d.initBlock && d.initBlock.length > 0) {
24
- const inner = d.initBlock
25
- .map((s) => printStmt(s, INDENT + INDENT))
26
- .join("\n");
27
- sections.push(`${INDENT}init {\n${inner}\n${INDENT}}`);
28
- }
29
- if (d.funs.length > 0) {
30
- sections.push(d.funs.map((f) => printFun(f, INDENT)).join("\n\n"));
31
- }
32
- if (sections.length === 0)
33
- return head;
34
- return `${head} {\n${sections.join("\n\n")}\n}`;
35
- }
36
- /** Used by sealed-subclass lowering. */
37
- export { printType };
38
- //# sourceMappingURL=class.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"class.js","sourceRoot":"","sources":["../../../src/kt-compiler/decl/class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE1E,MAAM,UAAU,UAAU,CAAC,CAAU;IACnC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC3C,MAAM,SAAS,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CA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;IACD,IAAI,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1C,MAAM,KAAK,GAAG,CAAC,CAAC,SAAS;aACtB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC,CAAC;aACzC,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,QAAQ,CAAC,IAAI,CAAC,GAAG,MAAM,WAAW,KAAK,KAAK,MAAM,GAAG,CAAC,CAAC;IACzD,CAAC;IACD,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,GAAG,IAAI,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;AAClD,CAAC;AAED,wCAAwC;AACxC,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { KtDataClass } from "../../kt-dsl/decl/dataClass.js";
2
- export declare function printDataClass(d: KtDataClass): string;
3
- //# sourceMappingURL=dataClass.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataClass.d.ts","sourceRoot":"","sources":["../../../src/kt-compiler/decl/dataClass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAKlE,wBAAgB,cAAc,CAAC,CAAC,EAAE,WAAW,GAAG,MAAM,CAarD"}
@@ -1,18 +0,0 @@
1
- import { INDENT, superTypeTail, visibilityPrefix } from "../format.js";
2
- import { printFun } from "./fun.js";
3
- import { printAnnotations, printPrimaryProp } from "./prop.js";
4
- export function printDataClass(d) {
5
- const annLines = printAnnotations(d.annotations, "");
6
- const vis = visibilityPrefix(d.visibility);
7
- // Data classes carry all properties in the primary constructor.
8
- const primaryProps = d.properties
9
- .map((p) => printPrimaryProp({ ...p, inPrimary: true }, INDENT))
10
- .join(",\n");
11
- const ctor = d.properties.length === 0 ? "()" : `(\n${primaryProps},\n)`;
12
- const head = `${annLines}${vis}data class ${d.name}${ctor}${superTypeTail(d.superTypes)}`;
13
- if (d.funs.length === 0)
14
- return head;
15
- const funs = d.funs.map((f) => printFun(f, INDENT)).join("\n\n");
16
- return `${head} {\n${funs}\n}`;
17
- }
18
- //# sourceMappingURL=dataClass.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dataClass.js","sourceRoot":"","sources":["../../../src/kt-compiler/decl/dataClass.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,UAAU,cAAc,CAAC,CAAc;IAC3C,MAAM,QAAQ,GAAG,gBAAgB,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC3C,gEAAgE;IAChE,MAAM,YAAY,GAAG,CAAC,CAAC,UAAU;SAC9B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,CAAC;SAC/D,IAAI,CAAC,KAAK,CAAC,CAAC;IACf,MAAM,IAAI,GAAG,CAAC,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,YAAY,MAAM,CAAC;IACzE,MAAM,IAAI,GAAG,GAAG,QAAQ,GAAG,GAAG,cAAc,CAAC,CAAC,IAAI,GAAG,IAAI,GAAG,aAAa,CAAC,CAAC,CAAC,UAAU,CAAC,EAAE,CAAC;IAE1F,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjE,OAAO,GAAG,IAAI,OAAO,IAAI,KAAK,CAAC;AACjC,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { KtEnum } from "../../kt-dsl/decl/enum.js";
2
- export declare function printEnum(d: KtEnum): string;
3
- //# sourceMappingURL=enum.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enum.d.ts","sourceRoot":"","sources":["../../../src/kt-compiler/decl/enum.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAKxD,wBAAgB,SAAS,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAiC3C"}
@@ -1,32 +0,0 @@
1
- import { INDENT, superTypeTail, visibilityPrefix } from "../format.js";
2
- import { printFun } from "./fun.js";
3
- import { printAnnotation, printAnnotations, printPrimaryProp } from "./prop.js";
4
- export function printEnum(d) {
5
- const annLines = printAnnotations(d.annotations, "");
6
- const vis = visibilityPrefix(d.visibility);
7
- const ctor = d.properties.length === 0
8
- ? ""
9
- : `(\n${d.properties.map((p) => printPrimaryProp({ ...p, inPrimary: true }, INDENT)).join(",\n")},\n)`;
10
- const head = `${annLines}${vis}enum class ${d.name}${ctor}${superTypeTail(d.superTypes)}`;
11
- if (d.entries.length === 0 && d.funs.length === 0) {
12
- return `${head} {}`;
13
- }
14
- const entryLines = d.entries.map((e) => {
15
- const annPrefix = e.annotations && e.annotations.length > 0
16
- ? `${e.annotations.map(printAnnotation).join(" ")} `
17
- : "";
18
- const args = e.args === undefined ? "" : `(${e.args})`;
19
- return `${INDENT}${annPrefix}${e.name}${args}`;
20
- });
21
- // Trailing semicolon is required by Kotlin when the enum class has
22
- // additional members (funs/companion) below the entry list.
23
- const entriesBlock = d.funs.length > 0
24
- ? `${entryLines.join(",\n")};`
25
- : `${entryLines.join(",\n")},`;
26
- const sections = [entriesBlock];
27
- if (d.funs.length > 0) {
28
- sections.push(d.funs.map((f) => printFun(f, INDENT)).join("\n\n"));
29
- }
30
- return `${head} {\n${sections.join("\n\n")}\n}`;
31
- }
32
- //# sourceMappingURL=enum.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enum.js","sourceRoot":"","sources":["../../../src/kt-compiler/decl/enum.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAEhF,MAAM,UAAU,SAAS,CAAC,CAAS;IACjC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACrD,MAAM,GAAG,GAAG,gBAAgB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAC3C,MAAM,IAAI,GACR,CAAC,CAAC,UAAU,CAAC,MAAM,KAAK,CAAC;QACvB,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,gBAAgB,CAAC,EAAE,GAAG,CAAC,E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;IAC1C,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,GAAG,IAAI,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;AAClD,CAAC"}
@@ -1,11 +0,0 @@
1
- import type { KtFun, KtFunParam } from "../../kt-dsl/fun.js";
2
- export declare function printFunParam(p: KtFunParam, includeDefault?: boolean): string;
3
- export declare function printParamsBlock(params: ReadonlyArray<KtFunParam>, indent: string, includeDefault?: boolean): string;
4
- export declare function printFun(fn: KtFun, indent?: string,
5
- /**
6
- * Suppress the visibility modifier — required when the function lives
7
- * inside an interface (members inherit the interface's visibility),
8
- * or as part of an enum entry's member list.
9
- */
10
- suppressVisibility?: boolean): string;
11
- //# sourceMappingURL=fun.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fun.d.ts","sourceRoot":"","sources":["../../../src/kt-compiler/decl/fun.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAe,MAAM,qBAAqB,CAAC;AAgB1E,wBAAgB,aAAa,CAC3B,CAAC,EAAE,UAAU,EACb,cAAc,GAAE,OAAc,GAC7B,MAAM,CAIR;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,EACjC,MAAM,EAAE,MAAM,EACd,cAAc,GAAE,OAAc,GAC7B,MAAM,CAKR;AAED,wBAAgB,QAAQ,CACtB,EAAE,EAAE,KAAK,EACT,MAAM,GAAE,MAAW;AACnB;;;;GAIG;AACH,kBAAkB,GAAE,OAAe,GAClC,MAAM,CAqCR"}