@powerlines/plugin-alloy 0.19.13 → 0.19.14

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 (377) hide show
  1. package/dist/builtin-file-BJKPEOF7.mjs +62 -0
  2. package/dist/builtin-file-BJKPEOF7.mjs.map +1 -0
  3. package/dist/builtin-file-BghS0Iup.cjs +67 -0
  4. package/dist/builtin-file-CiW4-UYI.d.mts +35 -0
  5. package/dist/builtin-file-CiW4-UYI.d.mts.map +1 -0
  6. package/dist/builtin-file-DLGZvvC3.d.cts +35 -0
  7. package/dist/builtin-file-DLGZvvC3.d.cts.map +1 -0
  8. package/dist/builtin-file-Dj3eVgvv.d.cts +35 -0
  9. package/dist/builtin-file-Dj3eVgvv.d.cts.map +1 -0
  10. package/dist/builtin-file-RXdRpQs-.d.mts +35 -0
  11. package/dist/builtin-file-RXdRpQs-.d.mts.map +1 -0
  12. package/dist/capnp-CRMDa2Ok.d.mts +88 -0
  13. package/dist/capnp-CRMDa2Ok.d.mts.map +1 -0
  14. package/dist/capnp-ClfqI-5t.cjs +356 -0
  15. package/dist/capnp-CnQcwo0s.mjs +260 -0
  16. package/dist/capnp-CnQcwo0s.mjs.map +1 -0
  17. package/dist/capnp-YnGBPkLK.d.cts +88 -0
  18. package/dist/capnp-YnGBPkLK.d.cts.map +1 -0
  19. package/dist/{_virtual/rolldown_runtime.cjs → chunk-CbDLau6x.cjs} +6 -1
  20. package/dist/components-B0evB5xd.cjs +0 -0
  21. package/dist/components-BNK9p5AE.cjs +0 -0
  22. package/dist/components-C_Rnle_h.mjs +1 -0
  23. package/dist/components-CpjG2zC9.mjs +1 -0
  24. package/dist/components-CrWk5KiP.mjs +1 -0
  25. package/dist/components-CyQi7RHT.mjs +1 -0
  26. package/dist/components-DPKSrvP-.cjs +0 -0
  27. package/dist/components-IRVnipN0.d.cts +143 -0
  28. package/dist/components-IRVnipN0.d.cts.map +1 -0
  29. package/dist/components-ISRFDWTF.cjs +0 -0
  30. package/dist/components-oHSM7vmp.d.mts +143 -0
  31. package/dist/components-oHSM7vmp.d.mts.map +1 -0
  32. package/dist/context-AhzykdKC.mjs +51 -0
  33. package/dist/context-AhzykdKC.mjs.map +1 -0
  34. package/dist/context-Ctw077Cx.cjs +79 -0
  35. package/dist/context-Du_bVzRZ.d.mts +67 -0
  36. package/dist/context-Du_bVzRZ.d.mts.map +1 -0
  37. package/dist/context-Gqs3Ru42.d.cts +67 -0
  38. package/dist/context-Gqs3Ru42.d.cts.map +1 -0
  39. package/dist/contexts-DezKayEz.cjs +0 -0
  40. package/dist/contexts-J643Nrrt.cjs +0 -0
  41. package/dist/contexts-_jq-yJQG.mjs +1 -0
  42. package/dist/contexts-juWSyBfb.mjs +1 -0
  43. package/dist/core/components/index.cjs +11 -6
  44. package/dist/core/components/index.d.cts +6 -3
  45. package/dist/core/components/index.d.mts +6 -3
  46. package/dist/core/components/index.mjs +8 -3
  47. package/dist/core/components/output.cjs +2 -32
  48. package/dist/core/components/output.d.cts +2 -22
  49. package/dist/core/components/output.d.mts +2 -22
  50. package/dist/core/components/output.mjs +1 -30
  51. package/dist/core/components/single-line-comment.cjs +2 -21
  52. package/dist/core/components/single-line-comment.d.cts +2 -21
  53. package/dist/core/components/single-line-comment.d.mts +2 -21
  54. package/dist/core/components/single-line-comment.mjs +1 -19
  55. package/dist/core/components/source-file.cjs +6 -63
  56. package/dist/core/components/source-file.d.cts +2 -31
  57. package/dist/core/components/source-file.d.mts +2 -31
  58. package/dist/core/components/source-file.mjs +5 -60
  59. package/dist/core/contexts/context.cjs +7 -53
  60. package/dist/core/contexts/context.d.cts +1 -65
  61. package/dist/core/contexts/context.d.mts +1 -65
  62. package/dist/core/contexts/context.mjs +2 -48
  63. package/dist/core/contexts/index.cjs +17 -15
  64. package/dist/core/contexts/index.d.cts +4 -2
  65. package/dist/core/contexts/index.d.mts +4 -2
  66. package/dist/core/contexts/index.mjs +4 -2
  67. package/dist/core/contexts/reflection.cjs +9 -67
  68. package/dist/core/contexts/reflection.d.cts +2 -51
  69. package/dist/core/contexts/reflection.d.mts +2 -51
  70. package/dist/core/contexts/reflection.mjs +1 -58
  71. package/dist/core/index.cjs +24 -23
  72. package/dist/core/index.d.cts +8 -7
  73. package/dist/core/index.d.mts +8 -7
  74. package/dist/core/index.mjs +8 -7
  75. package/dist/create-builtin-BiKyN2s2.cjs +24 -0
  76. package/dist/create-builtin-DFiWd6Zc.d.cts +16 -0
  77. package/dist/create-builtin-DFiWd6Zc.d.cts.map +1 -0
  78. package/dist/create-builtin-DQuJyeZw.mjs +19 -0
  79. package/dist/create-builtin-DQuJyeZw.mjs.map +1 -0
  80. package/dist/create-builtin-FtQ6qKzX.d.mts +16 -0
  81. package/dist/create-builtin-FtQ6qKzX.d.mts.map +1 -0
  82. package/dist/dynamic-import-statement-B5Pdwr4Z.d.mts +33 -0
  83. package/dist/dynamic-import-statement-B5Pdwr4Z.d.mts.map +1 -0
  84. package/dist/dynamic-import-statement-BbNJchii.mjs +25 -0
  85. package/dist/dynamic-import-statement-BbNJchii.mjs.map +1 -0
  86. package/dist/dynamic-import-statement-DNJlI3ND.d.cts +33 -0
  87. package/dist/dynamic-import-statement-DNJlI3ND.d.cts.map +1 -0
  88. package/dist/dynamic-import-statement-Dy_MY_Ua.cjs +30 -0
  89. package/dist/dynamic-import-statement-vVM9osmC.d.cts +33 -0
  90. package/dist/dynamic-import-statement-vVM9osmC.d.cts.map +1 -0
  91. package/dist/entry-file-BFHFm7wA.cjs +47 -0
  92. package/dist/entry-file-CiMuxu2n.d.mts +28 -0
  93. package/dist/entry-file-CiMuxu2n.d.mts.map +1 -0
  94. package/dist/entry-file-CjhBCFEa.d.cts +28 -0
  95. package/dist/entry-file-CjhBCFEa.d.cts.map +1 -0
  96. package/dist/entry-file-DT_UunNT.mjs +41 -0
  97. package/dist/entry-file-DT_UunNT.mjs.map +1 -0
  98. package/dist/entry-file-Zt33JaE1.d.cts +28 -0
  99. package/dist/entry-file-Zt33JaE1.d.cts.map +1 -0
  100. package/dist/entry-file-ayzYWEo5.d.mts +28 -0
  101. package/dist/entry-file-ayzYWEo5.d.mts.map +1 -0
  102. package/dist/front-matter-2eGRXX11.mjs +28 -0
  103. package/dist/front-matter-2eGRXX11.mjs.map +1 -0
  104. package/dist/front-matter-DGpkM9OE.d.mts +16 -0
  105. package/dist/front-matter-DGpkM9OE.d.mts.map +1 -0
  106. package/dist/front-matter-DSp4xPaD.d.cts +16 -0
  107. package/dist/front-matter-DSp4xPaD.d.cts.map +1 -0
  108. package/dist/front-matter-DZ1tB-Uj.cjs +33 -0
  109. package/dist/front-matter-u9H7VPAF.d.cts +16 -0
  110. package/dist/front-matter-u9H7VPAF.d.cts.map +1 -0
  111. package/dist/helpers/capnp.cjs +18 -276
  112. package/dist/helpers/capnp.d.cts +1 -86
  113. package/dist/helpers/capnp.d.mts +1 -86
  114. package/dist/helpers/capnp.mjs +1 -257
  115. package/dist/helpers/create-builtin.cjs +2 -18
  116. package/dist/helpers/create-builtin.d.cts +1 -14
  117. package/dist/helpers/create-builtin.d.mts +1 -14
  118. package/dist/helpers/create-builtin.mjs +1 -16
  119. package/dist/helpers/index.cjs +23 -23
  120. package/dist/helpers/index.d.cts +4 -4
  121. package/dist/helpers/index.d.mts +4 -4
  122. package/dist/helpers/index.mjs +4 -4
  123. package/dist/helpers/refkey.cjs +2 -15
  124. package/dist/helpers/refkey.d.cts +1 -12
  125. package/dist/helpers/refkey.d.mts +1 -12
  126. package/dist/helpers/refkey.mjs +1 -13
  127. package/dist/helpers/typescript.cjs +2 -45
  128. package/dist/helpers/typescript.d.cts +1 -24
  129. package/dist/helpers/typescript.d.mts +1 -24
  130. package/dist/helpers/typescript.mjs +1 -43
  131. package/dist/index-B-Y-ZG2x.d.mts +1 -0
  132. package/dist/index-BH1nuHdZ.d.cts +1 -0
  133. package/dist/index-BUYyA1Xh.d.cts +1 -0
  134. package/dist/index-C-lwXyQ6.d.mts +1 -0
  135. package/dist/index-C6HcjJiY.d.mts +1 -0
  136. package/dist/index-C6yvNuzO.d.cts +1 -0
  137. package/dist/index-CrhZaFgN.d.cts +1 -0
  138. package/dist/index-CzItj62a.d.mts +1 -0
  139. package/dist/index-DcDTDbdz.d.cts +1 -0
  140. package/dist/index-hcx6LMSC.d.mts +1 -0
  141. package/dist/index.cjs +5 -5
  142. package/dist/index.d.cts +3 -2
  143. package/dist/index.d.cts.map +1 -0
  144. package/dist/index.d.mts +3 -2
  145. package/dist/index.d.mts.map +1 -0
  146. package/dist/index.mjs +4 -3
  147. package/dist/index.mjs.map +1 -0
  148. package/dist/markdown/components/front-matter.cjs +2 -27
  149. package/dist/markdown/components/front-matter.d.cts +1 -14
  150. package/dist/markdown/components/front-matter.d.mts +1 -14
  151. package/dist/markdown/components/front-matter.mjs +1 -25
  152. package/dist/markdown/components/index.cjs +17 -9
  153. package/dist/markdown/components/index.d.cts +7 -3
  154. package/dist/markdown/components/index.d.mts +7 -3
  155. package/dist/markdown/components/index.mjs +11 -3
  156. package/dist/markdown/components/markdown-file.cjs +10 -130
  157. package/dist/markdown/components/markdown-file.d.cts +4 -27
  158. package/dist/markdown/components/markdown-file.d.mts +4 -27
  159. package/dist/markdown/components/markdown-file.mjs +8 -127
  160. package/dist/markdown/components/markdown-table.cjs +5 -100
  161. package/dist/markdown/components/markdown-table.d.cts +3 -26
  162. package/dist/markdown/components/markdown-table.d.mts +3 -26
  163. package/dist/markdown/components/markdown-table.mjs +2 -96
  164. package/dist/markdown/contexts/index.cjs +6 -5
  165. package/dist/markdown/contexts/index.d.cts +2 -1
  166. package/dist/markdown/contexts/index.d.mts +2 -1
  167. package/dist/markdown/contexts/index.mjs +2 -1
  168. package/dist/markdown/contexts/markdown-table.cjs +5 -36
  169. package/dist/markdown/contexts/markdown-table.d.cts +1 -36
  170. package/dist/markdown/contexts/markdown-table.d.mts +1 -36
  171. package/dist/markdown/contexts/markdown-table.mjs +1 -31
  172. package/dist/markdown/index.cjs +22 -16
  173. package/dist/markdown/index.d.cts +8 -6
  174. package/dist/markdown/index.d.mts +8 -6
  175. package/dist/markdown/index.mjs +12 -6
  176. package/dist/markdown-file-CIGTz9xQ.d.cts +29 -0
  177. package/dist/markdown-file-CIGTz9xQ.d.cts.map +1 -0
  178. package/dist/markdown-file-CIwA46L3.mjs +130 -0
  179. package/dist/markdown-file-CIwA46L3.mjs.map +1 -0
  180. package/dist/markdown-file-DB2SAeE6.d.mts +29 -0
  181. package/dist/markdown-file-DB2SAeE6.d.mts.map +1 -0
  182. package/dist/markdown-file-DH7NDYYC.cjs +141 -0
  183. package/dist/markdown-file-EtJaVhJ3.d.mts +29 -0
  184. package/dist/markdown-file-EtJaVhJ3.d.mts.map +1 -0
  185. package/dist/markdown-file-gCQMRXoz.d.cts +29 -0
  186. package/dist/markdown-file-gCQMRXoz.d.cts.map +1 -0
  187. package/dist/markdown-table-AoJIzA89.d.cts +28 -0
  188. package/dist/markdown-table-AoJIzA89.d.cts.map +1 -0
  189. package/dist/markdown-table-B2ysbgWK.d.cts +28 -0
  190. package/dist/markdown-table-B2ysbgWK.d.cts.map +1 -0
  191. package/dist/markdown-table-BWPm6GbJ.cjs +57 -0
  192. package/dist/markdown-table-Br2Ihl2z.d.cts +38 -0
  193. package/dist/markdown-table-Br2Ihl2z.d.cts.map +1 -0
  194. package/dist/markdown-table-CFL7L6rA.d.mts +38 -0
  195. package/dist/markdown-table-CFL7L6rA.d.mts.map +1 -0
  196. package/dist/markdown-table-CJ9QJzAc.d.mts +28 -0
  197. package/dist/markdown-table-CJ9QJzAc.d.mts.map +1 -0
  198. package/dist/markdown-table-ChvYobzz.d.mts +28 -0
  199. package/dist/markdown-table-ChvYobzz.d.mts.map +1 -0
  200. package/dist/markdown-table-D3DonpwR.mjs +99 -0
  201. package/dist/markdown-table-D3DonpwR.mjs.map +1 -0
  202. package/dist/markdown-table-eTnxxb46.cjs +116 -0
  203. package/dist/markdown-table-g6DeP10e.mjs +34 -0
  204. package/dist/markdown-table-g6DeP10e.mjs.map +1 -0
  205. package/dist/output-CMC94bm-.d.mts +24 -0
  206. package/dist/output-CMC94bm-.d.mts.map +1 -0
  207. package/dist/output-CQXrGP3y.cjs +38 -0
  208. package/dist/output-D3UQ5nZo.mjs +33 -0
  209. package/dist/output-D3UQ5nZo.mjs.map +1 -0
  210. package/dist/output-Dq1RRbJY.d.cts +24 -0
  211. package/dist/output-Dq1RRbJY.d.cts.map +1 -0
  212. package/dist/output-MJnqpeJ-.d.mts +24 -0
  213. package/dist/output-MJnqpeJ-.d.mts.map +1 -0
  214. package/dist/plugin-B8wUxSXi.cjs +0 -0
  215. package/dist/plugin-BmQ6pIes.mjs +1 -0
  216. package/dist/plugin-C6SupJ8C.d.cts +41 -0
  217. package/dist/plugin-C6SupJ8C.d.cts.map +1 -0
  218. package/dist/plugin-bEu9fq1G.d.mts +41 -0
  219. package/dist/plugin-bEu9fq1G.d.mts.map +1 -0
  220. package/dist/record-expression-6ElbFyR0.cjs +17 -0
  221. package/dist/record-expression-BjXMzi4r.mjs +12 -0
  222. package/dist/record-expression-BjXMzi4r.mjs.map +1 -0
  223. package/dist/record-expression-adlQJuNw.d.cts +13 -0
  224. package/dist/record-expression-adlQJuNw.d.cts.map +1 -0
  225. package/dist/record-expression-c9kQA93k.d.mts +13 -0
  226. package/dist/record-expression-c9kQA93k.d.mts.map +1 -0
  227. package/dist/refkey-Bf_2_U5t.d.cts +14 -0
  228. package/dist/refkey-Bf_2_U5t.d.cts.map +1 -0
  229. package/dist/refkey-C08kDOQ0.cjs +21 -0
  230. package/dist/refkey-CIFiGvgZ.mjs +16 -0
  231. package/dist/refkey-CIFiGvgZ.mjs.map +1 -0
  232. package/dist/refkey-CSZgFc0P.d.mts +14 -0
  233. package/dist/refkey-CSZgFc0P.d.mts.map +1 -0
  234. package/dist/reflection-B-NMNIoB.mjs +61 -0
  235. package/dist/reflection-B-NMNIoB.mjs.map +1 -0
  236. package/dist/reflection-CUo0047e.d.mts +53 -0
  237. package/dist/reflection-CUo0047e.d.mts.map +1 -0
  238. package/dist/reflection-DHpdhvwI.cjs +108 -0
  239. package/dist/reflection-xU09ifzp.d.cts +53 -0
  240. package/dist/reflection-xU09ifzp.d.cts.map +1 -0
  241. package/dist/single-line-comment-BrtGpc8-.d.cts +23 -0
  242. package/dist/single-line-comment-BrtGpc8-.d.cts.map +1 -0
  243. package/dist/single-line-comment-Bvbr--Az.d.mts +23 -0
  244. package/dist/single-line-comment-Bvbr--Az.d.mts.map +1 -0
  245. package/dist/single-line-comment-COZ9RWsm.cjs +27 -0
  246. package/dist/single-line-comment-CQW1en2Z.d.cts +23 -0
  247. package/dist/single-line-comment-CQW1en2Z.d.cts.map +1 -0
  248. package/dist/single-line-comment-PMv_zrfe.d.mts +23 -0
  249. package/dist/single-line-comment-PMv_zrfe.d.mts.map +1 -0
  250. package/dist/single-line-comment-mOQtfhWt.mjs +22 -0
  251. package/dist/single-line-comment-mOQtfhWt.mjs.map +1 -0
  252. package/dist/source-file-BAoqxO5e.cjs +68 -0
  253. package/dist/source-file-BEY3mjFl.d.mts +33 -0
  254. package/dist/source-file-BEY3mjFl.d.mts.map +1 -0
  255. package/dist/source-file-BKZQpz0C.mjs +62 -0
  256. package/dist/source-file-BKZQpz0C.mjs.map +1 -0
  257. package/dist/source-file-BTsyACav.d.cts +33 -0
  258. package/dist/source-file-BTsyACav.d.cts.map +1 -0
  259. package/dist/source-file-CQl0UCgf.d.mts +33 -0
  260. package/dist/source-file-CQl0UCgf.d.mts.map +1 -0
  261. package/dist/source-file-QiALwKWL.d.cts +33 -0
  262. package/dist/source-file-QiALwKWL.d.cts.map +1 -0
  263. package/dist/tsdoc-BNV-5Qs2.mjs +466 -0
  264. package/dist/tsdoc-BNV-5Qs2.mjs.map +1 -0
  265. package/dist/tsdoc-CfvwK4Ml.d.cts +164 -0
  266. package/dist/tsdoc-CfvwK4Ml.d.cts.map +1 -0
  267. package/dist/tsdoc-OUuKjTbh.d.mts +164 -0
  268. package/dist/tsdoc-OUuKjTbh.d.mts.map +1 -0
  269. package/dist/tsdoc-nrR7IU_7.cjs +585 -0
  270. package/dist/tsdoc-reflection-BkVddZ_o.cjs +193 -0
  271. package/dist/tsdoc-reflection-C7_a06TL.mjs +176 -0
  272. package/dist/tsdoc-reflection-C7_a06TL.mjs.map +1 -0
  273. package/dist/tsdoc-reflection-DaykPe3v.d.cts +19 -0
  274. package/dist/tsdoc-reflection-DaykPe3v.d.cts.map +1 -0
  275. package/dist/tsdoc-reflection-Dggzpjh7.d.cts +19 -0
  276. package/dist/tsdoc-reflection-Dggzpjh7.d.cts.map +1 -0
  277. package/dist/tsdoc-reflection-ulqYHfKL.d.mts +19 -0
  278. package/dist/tsdoc-reflection-ulqYHfKL.d.mts.map +1 -0
  279. package/dist/types/components.cjs +1 -0
  280. package/dist/types/components.d.cts +1 -141
  281. package/dist/types/components.d.mts +1 -141
  282. package/dist/types/components.mjs +2 -0
  283. package/dist/types/index.cjs +2 -0
  284. package/dist/types/index.d.cts +2 -2
  285. package/dist/types/index.d.mts +2 -2
  286. package/dist/types/index.mjs +3 -0
  287. package/dist/types/plugin.cjs +1 -0
  288. package/dist/types/plugin.d.cts +1 -39
  289. package/dist/types/plugin.d.mts +1 -39
  290. package/dist/types/plugin.mjs +2 -0
  291. package/dist/typescript/components/builtin-file.cjs +10 -61
  292. package/dist/typescript/components/builtin-file.d.cts +5 -33
  293. package/dist/typescript/components/builtin-file.d.mts +5 -33
  294. package/dist/typescript/components/builtin-file.mjs +9 -59
  295. package/dist/typescript/components/dynamic-import-statement.cjs +2 -24
  296. package/dist/typescript/components/dynamic-import-statement.d.cts +1 -31
  297. package/dist/typescript/components/dynamic-import-statement.d.mts +1 -31
  298. package/dist/typescript/components/dynamic-import-statement.mjs +1 -22
  299. package/dist/typescript/components/entry-file.cjs +9 -41
  300. package/dist/typescript/components/entry-file.d.cts +4 -26
  301. package/dist/typescript/components/entry-file.d.mts +4 -26
  302. package/dist/typescript/components/entry-file.mjs +8 -38
  303. package/dist/typescript/components/index.cjs +50 -43
  304. package/dist/typescript/components/index.d.cts +12 -9
  305. package/dist/typescript/components/index.d.mts +12 -9
  306. package/dist/typescript/components/index.mjs +16 -9
  307. package/dist/typescript/components/record-expression.cjs +2 -11
  308. package/dist/typescript/components/record-expression.d.cts +1 -11
  309. package/dist/typescript/components/record-expression.d.mts +1 -11
  310. package/dist/typescript/components/record-expression.mjs +1 -9
  311. package/dist/typescript/components/tsdoc-reflection.cjs +8 -177
  312. package/dist/typescript/components/tsdoc-reflection.d.cts +3 -17
  313. package/dist/typescript/components/tsdoc-reflection.d.mts +3 -17
  314. package/dist/typescript/components/tsdoc-reflection.mjs +5 -173
  315. package/dist/typescript/components/tsdoc.cjs +23 -484
  316. package/dist/typescript/components/tsdoc.d.cts +2 -162
  317. package/dist/typescript/components/tsdoc.d.mts +2 -162
  318. package/dist/typescript/components/tsdoc.mjs +3 -463
  319. package/dist/typescript/components/typescript-file.cjs +10 -215
  320. package/dist/typescript/components/typescript-file.d.cts +3 -48
  321. package/dist/typescript/components/typescript-file.d.mts +3 -48
  322. package/dist/typescript/components/typescript-file.mjs +7 -211
  323. package/dist/typescript/components/typescript-interface.cjs +8 -72
  324. package/dist/typescript/components/typescript-interface.d.cts +2 -24
  325. package/dist/typescript/components/typescript-interface.d.mts +2 -24
  326. package/dist/typescript/components/typescript-interface.mjs +6 -69
  327. package/dist/typescript/components/typescript-object.cjs +8 -124
  328. package/dist/typescript/components/typescript-object.d.cts +2 -28
  329. package/dist/typescript/components/typescript-object.d.mts +2 -28
  330. package/dist/typescript/components/typescript-object.mjs +6 -121
  331. package/dist/typescript/index.cjs +50 -44
  332. package/dist/typescript/index.d.cts +12 -10
  333. package/dist/typescript/index.d.mts +12 -10
  334. package/dist/typescript/index.mjs +16 -10
  335. package/dist/typescript-BCc7kwL_.mjs +46 -0
  336. package/dist/typescript-BCc7kwL_.mjs.map +1 -0
  337. package/dist/typescript-BbjCTT04.cjs +51 -0
  338. package/dist/typescript-DWzPF4n4.d.mts +26 -0
  339. package/dist/typescript-DWzPF4n4.d.mts.map +1 -0
  340. package/dist/typescript-file-BDYo1D2p.d.cts +50 -0
  341. package/dist/typescript-file-BDYo1D2p.d.cts.map +1 -0
  342. package/dist/typescript-file-BWaBMfMr.d.mts +50 -0
  343. package/dist/typescript-file-BWaBMfMr.d.mts.map +1 -0
  344. package/dist/typescript-file-Bi5NEAOC.d.mts +50 -0
  345. package/dist/typescript-file-Bi5NEAOC.d.mts.map +1 -0
  346. package/dist/typescript-file-CFy1OsoL.mjs +214 -0
  347. package/dist/typescript-file-CFy1OsoL.mjs.map +1 -0
  348. package/dist/typescript-file-Ca-6MeqN.cjs +231 -0
  349. package/dist/typescript-file-fOVF6YF2.d.cts +50 -0
  350. package/dist/typescript-file-fOVF6YF2.d.cts.map +1 -0
  351. package/dist/typescript-interface-CilM16if.d.mts +26 -0
  352. package/dist/typescript-interface-CilM16if.d.mts.map +1 -0
  353. package/dist/typescript-interface-Dmvkz1pt.d.cts +26 -0
  354. package/dist/typescript-interface-Dmvkz1pt.d.cts.map +1 -0
  355. package/dist/typescript-interface-MV4qwTHs.d.mts +26 -0
  356. package/dist/typescript-interface-MV4qwTHs.d.mts.map +1 -0
  357. package/dist/typescript-interface-WicKnDB9.mjs +72 -0
  358. package/dist/typescript-interface-WicKnDB9.mjs.map +1 -0
  359. package/dist/typescript-interface-Zf9pVXoI.cjs +83 -0
  360. package/dist/typescript-o4AsClkT.d.cts +26 -0
  361. package/dist/typescript-o4AsClkT.d.cts.map +1 -0
  362. package/dist/typescript-object-A5_fPqKr.d.cts +30 -0
  363. package/dist/typescript-object-A5_fPqKr.d.cts.map +1 -0
  364. package/dist/typescript-object-BNmRVXfj.mjs +124 -0
  365. package/dist/typescript-object-BNmRVXfj.mjs.map +1 -0
  366. package/dist/typescript-object-Bi7HOz2C.d.mts +30 -0
  367. package/dist/typescript-object-Bi7HOz2C.d.mts.map +1 -0
  368. package/dist/typescript-object-C4WhCkui.cjs +135 -0
  369. package/dist/typescript-object-C7p9fJBF.d.mts +30 -0
  370. package/dist/typescript-object-C7p9fJBF.d.mts.map +1 -0
  371. package/dist/typescript-object-v1WiBD8W.d.cts +30 -0
  372. package/dist/typescript-object-v1WiBD8W.d.cts.map +1 -0
  373. package/dist/unctx-B3g_fMrS.cjs +13 -0
  374. package/dist/{internal/unctx.mjs → unctx-RT0xjVBl.mjs} +2 -1
  375. package/dist/unctx-RT0xjVBl.mjs.map +1 -0
  376. package/package.json +6 -6
  377. package/dist/internal/unctx.cjs +0 -8
@@ -0,0 +1,356 @@
1
+ const require_chunk = require('./chunk-CbDLau6x.cjs');
2
+ let defu = require("defu");
3
+ defu = require_chunk.__toESM(defu);
4
+ let __powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
5
+ let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
6
+ let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
7
+ let __stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
8
+ let __powerlines_deepkit_vendor_core = require("@powerlines/deepkit/vendor/core");
9
+ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
10
+ let __stryke_capnp_compile = require("@stryke/capnp/compile");
11
+ let __stryke_capnp_helpers = require("@stryke/capnp/helpers");
12
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
13
+ let __stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
14
+ let __stryke_json = require("@stryke/json");
15
+ let __stryke_path_join = require("@stryke/path/join");
16
+ let __stryke_string_format_get_words = require("@stryke/string-format/get-words");
17
+ let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
18
+ let __stryke_type_checks_is_bigint = require("@stryke/type-checks/is-bigint");
19
+ let __stryke_type_checks_is_null = require("@stryke/type-checks/is-null");
20
+ let __stryke_type_checks_is_number = require("@stryke/type-checks/is-number");
21
+ let __stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
22
+ let node_buffer = require("node:buffer");
23
+ let node_child_process = require("node:child_process");
24
+ let node_util = require("node:util");
25
+ let powerlines_lib_utilities_file_header = require("powerlines/lib/utilities/file-header");
26
+
27
+ //#region src/helpers/capnp.ts
28
+ /**
29
+ * Compiles a Cap'n Proto schema into TypeScript definitions.
30
+ *
31
+ * @param context - The context containing the project and workspace information.
32
+ * @param options - The options for compiling the schema.
33
+ * @returns A promise that resolves to the compiled schema.
34
+ */
35
+ async function compile(context, options = {}) {
36
+ const opts = (0, defu.default)(options, {
37
+ ts: true,
38
+ js: false,
39
+ dts: false,
40
+ schemas: (0, __stryke_path_join.joinPaths)(context.artifactsPath, "schemas"),
41
+ tsconfig: context.tsconfig,
42
+ projectRoot: context.config.projectRoot,
43
+ workspaceRoot: context.workspaceConfig.workspaceRoot,
44
+ tty: true
45
+ });
46
+ const resolvedOptions = await (0, __stryke_capnp_helpers.resolveOptions)(opts);
47
+ if (!resolvedOptions) throw new Error(`✖ No Cap'n Proto schema files found in the specified source paths: ${(0, __stryke_convert_to_array.toArray)(opts.schemas).join(", ")}.`);
48
+ return (0, __stryke_capnp_compile.capnpc)(resolvedOptions);
49
+ }
50
+ /**
51
+ * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.
52
+ *
53
+ * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.
54
+ * @param value - The value to stringify.
55
+ * @returns A string representation of the value.
56
+ */
57
+ function stringifyCapnpDefaultValue(property, value) {
58
+ return stringifyCapnpValue(property.type, value ?? property.getDefaultValue());
59
+ }
60
+ /**
61
+ * Converts any {@link Type}'s actual value to string representation.
62
+ *
63
+ * @param type - The {@link Type} of the value to stringify.
64
+ * @param value - The value to stringify.
65
+ * @returns A string representation of the value.
66
+ */
67
+ function stringifyCapnpValue(type, value) {
68
+ return type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal && (0, __stryke_type_checks_is_string.isString)(type.literal) ? `"${String(value)}"` : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.enum ? `${(0, __stryke_string_format_camel_case.camelCase)(String(value))}` : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array ? __stryke_json.StormJSON.stringify(value) : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.object || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral ? __stryke_json.StormJSON.stringify(value).replaceAll("{", "(").replaceAll("}", ")") : String(value);
69
+ }
70
+ /**
71
+ * Converts a ReflectionProperty's default value to a Cap'n Proto schema string representation.
72
+ *
73
+ * @param type - The TypeEnum to evaluate.
74
+ * @returns A string representation of the property.
75
+ */
76
+ function getCapnpEnumTypes(type) {
77
+ if (type.kind !== __powerlines_deepkit_vendor_type.ReflectionKind.enum) return null;
78
+ const unique = (0, __stryke_helpers_get_unique.getUniqueBy)(type.values.filter((value) => !(0, __stryke_type_checks_is_undefined.isUndefined)(value) && !(0, __stryke_type_checks_is_null.isNull)(value)), (enumMember) => (0, __stryke_type_checks_is_string.isString)(enumMember) ? "Text" : "Float32");
79
+ if (unique.length === 0) return null;
80
+ return unique[0] && (0, __stryke_type_checks_is_string.isString)(unique[0]) ? "Text" : "Float32";
81
+ }
82
+ /**
83
+ * Determines if a Type is a `Void` type in a Cap'n Proto schema.
84
+ *
85
+ * @param type - The Type to check.
86
+ * @returns True if the Type is a `Void` type, false otherwise.
87
+ */
88
+ function isVoidType(type) {
89
+ return type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.void || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.never || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.null || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.undefined || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.symbol;
90
+ }
91
+ /**
92
+ * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
93
+ *
94
+ * @param type - The {@link TypeUnion} to convert.
95
+ * @returns A string representation of the Cap'n Proto primitive type.
96
+ */
97
+ function getCapnpUnionTypes(type) {
98
+ return (0, __powerlines_deepkit_utilities.getUnionTypes)(type);
99
+ }
100
+ /**
101
+ * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
102
+ *
103
+ * @param type - The {@link TypeUnion} to convert.
104
+ * @returns An array of Cap'n Proto primitive types.
105
+ */
106
+ function isCapnpStringUnion(type) {
107
+ return getCapnpUnionTypes(type).some((member) => member.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string);
108
+ }
109
+ const LARGE_BUFFER = 1024 * 1e6;
110
+ const execAsync = (0, node_util.promisify)(node_child_process.exec);
111
+ async function generateCapnpId() {
112
+ const { stdout } = await execAsync("capnp id", {
113
+ windowsHide: true,
114
+ maxBuffer: LARGE_BUFFER,
115
+ killSignal: "SIGTERM"
116
+ });
117
+ return stdout;
118
+ }
119
+ async function generateCapnp(context, reflection, options) {
120
+ return `${(await generateCapnpId()).trim()};
121
+ ${(0, powerlines_lib_utilities_file_header.getBaseFileHeader)(context).replace(/^\r*\n*/g, "").replaceAll("//", "#")}
122
+ ${reflection.getMethods().length === 0 ? generateCapnpStruct(reflection, options) : generateCapnpInterface(reflection, options)}
123
+ `.trim();
124
+ }
125
+ function generateCapnpStruct(reflection, options = {}) {
126
+ const structName = options?.name || reflection.getTitle() || reflection.getClassName() || reflection.getName();
127
+ return `${generateCapnpEnums(reflection)}struct ${(0, __stryke_string_format_pascal_case.pascalCase)(structName)} {
128
+ # Struct definition for ${(0, __stryke_string_format_title_case.titleCase)(structName)}.
129
+
130
+ ${generateCapnpSchema(reflection, options)}
131
+ }
132
+ `;
133
+ }
134
+ function generateCapnpInterface(reflection, options = {}) {
135
+ const interfaceName = options?.name || reflection.getTitle() || reflection.getClassName() || reflection.getName();
136
+ return `${generateCapnpEnums(reflection)}interface ${(0, __stryke_string_format_pascal_case.pascalCase)(interfaceName)} {
137
+ # Interface definition for ${(0, __stryke_string_format_title_case.titleCase)(interfaceName)}.
138
+
139
+ ${generateCapnpSchema(reflection, options)}
140
+ }
141
+ `;
142
+ }
143
+ function formatEnumName(name) {
144
+ return (0, __stryke_string_format_pascal_case.pascalCase)(`${name}_Type`);
145
+ }
146
+ function generateCapnpEnums(reflection) {
147
+ const enums = reflection.getProperties().filter((prop) => !prop.isIgnored() && (prop.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.enum || prop.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.union && getCapnpUnionTypes(prop.type).filter((type) => type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal && ((0, __stryke_type_checks_is_string.isString)(type.literal) || (0, __stryke_type_checks_is_number.isNumber)(type.literal))).length === 1)).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? b.getNameAsString().localeCompare(a.getNameAsString()) : a.isReadonly() ? 1 : -1);
148
+ if (enums.length === 0) return "";
149
+ return `${enums.map((enumeration) => generateCapnpEnumSchema(enumeration.type, formatEnumName(enumeration.getNameAsString()))).join("\n\n")}
150
+
151
+ `;
152
+ }
153
+ function generateCapnpSchema(reflection, options = {}) {
154
+ let index = 0;
155
+ const indexCounter = options?.indexCounter ?? (() => index++);
156
+ return `${reflection.getProperties().filter((prop) => !prop.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? b.getNameAsString().localeCompare(a.getNameAsString()) : a.isReadonly() ? 1 : -1).map((prop) => generateCapnpPropertySchema(prop, indexCounter)).join(" \n\n ")}${reflection.getMethods().filter((methods) => !methods.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? String(b.getName()).localeCompare(String(a.getName())) : a.isReadonly() ? 1 : -1).map((methods) => generateCapnpMethodSchema(methods, indexCounter)).join(" \n\n ")}${reflection.getProperties().some((prop) => prop.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.class && prop.type.classType === Map) ? `
157
+ struct Map(Key, Value) {
158
+ entries @0 :List(Entry);
159
+
160
+ struct Entry {
161
+ key @0 :Key;
162
+ value @1 :Value;
163
+ }
164
+ }` : ""}${reflection.getProperties().some((prop) => prop.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.class && prop.type.classType === Date) ? `
165
+ struct Date {
166
+ # A standard Gregorian calendar date.
167
+
168
+ year @0 :Int16;
169
+ # The year - Must include the century.
170
+ # Negative value indicates BC.
171
+
172
+ month @1 :UInt8; # The month, 1-12
173
+
174
+ day @2 :UInt8; # The day of the month, 1-30
175
+
176
+ hour @3 :UInt8; # The hour of the day, 0-23
177
+
178
+ minute @4 :UInt8; # The minute of the hour, 0-59
179
+
180
+ second @5 :UInt8; # The second of the minute, 0-59
181
+
182
+ millisecond @6 :UInt16; # Milliseconds of the second, 0-999
183
+ }` : ""}`;
184
+ }
185
+ function generateCapnpMethodSchema(reflection, indexCounter) {
186
+ const methodName = reflection.getTitle() || typeof reflection.getName() === "string" ? String(reflection.getName()) : "";
187
+ if (!methodName) throw new Error(`Cannot generate Cap'n Proto schema for method without a name - Parent interface: ${reflection.reflectionClass.getName()}`);
188
+ return `${(0, __stryke_string_format_camel_case.camelCase)(methodName)} @${indexCounter()} (${reflection.getParameters().map((param) => {
189
+ return `${(0, __stryke_string_format_camel_case.camelCase)(param.getName())} :${generateCapnpPrimitive(param.getType())}${param.hasDefault() ? ` = ${stringifyCapnpDefaultValue(param)}` : ""}`;
190
+ }).join(", ")})${isVoidType(reflection.getReturnType()) ? "" : ` -> (${(0, __powerlines_deepkit_utilities.kindToName)(reflection.getReturnType().kind)}: ${generateCapnpPrimitive(reflection.getReturnType())})`}; # ${(reflection.getDescription() || `The ${(0, __stryke_string_format_title_case.titleCase)(reflection.reflectionClass.getTitle() || reflection.reflectionClass.getName())} interface ${(0, __stryke_string_format_title_case.titleCase)(methodName)} method.`).replaceAll("\n", ". ")}`;
191
+ }
192
+ function generateCapnpPropertyComment(reflection) {
193
+ const result = (0, __stryke_string_format_get_words.getWords)(reflection.getDescription() || `A schema property for ${(0, __stryke_string_format_title_case.titleCase)(reflection.getTitle() || reflection.getNameAsString())} field.`, { relaxed: true }).reduce((ret, word) => {
194
+ let length = ret.length;
195
+ if (ret.includes("\n")) length = ret.substring(ret.lastIndexOf("\n") + 1).length;
196
+ const current = word.trim();
197
+ if (length + current.length > 60) ret += `\n\t# ${current}`;
198
+ else ret += ` ${current}`;
199
+ return ret;
200
+ }, "").trim();
201
+ if (result.length > 0) return `\t# ${result}`;
202
+ return "";
203
+ }
204
+ function generateCapnpPropertySchema(reflection, indexCounter) {
205
+ if (reflection.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.union) if (getCapnpUnionTypes(reflection.type).length === 0) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :Void;
206
+ ${generateCapnpPropertyComment(reflection)}`;
207
+ else if (getCapnpUnionTypes(reflection.type).filter((type) => type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal && ((0, __stryke_type_checks_is_string.isString)(type.literal) || (0, __stryke_type_checks_is_number.isNumber)(type.literal))).length === 1) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :${formatEnumName(reflection.getNameAsString())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
208
+ ${generateCapnpPropertyComment(reflection)}`;
209
+ else return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} :union {
210
+ ${getCapnpUnionTypes(reflection.type).map((type) => ` ${(0, __powerlines_deepkit_utilities.kindToName)(type.kind)} @${indexCounter()} :${generateCapnpPrimitive(type)};`).join("\n")}
211
+ }
212
+ ${generateCapnpPropertyComment(reflection)}`;
213
+ else if (reflection.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.array) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :List(${generateCapnpPrimitive(reflection.getSubType())})${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
214
+ ${generateCapnpPropertyComment(reflection)}`;
215
+ else if (reflection.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.class) if (reflection.type.classType === Map) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :Map(${!reflection.type.typeArguments || reflection.type.typeArguments.length === 0 || !reflection.type.typeArguments[0] ? "Data" : generateCapnpPrimitive(reflection.type.typeArguments[0])}, ${!reflection.type.typeArguments || reflection.type.typeArguments.length < 2 || !reflection.type.typeArguments[1] ? "Data" : generateCapnpPrimitive(reflection.type.typeArguments[1])})${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
216
+ ${generateCapnpPropertyComment(reflection)}`;
217
+ else if (reflection.type.classType === Date) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :Data${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
218
+ ${generateCapnpPropertyComment(reflection)}`;
219
+ else if (reflection.type.classType === node_buffer.Buffer) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :Data${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
220
+ ${generateCapnpPropertyComment(reflection)}`;
221
+ else if (reflection.type.classType === ArrayBuffer) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :Data${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
222
+ ${generateCapnpPropertyComment(reflection)}`;
223
+ else return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :${(0, __stryke_string_format_pascal_case.pascalCase)(reflection.type.typeName || (0, __powerlines_deepkit_vendor_core.getClassName)(reflection.type.classType))}${generateCapnpStruct(reflection.reflectionClass, { name: (0, __stryke_string_format_pascal_case.pascalCase)(reflection.type.typeName || (0, __powerlines_deepkit_vendor_core.getClassName)(reflection.type.classType)) })}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
224
+ ${generateCapnpPropertyComment(reflection)}`;
225
+ else if (reflection.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.objectLiteral) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :${(0, __stryke_string_format_pascal_case.pascalCase)(reflection.type.typeName || (0, __powerlines_deepkit_vendor_type.memberNameToString)(reflection.getNameAsString()))}${generateCapnpStruct(reflection.reflectionClass, { name: (0, __stryke_string_format_pascal_case.pascalCase)(reflection.type.typeName || (0, __powerlines_deepkit_vendor_type.memberNameToString)(reflection.getNameAsString())) })}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
226
+ ${generateCapnpPropertyComment(reflection)}`;
227
+ else if (reflection.type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.enum) return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :${(0, __stryke_string_format_pascal_case.pascalCase)(reflection.getNameAsString())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
228
+ ${generateCapnpPropertyComment(reflection)}`;
229
+ return `${(0, __stryke_string_format_camel_case.camelCase)(reflection.getNameAsString())} @${indexCounter()} :${generateCapnpPrimitive(reflection.getType())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
230
+ ${generateCapnpPropertyComment(reflection)}`;
231
+ }
232
+ function generateCapnpEnumSchema(type, name) {
233
+ if (type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.union) return generateCapnpEnumSchema({
234
+ kind: __powerlines_deepkit_vendor_type.ReflectionKind.enum,
235
+ indexType: type,
236
+ enum: type.types.reduce((ret, type$1) => {
237
+ if ((0, __stryke_type_checks_is_string.isString)(type$1.literal) || (0, __stryke_type_checks_is_number.isNumber)(type$1.literal)) ret[(0, __stryke_string_format_camel_case.camelCase)(String(type$1.literal))] = type$1.literal;
238
+ return ret;
239
+ }, {}),
240
+ values: getCapnpUnionTypes(type).filter((type$1) => type$1.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal && ((0, __stryke_type_checks_is_string.isString)(type$1.literal) || (0, __stryke_type_checks_is_number.isNumber)(type$1.literal))).map((type$1) => type$1.literal)
241
+ }, name);
242
+ let index = 0;
243
+ const indexCounter = () => index++;
244
+ const enumType = getCapnpEnumTypes(type);
245
+ if (!enumType) return "";
246
+ return `enum ${(0, __stryke_string_format_pascal_case.pascalCase)(name)} {
247
+ ${type.enum && Object.entries(type.enum).length > 0 ? Object.entries(type.enum).filter(([, value]) => value !== null && value !== void 0).map(([key]) => ` ${(0, __stryke_string_format_camel_case.camelCase)(key)} @${indexCounter()};`).join("\n") : type.values.filter((value) => value !== null && value !== void 0).map((value) => `${enumType === "Text" && value ? (0, __stryke_string_format_camel_case.camelCase)(String(value)) : `${type.typeName ? `${(0, __stryke_string_format_camel_case.camelCase)(type.typeName)}_` : ""}${value || ""}`} @${indexCounter()};`).join("\n")}
248
+ }`;
249
+ }
250
+ /**
251
+ * Generates a string representation of Cap'n Proto primitive types from a Deepkit Type.
252
+ *
253
+ * @param type - The Deepkit Type to convert.
254
+ * @returns A string representation of the Cap'n Proto primitive type.
255
+ */
256
+ function generateCapnpPrimitive(type) {
257
+ return type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.never || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.void || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.null || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.undefined || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.symbol ? "Void" : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.class && type.classType === Date ? "Date" : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.class && type.classType === Set ? `List(${type.typeArguments && type.typeArguments[0] ? generateCapnpPrimitive(type.typeArguments[0]) : "Data"})` : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.bigint ? "UInt64" : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? "Float64" : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string || type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.regexp ? "Text" : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.boolean ? "Bool" : type.kind === __powerlines_deepkit_vendor_type.ReflectionKind.literal ? (0, __stryke_type_checks_is_number.isNumber)(type.literal) ? "Float64" : (0, __stryke_type_checks_is_bigint.isBigInt)(type.literal) ? "UInt64" : (0, __stryke_type_checks_is_string.isString)(type.literal) ? "Text" : typeof type.literal === "boolean" ? "Bool" : "Data" : "Data";
258
+ }
259
+
260
+ //#endregion
261
+ Object.defineProperty(exports, 'LARGE_BUFFER', {
262
+ enumerable: true,
263
+ get: function () {
264
+ return LARGE_BUFFER;
265
+ }
266
+ });
267
+ Object.defineProperty(exports, 'compile', {
268
+ enumerable: true,
269
+ get: function () {
270
+ return compile;
271
+ }
272
+ });
273
+ Object.defineProperty(exports, 'generateCapnp', {
274
+ enumerable: true,
275
+ get: function () {
276
+ return generateCapnp;
277
+ }
278
+ });
279
+ Object.defineProperty(exports, 'generateCapnpEnumSchema', {
280
+ enumerable: true,
281
+ get: function () {
282
+ return generateCapnpEnumSchema;
283
+ }
284
+ });
285
+ Object.defineProperty(exports, 'generateCapnpId', {
286
+ enumerable: true,
287
+ get: function () {
288
+ return generateCapnpId;
289
+ }
290
+ });
291
+ Object.defineProperty(exports, 'generateCapnpInterface', {
292
+ enumerable: true,
293
+ get: function () {
294
+ return generateCapnpInterface;
295
+ }
296
+ });
297
+ Object.defineProperty(exports, 'generateCapnpMethodSchema', {
298
+ enumerable: true,
299
+ get: function () {
300
+ return generateCapnpMethodSchema;
301
+ }
302
+ });
303
+ Object.defineProperty(exports, 'generateCapnpPrimitive', {
304
+ enumerable: true,
305
+ get: function () {
306
+ return generateCapnpPrimitive;
307
+ }
308
+ });
309
+ Object.defineProperty(exports, 'generateCapnpSchema', {
310
+ enumerable: true,
311
+ get: function () {
312
+ return generateCapnpSchema;
313
+ }
314
+ });
315
+ Object.defineProperty(exports, 'generateCapnpStruct', {
316
+ enumerable: true,
317
+ get: function () {
318
+ return generateCapnpStruct;
319
+ }
320
+ });
321
+ Object.defineProperty(exports, 'getCapnpEnumTypes', {
322
+ enumerable: true,
323
+ get: function () {
324
+ return getCapnpEnumTypes;
325
+ }
326
+ });
327
+ Object.defineProperty(exports, 'getCapnpUnionTypes', {
328
+ enumerable: true,
329
+ get: function () {
330
+ return getCapnpUnionTypes;
331
+ }
332
+ });
333
+ Object.defineProperty(exports, 'isCapnpStringUnion', {
334
+ enumerable: true,
335
+ get: function () {
336
+ return isCapnpStringUnion;
337
+ }
338
+ });
339
+ Object.defineProperty(exports, 'isVoidType', {
340
+ enumerable: true,
341
+ get: function () {
342
+ return isVoidType;
343
+ }
344
+ });
345
+ Object.defineProperty(exports, 'stringifyCapnpDefaultValue', {
346
+ enumerable: true,
347
+ get: function () {
348
+ return stringifyCapnpDefaultValue;
349
+ }
350
+ });
351
+ Object.defineProperty(exports, 'stringifyCapnpValue', {
352
+ enumerable: true,
353
+ get: function () {
354
+ return stringifyCapnpValue;
355
+ }
356
+ });
@@ -0,0 +1,260 @@
1
+ import defu from "defu";
2
+ import { getUnionTypes, kindToName } from "@powerlines/deepkit/utilities";
3
+ import { camelCase } from "@stryke/string-format/camel-case";
4
+ import { titleCase } from "@stryke/string-format/title-case";
5
+ import { isUndefined } from "@stryke/type-checks/is-undefined";
6
+ import { getClassName } from "@powerlines/deepkit/vendor/core";
7
+ import { ReflectionKind, memberNameToString } from "@powerlines/deepkit/vendor/type";
8
+ import { capnpc } from "@stryke/capnp/compile";
9
+ import { resolveOptions } from "@stryke/capnp/helpers";
10
+ import { toArray } from "@stryke/convert/to-array";
11
+ import { getUniqueBy } from "@stryke/helpers/get-unique";
12
+ import { StormJSON } from "@stryke/json";
13
+ import { joinPaths } from "@stryke/path/join";
14
+ import { getWords } from "@stryke/string-format/get-words";
15
+ import { pascalCase } from "@stryke/string-format/pascal-case";
16
+ import { isBigInt } from "@stryke/type-checks/is-bigint";
17
+ import { isNull } from "@stryke/type-checks/is-null";
18
+ import { isNumber } from "@stryke/type-checks/is-number";
19
+ import { isString } from "@stryke/type-checks/is-string";
20
+ import { Buffer } from "node:buffer";
21
+ import { exec } from "node:child_process";
22
+ import { promisify } from "node:util";
23
+ import { getBaseFileHeader } from "powerlines/lib/utilities/file-header";
24
+
25
+ //#region src/helpers/capnp.ts
26
+ /**
27
+ * Compiles a Cap'n Proto schema into TypeScript definitions.
28
+ *
29
+ * @param context - The context containing the project and workspace information.
30
+ * @param options - The options for compiling the schema.
31
+ * @returns A promise that resolves to the compiled schema.
32
+ */
33
+ async function compile(context, options = {}) {
34
+ const opts = defu(options, {
35
+ ts: true,
36
+ js: false,
37
+ dts: false,
38
+ schemas: joinPaths(context.artifactsPath, "schemas"),
39
+ tsconfig: context.tsconfig,
40
+ projectRoot: context.config.projectRoot,
41
+ workspaceRoot: context.workspaceConfig.workspaceRoot,
42
+ tty: true
43
+ });
44
+ const resolvedOptions = await resolveOptions(opts);
45
+ if (!resolvedOptions) throw new Error(`✖ No Cap'n Proto schema files found in the specified source paths: ${toArray(opts.schemas).join(", ")}.`);
46
+ return capnpc(resolvedOptions);
47
+ }
48
+ /**
49
+ * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.
50
+ *
51
+ * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.
52
+ * @param value - The value to stringify.
53
+ * @returns A string representation of the value.
54
+ */
55
+ function stringifyCapnpDefaultValue(property, value) {
56
+ return stringifyCapnpValue(property.type, value ?? property.getDefaultValue());
57
+ }
58
+ /**
59
+ * Converts any {@link Type}'s actual value to string representation.
60
+ *
61
+ * @param type - The {@link Type} of the value to stringify.
62
+ * @param value - The value to stringify.
63
+ * @returns A string representation of the value.
64
+ */
65
+ function stringifyCapnpValue(type, value) {
66
+ return type.kind === ReflectionKind.string || type.kind === ReflectionKind.literal && isString(type.literal) ? `"${String(value)}"` : type.kind === ReflectionKind.enum ? `${camelCase(String(value))}` : type.kind === ReflectionKind.array ? StormJSON.stringify(value) : type.kind === ReflectionKind.object || type.kind === ReflectionKind.objectLiteral ? StormJSON.stringify(value).replaceAll("{", "(").replaceAll("}", ")") : String(value);
67
+ }
68
+ /**
69
+ * Converts a ReflectionProperty's default value to a Cap'n Proto schema string representation.
70
+ *
71
+ * @param type - The TypeEnum to evaluate.
72
+ * @returns A string representation of the property.
73
+ */
74
+ function getCapnpEnumTypes(type) {
75
+ if (type.kind !== ReflectionKind.enum) return null;
76
+ const unique = getUniqueBy(type.values.filter((value) => !isUndefined(value) && !isNull(value)), (enumMember) => isString(enumMember) ? "Text" : "Float32");
77
+ if (unique.length === 0) return null;
78
+ return unique[0] && isString(unique[0]) ? "Text" : "Float32";
79
+ }
80
+ /**
81
+ * Determines if a Type is a `Void` type in a Cap'n Proto schema.
82
+ *
83
+ * @param type - The Type to check.
84
+ * @returns True if the Type is a `Void` type, false otherwise.
85
+ */
86
+ function isVoidType(type) {
87
+ return type.kind === ReflectionKind.void || type.kind === ReflectionKind.never || type.kind === ReflectionKind.null || type.kind === ReflectionKind.undefined || type.kind === ReflectionKind.symbol;
88
+ }
89
+ /**
90
+ * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
91
+ *
92
+ * @param type - The {@link TypeUnion} to convert.
93
+ * @returns A string representation of the Cap'n Proto primitive type.
94
+ */
95
+ function getCapnpUnionTypes(type) {
96
+ return getUnionTypes(type);
97
+ }
98
+ /**
99
+ * Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
100
+ *
101
+ * @param type - The {@link TypeUnion} to convert.
102
+ * @returns An array of Cap'n Proto primitive types.
103
+ */
104
+ function isCapnpStringUnion(type) {
105
+ return getCapnpUnionTypes(type).some((member) => member.kind === ReflectionKind.string);
106
+ }
107
+ const LARGE_BUFFER = 1024 * 1e6;
108
+ const execAsync = promisify(exec);
109
+ async function generateCapnpId() {
110
+ const { stdout } = await execAsync("capnp id", {
111
+ windowsHide: true,
112
+ maxBuffer: LARGE_BUFFER,
113
+ killSignal: "SIGTERM"
114
+ });
115
+ return stdout;
116
+ }
117
+ async function generateCapnp(context, reflection, options) {
118
+ return `${(await generateCapnpId()).trim()};
119
+ ${getBaseFileHeader(context).replace(/^\r*\n*/g, "").replaceAll("//", "#")}
120
+ ${reflection.getMethods().length === 0 ? generateCapnpStruct(reflection, options) : generateCapnpInterface(reflection, options)}
121
+ `.trim();
122
+ }
123
+ function generateCapnpStruct(reflection, options = {}) {
124
+ const structName = options?.name || reflection.getTitle() || reflection.getClassName() || reflection.getName();
125
+ return `${generateCapnpEnums(reflection)}struct ${pascalCase(structName)} {
126
+ # Struct definition for ${titleCase(structName)}.
127
+
128
+ ${generateCapnpSchema(reflection, options)}
129
+ }
130
+ `;
131
+ }
132
+ function generateCapnpInterface(reflection, options = {}) {
133
+ const interfaceName = options?.name || reflection.getTitle() || reflection.getClassName() || reflection.getName();
134
+ return `${generateCapnpEnums(reflection)}interface ${pascalCase(interfaceName)} {
135
+ # Interface definition for ${titleCase(interfaceName)}.
136
+
137
+ ${generateCapnpSchema(reflection, options)}
138
+ }
139
+ `;
140
+ }
141
+ function formatEnumName(name) {
142
+ return pascalCase(`${name}_Type`);
143
+ }
144
+ function generateCapnpEnums(reflection) {
145
+ const enums = reflection.getProperties().filter((prop) => !prop.isIgnored() && (prop.type.kind === ReflectionKind.enum || prop.type.kind === ReflectionKind.union && getCapnpUnionTypes(prop.type).filter((type) => type.kind === ReflectionKind.literal && (isString(type.literal) || isNumber(type.literal))).length === 1)).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? b.getNameAsString().localeCompare(a.getNameAsString()) : a.isReadonly() ? 1 : -1);
146
+ if (enums.length === 0) return "";
147
+ return `${enums.map((enumeration) => generateCapnpEnumSchema(enumeration.type, formatEnumName(enumeration.getNameAsString()))).join("\n\n")}
148
+
149
+ `;
150
+ }
151
+ function generateCapnpSchema(reflection, options = {}) {
152
+ let index = 0;
153
+ const indexCounter = options?.indexCounter ?? (() => index++);
154
+ return `${reflection.getProperties().filter((prop) => !prop.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? b.getNameAsString().localeCompare(a.getNameAsString()) : a.isReadonly() ? 1 : -1).map((prop) => generateCapnpPropertySchema(prop, indexCounter)).join(" \n\n ")}${reflection.getMethods().filter((methods) => !methods.isIgnored()).sort((a, b) => a.isReadonly() && b.isReadonly() || !a.isReadonly() && !b.isReadonly() ? String(b.getName()).localeCompare(String(a.getName())) : a.isReadonly() ? 1 : -1).map((methods) => generateCapnpMethodSchema(methods, indexCounter)).join(" \n\n ")}${reflection.getProperties().some((prop) => prop.type.kind === ReflectionKind.class && prop.type.classType === Map) ? `
155
+ struct Map(Key, Value) {
156
+ entries @0 :List(Entry);
157
+
158
+ struct Entry {
159
+ key @0 :Key;
160
+ value @1 :Value;
161
+ }
162
+ }` : ""}${reflection.getProperties().some((prop) => prop.type.kind === ReflectionKind.class && prop.type.classType === Date) ? `
163
+ struct Date {
164
+ # A standard Gregorian calendar date.
165
+
166
+ year @0 :Int16;
167
+ # The year - Must include the century.
168
+ # Negative value indicates BC.
169
+
170
+ month @1 :UInt8; # The month, 1-12
171
+
172
+ day @2 :UInt8; # The day of the month, 1-30
173
+
174
+ hour @3 :UInt8; # The hour of the day, 0-23
175
+
176
+ minute @4 :UInt8; # The minute of the hour, 0-59
177
+
178
+ second @5 :UInt8; # The second of the minute, 0-59
179
+
180
+ millisecond @6 :UInt16; # Milliseconds of the second, 0-999
181
+ }` : ""}`;
182
+ }
183
+ function generateCapnpMethodSchema(reflection, indexCounter) {
184
+ const methodName = reflection.getTitle() || typeof reflection.getName() === "string" ? String(reflection.getName()) : "";
185
+ if (!methodName) throw new Error(`Cannot generate Cap'n Proto schema for method without a name - Parent interface: ${reflection.reflectionClass.getName()}`);
186
+ return `${camelCase(methodName)} @${indexCounter()} (${reflection.getParameters().map((param) => {
187
+ return `${camelCase(param.getName())} :${generateCapnpPrimitive(param.getType())}${param.hasDefault() ? ` = ${stringifyCapnpDefaultValue(param)}` : ""}`;
188
+ }).join(", ")})${isVoidType(reflection.getReturnType()) ? "" : ` -> (${kindToName(reflection.getReturnType().kind)}: ${generateCapnpPrimitive(reflection.getReturnType())})`}; # ${(reflection.getDescription() || `The ${titleCase(reflection.reflectionClass.getTitle() || reflection.reflectionClass.getName())} interface ${titleCase(methodName)} method.`).replaceAll("\n", ". ")}`;
189
+ }
190
+ function generateCapnpPropertyComment(reflection) {
191
+ const result = getWords(reflection.getDescription() || `A schema property for ${titleCase(reflection.getTitle() || reflection.getNameAsString())} field.`, { relaxed: true }).reduce((ret, word) => {
192
+ let length = ret.length;
193
+ if (ret.includes("\n")) length = ret.substring(ret.lastIndexOf("\n") + 1).length;
194
+ const current = word.trim();
195
+ if (length + current.length > 60) ret += `\n\t# ${current}`;
196
+ else ret += ` ${current}`;
197
+ return ret;
198
+ }, "").trim();
199
+ if (result.length > 0) return `\t# ${result}`;
200
+ return "";
201
+ }
202
+ function generateCapnpPropertySchema(reflection, indexCounter) {
203
+ if (reflection.type.kind === ReflectionKind.union) if (getCapnpUnionTypes(reflection.type).length === 0) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Void;
204
+ ${generateCapnpPropertyComment(reflection)}`;
205
+ else if (getCapnpUnionTypes(reflection.type).filter((type) => type.kind === ReflectionKind.literal && (isString(type.literal) || isNumber(type.literal))).length === 1) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${formatEnumName(reflection.getNameAsString())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
206
+ ${generateCapnpPropertyComment(reflection)}`;
207
+ else return `${camelCase(reflection.getNameAsString())} :union {
208
+ ${getCapnpUnionTypes(reflection.type).map((type) => ` ${kindToName(type.kind)} @${indexCounter()} :${generateCapnpPrimitive(type)};`).join("\n")}
209
+ }
210
+ ${generateCapnpPropertyComment(reflection)}`;
211
+ else if (reflection.type.kind === ReflectionKind.array) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :List(${generateCapnpPrimitive(reflection.getSubType())})${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
212
+ ${generateCapnpPropertyComment(reflection)}`;
213
+ else if (reflection.type.kind === ReflectionKind.class) if (reflection.type.classType === Map) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Map(${!reflection.type.typeArguments || reflection.type.typeArguments.length === 0 || !reflection.type.typeArguments[0] ? "Data" : generateCapnpPrimitive(reflection.type.typeArguments[0])}, ${!reflection.type.typeArguments || reflection.type.typeArguments.length < 2 || !reflection.type.typeArguments[1] ? "Data" : generateCapnpPrimitive(reflection.type.typeArguments[1])})${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
214
+ ${generateCapnpPropertyComment(reflection)}`;
215
+ else if (reflection.type.classType === Date) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
216
+ ${generateCapnpPropertyComment(reflection)}`;
217
+ else if (reflection.type.classType === Buffer) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
218
+ ${generateCapnpPropertyComment(reflection)}`;
219
+ else if (reflection.type.classType === ArrayBuffer) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :Data${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
220
+ ${generateCapnpPropertyComment(reflection)}`;
221
+ else return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(reflection.type.typeName || getClassName(reflection.type.classType))}${generateCapnpStruct(reflection.reflectionClass, { name: pascalCase(reflection.type.typeName || getClassName(reflection.type.classType)) })}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
222
+ ${generateCapnpPropertyComment(reflection)}`;
223
+ else if (reflection.type.kind === ReflectionKind.objectLiteral) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(reflection.type.typeName || memberNameToString(reflection.getNameAsString()))}${generateCapnpStruct(reflection.reflectionClass, { name: pascalCase(reflection.type.typeName || memberNameToString(reflection.getNameAsString())) })}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
224
+ ${generateCapnpPropertyComment(reflection)}`;
225
+ else if (reflection.type.kind === ReflectionKind.enum) return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${pascalCase(reflection.getNameAsString())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
226
+ ${generateCapnpPropertyComment(reflection)}`;
227
+ return `${camelCase(reflection.getNameAsString())} @${indexCounter()} :${generateCapnpPrimitive(reflection.getType())}${reflection.hasDefault() ? ` = ${stringifyCapnpDefaultValue(reflection)}` : ""};
228
+ ${generateCapnpPropertyComment(reflection)}`;
229
+ }
230
+ function generateCapnpEnumSchema(type, name) {
231
+ if (type.kind === ReflectionKind.union) return generateCapnpEnumSchema({
232
+ kind: ReflectionKind.enum,
233
+ indexType: type,
234
+ enum: type.types.reduce((ret, type$1) => {
235
+ if (isString(type$1.literal) || isNumber(type$1.literal)) ret[camelCase(String(type$1.literal))] = type$1.literal;
236
+ return ret;
237
+ }, {}),
238
+ values: getCapnpUnionTypes(type).filter((type$1) => type$1.kind === ReflectionKind.literal && (isString(type$1.literal) || isNumber(type$1.literal))).map((type$1) => type$1.literal)
239
+ }, name);
240
+ let index = 0;
241
+ const indexCounter = () => index++;
242
+ const enumType = getCapnpEnumTypes(type);
243
+ if (!enumType) return "";
244
+ return `enum ${pascalCase(name)} {
245
+ ${type.enum && Object.entries(type.enum).length > 0 ? Object.entries(type.enum).filter(([, value]) => value !== null && value !== void 0).map(([key]) => ` ${camelCase(key)} @${indexCounter()};`).join("\n") : type.values.filter((value) => value !== null && value !== void 0).map((value) => `${enumType === "Text" && value ? camelCase(String(value)) : `${type.typeName ? `${camelCase(type.typeName)}_` : ""}${value || ""}`} @${indexCounter()};`).join("\n")}
246
+ }`;
247
+ }
248
+ /**
249
+ * Generates a string representation of Cap'n Proto primitive types from a Deepkit Type.
250
+ *
251
+ * @param type - The Deepkit Type to convert.
252
+ * @returns A string representation of the Cap'n Proto primitive type.
253
+ */
254
+ function generateCapnpPrimitive(type) {
255
+ return type.kind === ReflectionKind.never || type.kind === ReflectionKind.void || type.kind === ReflectionKind.null || type.kind === ReflectionKind.undefined || type.kind === ReflectionKind.symbol ? "Void" : type.kind === ReflectionKind.class && type.classType === Date ? "Date" : type.kind === ReflectionKind.class && type.classType === Set ? `List(${type.typeArguments && type.typeArguments[0] ? generateCapnpPrimitive(type.typeArguments[0]) : "Data"})` : type.kind === ReflectionKind.bigint ? "UInt64" : type.kind === ReflectionKind.number ? "Float64" : type.kind === ReflectionKind.string || type.kind === ReflectionKind.regexp ? "Text" : type.kind === ReflectionKind.boolean ? "Bool" : type.kind === ReflectionKind.literal ? isNumber(type.literal) ? "Float64" : isBigInt(type.literal) ? "UInt64" : isString(type.literal) ? "Text" : typeof type.literal === "boolean" ? "Bool" : "Data" : "Data";
256
+ }
257
+
258
+ //#endregion
259
+ export { generateCapnpId as a, generateCapnpPrimitive as c, getCapnpEnumTypes as d, getCapnpUnionTypes as f, stringifyCapnpValue as g, stringifyCapnpDefaultValue as h, generateCapnpEnumSchema as i, generateCapnpSchema as l, isVoidType as m, compile as n, generateCapnpInterface as o, isCapnpStringUnion as p, generateCapnp as r, generateCapnpMethodSchema as s, LARGE_BUFFER as t, generateCapnpStruct as u };
260
+ //# sourceMappingURL=capnp-CnQcwo0s.mjs.map