theokit 0.4.0-beta.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/dist/{actions-virtual-module-HWNTIEPI.js → actions-virtual-module-IY46EEEX.js} +2 -2
  2. package/dist/{actions-virtual-module-SEIPACG5.js → actions-virtual-module-XNHDNCZ6.js} +2 -2
  3. package/dist/add-2ZFFGGE4.js +0 -0
  4. package/dist/{app-typed-client-ITIYTBXO.js → app-typed-client-OUJO3V5J.js} +10 -5
  5. package/dist/{app-typed-client-62FYBLVJ.js.map → app-typed-client-OUJO3V5J.js.map} +1 -1
  6. package/dist/{app-typed-client-62FYBLVJ.js → app-typed-client-YOMWSA3F.js} +11 -6
  7. package/dist/{app-typed-client-ITIYTBXO.js.map → app-typed-client-YOMWSA3F.js.map} +1 -1
  8. package/dist/audit-log-BQWM5YLG.d.ts +60 -0
  9. package/dist/{aws-lambda-XYCGZH3I.js → aws-lambda-GKSTX6HD.js} +3 -3
  10. package/dist/body-parser-web-MUWBKZ3F.js +70 -0
  11. package/dist/body-parser-web-MUWBKZ3F.js.map +1 -0
  12. package/dist/broadcast-QOQGUNNK.js +0 -0
  13. package/dist/{build-HIGHJQQV.js → build-D4J7XECU.js} +31 -22
  14. package/dist/build-D4J7XECU.js.map +1 -0
  15. package/dist/build-request-body-preview-II2235E6.js +0 -0
  16. package/dist/{bun-K73TQEWC.js → bun-ISHSNFIO.js} +3 -3
  17. package/dist/{check-PZR67OY5.js → check-NXYPLM6M.js} +2 -2
  18. package/dist/{chunk-WZ7CPVQB.js → chunk-27LWMYNK.js} +28 -24
  19. package/dist/chunk-27LWMYNK.js.map +1 -0
  20. package/dist/{chunk-BIGBFZSU.js → chunk-2F4FROEQ.js} +1689 -1521
  21. package/dist/chunk-2F4FROEQ.js.map +1 -0
  22. package/dist/chunk-4HBI7DHP.js +20 -0
  23. package/dist/chunk-4HBI7DHP.js.map +1 -0
  24. package/dist/{chunk-X4JAX2U3.js → chunk-4S2UCILN.js} +180 -125
  25. package/dist/chunk-4S2UCILN.js.map +1 -0
  26. package/dist/{chunk-C52GSJPF.js → chunk-4S6YHNG2.js} +11 -8
  27. package/dist/chunk-4S6YHNG2.js.map +1 -0
  28. package/dist/chunk-5ODOE6EF.js +0 -0
  29. package/dist/{chunk-KJVEJILQ.js → chunk-5PU65T5W.js} +9 -3
  30. package/dist/chunk-5PU65T5W.js.map +1 -0
  31. package/dist/chunk-5QW7IQQU.js +36 -0
  32. package/dist/chunk-5QW7IQQU.js.map +1 -0
  33. package/dist/chunk-5Z2727GV.js +1324 -0
  34. package/dist/chunk-5Z2727GV.js.map +1 -0
  35. package/dist/{chunk-YLBSSEHX.js → chunk-6NEXVBPY.js} +5 -15
  36. package/dist/chunk-6NEXVBPY.js.map +1 -0
  37. package/dist/chunk-7MQOHNHE.js +36 -0
  38. package/dist/chunk-7MQOHNHE.js.map +1 -0
  39. package/dist/{chunk-TPCT3MXV.js → chunk-ABVITXFH.js} +405 -272
  40. package/dist/chunk-ABVITXFH.js.map +1 -0
  41. package/dist/chunk-ASDXVRJD.js +185 -0
  42. package/dist/chunk-ASDXVRJD.js.map +1 -0
  43. package/dist/chunk-B3L3TJVF.js +406 -0
  44. package/dist/chunk-B3L3TJVF.js.map +1 -0
  45. package/dist/{chunk-PB4GR7EP.js → chunk-C3ZZ56YZ.js} +1 -18
  46. package/dist/chunk-C3ZZ56YZ.js.map +1 -0
  47. package/dist/{chunk-O7335ZGH.js → chunk-CG563V5M.js} +5 -3
  48. package/dist/chunk-CG563V5M.js.map +1 -0
  49. package/dist/{chunk-5OFPQK6N.js → chunk-COXLEZCN.js} +2 -1
  50. package/dist/chunk-COXLEZCN.js.map +1 -0
  51. package/dist/{chunk-O4BLVPML.js → chunk-DNMSV3R3.js} +22 -28
  52. package/dist/chunk-DNMSV3R3.js.map +1 -0
  53. package/dist/chunk-E3JH6YUM.js +1 -0
  54. package/dist/chunk-ESC54TAK.js +220 -0
  55. package/dist/chunk-ESC54TAK.js.map +1 -0
  56. package/dist/chunk-FI7MPTJW.js +77 -0
  57. package/dist/chunk-FI7MPTJW.js.map +1 -0
  58. package/dist/chunk-H4J2LECY.js +201 -0
  59. package/dist/chunk-H4J2LECY.js.map +1 -0
  60. package/dist/chunk-IAJ2JVEH.js +256 -0
  61. package/dist/chunk-IAJ2JVEH.js.map +1 -0
  62. package/dist/{chunk-F3TG5FJV.js → chunk-IEZCAT2I.js} +7 -1
  63. package/dist/{chunk-F3TG5FJV.js.map → chunk-IEZCAT2I.js.map} +1 -1
  64. package/dist/chunk-JHEAWR3L.js +1 -0
  65. package/dist/chunk-JQSKBMXP.js +17 -0
  66. package/dist/chunk-JQSKBMXP.js.map +1 -0
  67. package/dist/{chunk-4QTKSLTO.js → chunk-K4M64WD6.js} +9 -5
  68. package/dist/{chunk-4QTKSLTO.js.map → chunk-K4M64WD6.js.map} +1 -1
  69. package/dist/chunk-KI7OWQUX.js +293 -0
  70. package/dist/chunk-KI7OWQUX.js.map +1 -0
  71. package/dist/chunk-KT3MWNZG.js +0 -0
  72. package/dist/{chunk-ZJW5FFYJ.js → chunk-LC5PYNJP.js} +2 -2
  73. package/dist/{chunk-JAAHOGKI.js → chunk-M2EY7KDR.js} +1223 -1124
  74. package/dist/chunk-M2EY7KDR.js.map +1 -0
  75. package/dist/{chunk-2VQKDRVF.js → chunk-MR7OLIC6.js} +3 -3
  76. package/dist/chunk-NM4WF3XD.js +63 -0
  77. package/dist/chunk-NM4WF3XD.js.map +1 -0
  78. package/dist/chunk-NPMCKOX4.js +1 -0
  79. package/dist/{chunk-VRHXOKRP.js → chunk-NZXH2LQQ.js} +86 -83
  80. package/dist/chunk-NZXH2LQQ.js.map +1 -0
  81. package/dist/{chunk-B6RP57M3.js → chunk-OLPB36O2.js} +4 -4
  82. package/dist/chunk-PIVX3DYW.js +142 -0
  83. package/dist/chunk-PIVX3DYW.js.map +1 -0
  84. package/dist/{chunk-7TOMTMHT.js → chunk-R7OC6UDK.js} +2 -1
  85. package/dist/chunk-R7OC6UDK.js.map +1 -0
  86. package/dist/chunk-RESN62GB.js +269 -0
  87. package/dist/chunk-RESN62GB.js.map +1 -0
  88. package/dist/{chunk-64JI5LTO.js → chunk-RMU7EBRO.js} +2 -2
  89. package/dist/chunk-RMU7EBRO.js.map +1 -0
  90. package/dist/chunk-TQYSPYKU.js +131 -0
  91. package/dist/chunk-TQYSPYKU.js.map +1 -0
  92. package/dist/chunk-TSLSIRBR.js +107 -0
  93. package/dist/chunk-TSLSIRBR.js.map +1 -0
  94. package/dist/{chunk-XP7YXRHO.js → chunk-U6TPSW4L.js} +37 -5
  95. package/dist/chunk-U6TPSW4L.js.map +1 -0
  96. package/dist/chunk-UD3LFGDL.js +45 -0
  97. package/dist/chunk-UD3LFGDL.js.map +1 -0
  98. package/dist/chunk-UUFYP2UM.js +161 -0
  99. package/dist/chunk-UUFYP2UM.js.map +1 -0
  100. package/dist/{chunk-OXIQI2XZ.js → chunk-VBZCVFSA.js} +2 -2
  101. package/dist/chunk-VMEWD57H.js +137 -0
  102. package/dist/chunk-VMEWD57H.js.map +1 -0
  103. package/dist/{chunk-TRH2L3FI.js → chunk-WEGALZEU.js} +3 -3
  104. package/dist/{chunk-ZOXNJV2O.js → chunk-WGHJD6I7.js} +35 -138
  105. package/dist/chunk-WGHJD6I7.js.map +1 -0
  106. package/dist/chunk-XMS5VRIK.js +0 -0
  107. package/dist/chunk-Y4H3JNVK.js +18 -0
  108. package/dist/chunk-Y4H3JNVK.js.map +1 -0
  109. package/dist/chunk-Z5IGLBWE.js +329 -0
  110. package/dist/chunk-Z5IGLBWE.js.map +1 -0
  111. package/dist/chunk-ZEGYW52B.js +26 -0
  112. package/dist/chunk-ZEGYW52B.js.map +1 -0
  113. package/dist/chunk-ZJQ4O76G.js +87 -0
  114. package/dist/chunk-ZJQ4O76G.js.map +1 -0
  115. package/dist/cli/index.js +32 -21
  116. package/dist/cli/index.js.map +1 -1
  117. package/dist/client/index.d.ts +107 -1
  118. package/dist/client/index.js +152 -6
  119. package/dist/client/index.js.map +1 -1
  120. package/dist/{cloudflare-LCAOTRYZ.js → cloudflare-OJGJ7R2D.js} +3 -3
  121. package/dist/configure-agent-registry-6YGTJYBC.js +0 -0
  122. package/dist/cookies-MJKMGJ7N.js +22 -0
  123. package/dist/csrf-BBrEZSBW.d.ts +107 -0
  124. package/dist/csrf-readiness-store-CjIoub3U.d.ts +43 -0
  125. package/dist/define-websocket-CdK94O-D.d.ts +64 -0
  126. package/dist/{deno-deploy-ZN4RE5HF.js → deno-deploy-BHWKFTOW.js} +3 -3
  127. package/dist/{dev-266MVCVA.js → dev-MJVSRZGF.js} +11 -11
  128. package/dist/{dev-emit-RBSFZZNO.js → dev-emit-5VPRCHOD.js} +39 -142
  129. package/dist/dev-emit-5VPRCHOD.js.map +1 -0
  130. package/dist/{dev-emit-NO6OZJOQ.js → dev-emit-HHP2XJXE.js} +5 -5
  131. package/dist/devtools/entry.js +185 -131
  132. package/dist/devtools/entry.js.map +1 -1
  133. package/dist/{dispatcher-AQJGI3HU.js → dispatcher-63LBXYLE.js} +2 -2
  134. package/dist/{dispatcher-E6QV32BO.js → dispatcher-EJME6C6M.js} +5 -2
  135. package/dist/dispatcher-EJME6C6M.js.map +1 -0
  136. package/dist/{dist-5V77Z223.js → dist-KRW6OVD4.js} +7 -7
  137. package/dist/dist-KRW6OVD4.js.map +1 -0
  138. package/dist/docker-EZDA5FT7.js +0 -0
  139. package/dist/error-envelope-BsNzzAV5.d.ts +62 -0
  140. package/dist/{generate-DT4IIAHF.js → generate-AZ2K6Z2Z.js} +75 -2
  141. package/dist/generate-AZ2K6Z2Z.js.map +1 -0
  142. package/dist/index-DWWEdFh5.d.ts +399 -0
  143. package/dist/index.d.ts +161 -1391
  144. package/dist/index.js +20 -8
  145. package/dist/index.js.map +1 -1
  146. package/dist/{info-FJ4NXKTB.js → info-47VB62MV.js} +5 -5
  147. package/dist/job-backend-CgC8Xf33.d.ts +68 -0
  148. package/dist/{lib-NL5JXGEB.js → lib-NST3PNZX.js} +31 -31
  149. package/dist/lib-NST3PNZX.js.map +1 -0
  150. package/dist/module-loader-Cfz7dgCP.d.ts +26 -0
  151. package/dist/{netlify-5VQ22Z2P.js → netlify-GSNSJGMN.js} +3 -3
  152. package/dist/{node-3APTLGWB.js → node-6I5B6RL3.js} +3 -3
  153. package/dist/node-6I5B6RL3.js.map +1 -0
  154. package/dist/{openapi-FNVSWZOL.js → openapi-NFLSNNVQ.js} +10 -10
  155. package/dist/plugin-runner-BGBkzgi0.d.ts +95 -0
  156. package/dist/plugin-types-DNJGxr4Z.d.ts +79 -0
  157. package/dist/{proper-lockfile-4Y3DP3RP.js → proper-lockfile-MVKMQGFK.js} +27 -27
  158. package/dist/proper-lockfile-MVKMQGFK.js.map +1 -0
  159. package/dist/rate-limit-BdNDZ3vt.d.ts +58 -0
  160. package/dist/registry-QHEZ3BWB.js +25 -0
  161. package/dist/router-RGZFX75G.js +0 -0
  162. package/dist/{routes-H4SPLFHJ.js → routes-3A4XGIEJ.js} +6 -6
  163. package/dist/{scan-C2BOKLSY.js → scan-NQFI5S7P.js} +2 -2
  164. package/dist/scan-NQFI5S7P.js.map +1 -0
  165. package/dist/schema-D3v8VB7o.d.ts +76 -0
  166. package/dist/{schema-VR6YNVLQ.js → schema-KZVOV333.js} +5 -3
  167. package/dist/schema-KZVOV333.js.map +1 -0
  168. package/dist/server/agent/index.d.ts +229 -0
  169. package/dist/server/agent/index.js +16 -0
  170. package/dist/server/agent/index.js.map +1 -0
  171. package/dist/server/auth/index.d.ts +46 -1
  172. package/dist/server/auth/index.js +10 -3
  173. package/dist/server/cost/index.d.ts +1 -3
  174. package/dist/server/cost/index.js +1 -1
  175. package/dist/server/cron/index.js +4 -2
  176. package/dist/server/define/index.d.ts +281 -0
  177. package/dist/server/define/index.js +26 -0
  178. package/dist/server/define/index.js.map +1 -0
  179. package/dist/server/http/index.d.ts +10 -0
  180. package/dist/server/http/index.js +74 -0
  181. package/dist/server/http/index.js.map +1 -0
  182. package/dist/server/index.d.ts +151 -1677
  183. package/dist/server/index.js +558 -1102
  184. package/dist/server/index.js.map +1 -1
  185. package/dist/server/jobs/index.d.ts +348 -2
  186. package/dist/server/jobs/index.js +5 -3
  187. package/dist/server/observability/index.d.ts +324 -0
  188. package/dist/server/observability/index.js +48 -0
  189. package/dist/server/observability/index.js.map +1 -0
  190. package/dist/server/plugins/index.d.ts +17 -0
  191. package/dist/server/plugins/index.js +17 -0
  192. package/dist/server/plugins/index.js.map +1 -0
  193. package/dist/server/rate-limit/index.d.ts +105 -0
  194. package/dist/server/rate-limit/index.js +25 -0
  195. package/dist/server/rate-limit/index.js.map +1 -0
  196. package/dist/server/realtime/index.d.ts +15 -0
  197. package/dist/server/realtime/index.js +8 -0
  198. package/dist/server/realtime/index.js.map +1 -0
  199. package/dist/server/scan/index.d.ts +106 -0
  200. package/dist/server/scan/index.js +43 -0
  201. package/dist/server/scan/index.js.map +1 -0
  202. package/dist/server/security/index.d.ts +193 -0
  203. package/dist/server/security/index.js +50 -0
  204. package/dist/server/security/index.js.map +1 -0
  205. package/dist/server/storage/index.d.ts +22 -0
  206. package/dist/server/storage/index.js +14 -0
  207. package/dist/server/storage/index.js.map +1 -0
  208. package/dist/server/webhook/index.d.ts +148 -0
  209. package/dist/server/webhook/index.js +19 -0
  210. package/dist/server/webhook/index.js.map +1 -0
  211. package/dist/server-error-to-envelope-NO4CCAFQ.js +8 -0
  212. package/dist/server-error-to-envelope-NO4CCAFQ.js.map +1 -0
  213. package/dist/server-error-to-envelope-UJK6OWDJ.js +134 -0
  214. package/dist/server-error-to-envelope-UJK6OWDJ.js.map +1 -0
  215. package/dist/server-routes-hmr-GZJGPWMS.js +0 -0
  216. package/dist/services-json-Z2QNGVPW.js +142 -0
  217. package/dist/services-json-Z2QNGVPW.js.map +1 -0
  218. package/dist/{services-typed-client-XWYYBWGW.js → services-typed-client-KK6RHRDG.js} +2 -2
  219. package/dist/{services-typed-client-ZX5JUHH3.js → services-typed-client-T7M5VPBP.js} +2 -2
  220. package/dist/{sqlite-vec-ARPNUBWT.js → sqlite-vec-54KB4RD3.js} +2 -2
  221. package/dist/sqlite-vec-54KB4RD3.js.map +1 -0
  222. package/dist/{start-HX3QUSOS.js → start-CGSZPBAG.js} +23 -23
  223. package/dist/start-CGSZPBAG.js.map +1 -0
  224. package/dist/{static-TZBVBDTB.js → static-QI5NQT2X.js} +6 -6
  225. package/dist/storage-manager-C4jsO0Tp.d.ts +89 -0
  226. package/dist/storage-manager-D5KBXXKB.js +0 -0
  227. package/dist/{storage-types-DtIVejC1.d.ts → storage-types-DsDTCPbp.d.ts} +1 -1
  228. package/dist/{theo-cloud-3K4DGB3S.js → theo-cloud-RSQCBNXL.js} +4 -4
  229. package/dist/theo-cloud-RSQCBNXL.js.map +1 -0
  230. package/dist/upgrade-readiness-GUJBCJIS.js +0 -0
  231. package/dist/{vercel-MWW24ABC.js → vercel-TKPZK62A.js} +3 -3
  232. package/dist/vite-plugin/index.d.ts +3 -1
  233. package/dist/vite-plugin/index.js +20 -8
  234. package/dist/{vite-plugin-IK3NOWXS.js → vite-plugin-CR4JDFUQ.js} +9 -9
  235. package/dist/vite-plugin-CR4JDFUQ.js.map +1 -0
  236. package/package.json +59 -10
  237. package/LICENSE +0 -201
  238. package/dist/build-HIGHJQQV.js.map +0 -1
  239. package/dist/chunk-5OFPQK6N.js.map +0 -1
  240. package/dist/chunk-64JI5LTO.js.map +0 -1
  241. package/dist/chunk-7TOMTMHT.js.map +0 -1
  242. package/dist/chunk-BIGBFZSU.js.map +0 -1
  243. package/dist/chunk-C52GSJPF.js.map +0 -1
  244. package/dist/chunk-CZM6WWWS.js +0 -2450
  245. package/dist/chunk-CZM6WWWS.js.map +0 -1
  246. package/dist/chunk-JAAHOGKI.js.map +0 -1
  247. package/dist/chunk-KJVEJILQ.js.map +0 -1
  248. package/dist/chunk-O4BLVPML.js.map +0 -1
  249. package/dist/chunk-O7335ZGH.js.map +0 -1
  250. package/dist/chunk-PB4GR7EP.js.map +0 -1
  251. package/dist/chunk-TPCT3MXV.js.map +0 -1
  252. package/dist/chunk-VRHXOKRP.js.map +0 -1
  253. package/dist/chunk-WZ7CPVQB.js.map +0 -1
  254. package/dist/chunk-X4JAX2U3.js.map +0 -1
  255. package/dist/chunk-XP7YXRHO.js.map +0 -1
  256. package/dist/chunk-YLBSSEHX.js.map +0 -1
  257. package/dist/chunk-ZOXNJV2O.js.map +0 -1
  258. package/dist/dev-emit-RBSFZZNO.js.map +0 -1
  259. package/dist/dispatcher-E6QV32BO.js.map +0 -1
  260. package/dist/dist-5V77Z223.js.map +0 -1
  261. package/dist/generate-DT4IIAHF.js.map +0 -1
  262. package/dist/index-li83Swxa.d.ts +0 -506
  263. package/dist/lib-NL5JXGEB.js.map +0 -1
  264. package/dist/proper-lockfile-4Y3DP3RP.js.map +0 -1
  265. package/dist/registry-4MZ26TZD.js +0 -25
  266. package/dist/schema-CjVly9c_.d.ts +0 -274
  267. package/dist/sqlite-vec-ARPNUBWT.js.map +0 -1
  268. package/dist/start-HX3QUSOS.js.map +0 -1
  269. package/dist/theo-cloud-3K4DGB3S.js.map +0 -1
  270. /package/dist/{actions-virtual-module-HWNTIEPI.js.map → actions-virtual-module-IY46EEEX.js.map} +0 -0
  271. /package/dist/{actions-virtual-module-SEIPACG5.js.map → actions-virtual-module-XNHDNCZ6.js.map} +0 -0
  272. /package/dist/{aws-lambda-XYCGZH3I.js.map → aws-lambda-GKSTX6HD.js.map} +0 -0
  273. /package/dist/{bun-K73TQEWC.js.map → bun-ISHSNFIO.js.map} +0 -0
  274. /package/dist/{check-PZR67OY5.js.map → check-NXYPLM6M.js.map} +0 -0
  275. /package/dist/{dispatcher-AQJGI3HU.js.map → chunk-E3JH6YUM.js.map} +0 -0
  276. /package/dist/{node-3APTLGWB.js.map → chunk-JHEAWR3L.js.map} +0 -0
  277. /package/dist/{chunk-ZJW5FFYJ.js.map → chunk-LC5PYNJP.js.map} +0 -0
  278. /package/dist/{chunk-2VQKDRVF.js.map → chunk-MR7OLIC6.js.map} +0 -0
  279. /package/dist/{scan-C2BOKLSY.js.map → chunk-NPMCKOX4.js.map} +0 -0
  280. /package/dist/{chunk-B6RP57M3.js.map → chunk-OLPB36O2.js.map} +0 -0
  281. /package/dist/{chunk-OXIQI2XZ.js.map → chunk-VBZCVFSA.js.map} +0 -0
  282. /package/dist/{chunk-TRH2L3FI.js.map → chunk-WEGALZEU.js.map} +0 -0
  283. /package/dist/{cloudflare-LCAOTRYZ.js.map → cloudflare-OJGJ7R2D.js.map} +0 -0
  284. /package/dist/{schema-VR6YNVLQ.js.map → cookies-MJKMGJ7N.js.map} +0 -0
  285. /package/dist/{deno-deploy-ZN4RE5HF.js.map → deno-deploy-BHWKFTOW.js.map} +0 -0
  286. /package/dist/{dev-266MVCVA.js.map → dev-MJVSRZGF.js.map} +0 -0
  287. /package/dist/{dev-emit-NO6OZJOQ.js.map → dev-emit-HHP2XJXE.js.map} +0 -0
  288. /package/dist/{vite-plugin-IK3NOWXS.js.map → dispatcher-63LBXYLE.js.map} +0 -0
  289. /package/dist/{info-FJ4NXKTB.js.map → info-47VB62MV.js.map} +0 -0
  290. /package/dist/{netlify-5VQ22Z2P.js.map → netlify-GSNSJGMN.js.map} +0 -0
  291. /package/dist/{openapi-FNVSWZOL.js.map → openapi-NFLSNNVQ.js.map} +0 -0
  292. /package/dist/{registry-4MZ26TZD.js.map → registry-QHEZ3BWB.js.map} +0 -0
  293. /package/dist/{routes-H4SPLFHJ.js.map → routes-3A4XGIEJ.js.map} +0 -0
  294. /package/dist/{services-typed-client-XWYYBWGW.js.map → services-typed-client-KK6RHRDG.js.map} +0 -0
  295. /package/dist/{services-typed-client-ZX5JUHH3.js.map → services-typed-client-T7M5VPBP.js.map} +0 -0
  296. /package/dist/{static-TZBVBDTB.js.map → static-QI5NQT2X.js.map} +0 -0
  297. /package/dist/{vercel-MWW24ABC.js.map → vercel-TKPZK62A.js.map} +0 -0
@@ -0,0 +1,22 @@
1
+ export { P as PostgresFactory, R as RedisFactory, S as StorageManager, g as getStorageManager } from '../../storage-manager-C4jsO0Tp.js';
2
+ export { G as GenericFactory, a as PoolLike, P as PostgresDatabaseConfig, c as RedisLike, R as RedisServerConfig, S as ServerConfig, d as StorageAdapter, b as StorageConfig, T as TlsConfig } from '../../storage-types-DsDTCPbp.js';
3
+
4
+ interface UnstorageInstance<T> {
5
+ getItem(key: string): Promise<T | null>;
6
+ setItem(key: string, value: T): Promise<void>;
7
+ removeItem(key: string): Promise<void>;
8
+ keys(prefix?: string): Promise<string[]>;
9
+ hasItem(key: string): Promise<boolean>;
10
+ clear(prefix?: string): Promise<void>;
11
+ dispose?(): Promise<void>;
12
+ }
13
+ declare function useUnstorage<T = unknown>(name: string, driver?: unknown): Promise<UnstorageInstance<T>>;
14
+
15
+ interface Db0Database {
16
+ exec: (sql: string) => Promise<unknown>;
17
+ prepare: (sql: string) => unknown;
18
+ sql: (strings: TemplateStringsArray, ...args: unknown[]) => Promise<unknown>;
19
+ }
20
+ declare function useDatabase(name: string, connector: unknown): Promise<Db0Database>;
21
+
22
+ export { type Db0Database, type UnstorageInstance, useDatabase, useUnstorage };
@@ -0,0 +1,14 @@
1
+ import {
2
+ StorageManager,
3
+ getStorageManager,
4
+ useDatabase,
5
+ useUnstorage
6
+ } from "../../chunk-ESC54TAK.js";
7
+ import "../../chunk-DGUM43GV.js";
8
+ export {
9
+ StorageManager,
10
+ getStorageManager,
11
+ useDatabase,
12
+ useUnstorage
13
+ };
14
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,148 @@
1
+ /**
2
+ * Constant-time byte comparison.
3
+ *
4
+ * Wraps `node:crypto.timingSafeEqual` when available (Node 6.6+) and falls
5
+ * back to a constant-time XOR loop for runtimes without `node:crypto`
6
+ * (Cloudflare Workers, Deno, Bun edge). Required to defeat timing attacks
7
+ * on webhook signature verification — a naive `===` or `Buffer.equals`
8
+ * would short-circuit on first mismatch byte and leak signature position
9
+ * via wall-clock timing.
10
+ *
11
+ * Web Crypto's `crypto.subtle.verify` would also work, but requires a
12
+ * `CryptoKey` object and is asymmetric (verify a signature against a key).
13
+ * For our case — comparing two pre-computed digests — raw byte equality
14
+ * is the correct primitive.
15
+ *
16
+ * @see https://nodejs.org/api/crypto.html#cryptotimingsafeequala-b
17
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/verify
18
+ */
19
+ /**
20
+ * Returns true iff `a` and `b` have identical bytes. Takes time
21
+ * proportional to `a.length` regardless of where bytes differ.
22
+ *
23
+ * @throws TypeError if either argument is not a Uint8Array.
24
+ */
25
+ declare function timingSafeEqual(a: Uint8Array, b: Uint8Array): boolean;
26
+
27
+ /**
28
+ * Read a Web `Request` body as a raw string EXACTLY ONCE and expose it
29
+ * alongside the original request (which remains readable by downstream
30
+ * code). Enforces a configurable `maxBodyBytes` cap to prevent OOM via
31
+ * pathological POST.
32
+ *
33
+ * MUST be called FIRST in the webhook pipeline, before any other code
34
+ * touches the body (`request.text()`, `request.json()`, parsers). Once
35
+ * the body is consumed, `Request.clone()` throws and this function fails.
36
+ *
37
+ * EC-101: default `maxBodyBytes = 1_000_000` (1 MB) covers Stripe
38
+ * (256 KB max), Slack (4 MB but compressed), and is well below Node
39
+ * memory thresholds. GitHub webhooks up to 25 MB MUST opt in
40
+ * (`maxBodyBytes: 25_000_000`).
41
+ *
42
+ * @see https://docs.stripe.com/webhooks/signatures
43
+ * @see https://docs.github.com/en/webhooks/using-webhooks/best-practices-for-using-webhooks
44
+ */
45
+ declare const DEFAULT_MAX_BODY_BYTES = 1000000;
46
+ interface ReadRawBodyOptions {
47
+ /** Maximum bytes to read before throwing `BodyTooLargeError`. Defaults to 1 MB. */
48
+ maxBodyBytes?: number;
49
+ }
50
+ interface RawBodyResult {
51
+ /** UTF-8 decoded body (or empty string when no body present). */
52
+ rawBody: string;
53
+ /** The ORIGINAL request, still readable by downstream code. */
54
+ bodyClone: Request;
55
+ }
56
+ /**
57
+ * Thrown when the request body exceeds `maxBodyBytes`. Carries status
58
+ * 413 (Payload Too Large) and stable code `BODY_TOO_LARGE` so callers
59
+ * can map it to an HTTP response without sniffing the message.
60
+ */
61
+ declare class BodyTooLargeError extends Error {
62
+ readonly limit: number;
63
+ readonly actualSeen: number;
64
+ readonly status = 413;
65
+ readonly code = "BODY_TOO_LARGE";
66
+ constructor(limit: number, actualSeen: number);
67
+ }
68
+ declare function readRawBody(request: Request, options?: ReadRawBodyOptions): Promise<RawBodyResult>;
69
+
70
+ /**
71
+ * Webhook primitive types (R0.5.10).
72
+ *
73
+ * @see docs/adr/0005-webhook-verify-inline-function.md
74
+ */
75
+ type VerifyResult = {
76
+ ok: true;
77
+ } | {
78
+ ok: false;
79
+ reason: string;
80
+ };
81
+ /**
82
+ * A verify function — pure, async-or-sync. Takes the cloned request
83
+ * (raw body NOT yet consumed by handler), returns ok/notOk + reason.
84
+ *
85
+ * Per ADR-0005, helper factories (`stripe`, `github`, `slack`) return
86
+ * this shape. Users can also write inline `verify: async (req) => ...`
87
+ * for custom providers.
88
+ */
89
+ type VerifyFn = (req: Request) => Promise<VerifyResult> | VerifyResult;
90
+ interface WebhookContext {
91
+ /** The cloned Request (still readable by user code). */
92
+ readonly request: Request;
93
+ /** Raw body bytes as UTF-8 string — already-verified at this point. */
94
+ readonly rawBody: string;
95
+ /** W3C trace_id propagated from request. */
96
+ readonly traceId: string;
97
+ /** Abort signal triggered by client disconnect or server stop. */
98
+ readonly signal: AbortSignal;
99
+ }
100
+ interface DefineWebhookOptions {
101
+ verify: VerifyFn;
102
+ handler: (ctx: WebhookContext) => unknown;
103
+ /** Override `readRawBody` body size cap (EC-101). Default 1MB. */
104
+ maxBodyBytes?: number;
105
+ }
106
+ interface WebhookDefinition {
107
+ readonly verify: VerifyFn;
108
+ readonly handler: (ctx: WebhookContext) => unknown;
109
+ readonly maxBodyBytes?: number;
110
+ /** Discriminator for runtime dispatch. */
111
+ readonly __theokit_kind: 'webhook';
112
+ }
113
+
114
+ /**
115
+ * Declare a webhook handler with first-class signature verification
116
+ * (R0.5.10, ADR-0005). Pure identity helper — returns the definition
117
+ * unchanged for downstream dispatch.
118
+ *
119
+ * @example
120
+ * ```ts
121
+ * // server/webhooks/stripe.ts
122
+ * import { defineWebhook } from 'theokit/server'
123
+ * import { stripe } from 'theokit/server/webhook/providers'
124
+ *
125
+ * export default defineWebhook({
126
+ * verify: stripe({ secret: process.env.STRIPE_WEBHOOK_SECRET! }),
127
+ * async handler({ rawBody }) {
128
+ * const event = JSON.parse(rawBody)
129
+ * // ...
130
+ * return new Response('ok')
131
+ * },
132
+ * })
133
+ * ```
134
+ */
135
+ declare function defineWebhook(opts: DefineWebhookOptions): WebhookDefinition;
136
+ /**
137
+ * Dispatch a webhook request through the definition's verify → handler
138
+ * pipeline. Returns the handler's `Response` (or a wrapped one), or a
139
+ * 401/413 response when verification or body size guards trip.
140
+ *
141
+ * EC-101: enforces `maxBodyBytes` (default 1MB via readRawBody).
142
+ * EC-103: every throw from `verify` (sync or async) is treated as
143
+ * `{ok: false, reason: 'verify threw: <message>'}`. Handler NEVER
144
+ * invoked on verify failure.
145
+ */
146
+ declare function dispatchWebhook(def: WebhookDefinition, request: Request): Promise<Response>;
147
+
148
+ export { BodyTooLargeError, DEFAULT_MAX_BODY_BYTES, type DefineWebhookOptions, type RawBodyResult, type ReadRawBodyOptions, type VerifyFn, type VerifyResult, type WebhookContext, type WebhookDefinition, defineWebhook, dispatchWebhook, readRawBody, timingSafeEqual };
@@ -0,0 +1,19 @@
1
+ import {
2
+ BodyTooLargeError,
3
+ DEFAULT_MAX_BODY_BYTES,
4
+ defineWebhook,
5
+ dispatchWebhook,
6
+ readRawBody,
7
+ timingSafeEqual
8
+ } from "../../chunk-UUFYP2UM.js";
9
+ import "../../chunk-6NEXVBPY.js";
10
+ import "../../chunk-DGUM43GV.js";
11
+ export {
12
+ BodyTooLargeError,
13
+ DEFAULT_MAX_BODY_BYTES,
14
+ defineWebhook,
15
+ dispatchWebhook,
16
+ readRawBody,
17
+ timingSafeEqual
18
+ };
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ serverErrorToEnvelope
3
+ } from "./chunk-TQYSPYKU.js";
4
+ import "./chunk-DGUM43GV.js";
5
+ export {
6
+ serverErrorToEnvelope
7
+ };
8
+ //# sourceMappingURL=server-error-to-envelope-NO4CCAFQ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env node
2
+ import "tsx/esm";
3
+ import "./chunk-KT3MWNZG.js";
4
+
5
+ // src/core/contracts/theo-error.ts
6
+ var TheoError = class extends Error {
7
+ name = "TheoError";
8
+ code;
9
+ meta;
10
+ ext;
11
+ constructor(opts) {
12
+ super(opts.message, opts.cause !== void 0 ? { cause: opts.cause } : void 0);
13
+ this.code = opts.code;
14
+ this.meta = opts.meta;
15
+ this.ext = opts.ext;
16
+ }
17
+ /**
18
+ * The canonical envelope view of this error. Use when crossing the wire
19
+ * boundary or feeding telemetry — exposes the shape consumers can rely on
20
+ * without depending on the class identity.
21
+ */
22
+ get envelope() {
23
+ return {
24
+ code: this.code,
25
+ message: this.message,
26
+ cause: this.cause,
27
+ meta: this.meta,
28
+ ext: this.ext
29
+ };
30
+ }
31
+ /**
32
+ * JSON serialization — emits envelope shape only (no name/stack class
33
+ * internals). Per ADR D5, `meta.stack` is auto-stripped in non-dev to
34
+ * prevent accidental leak; other meta keys are preserved.
35
+ */
36
+ toJSON() {
37
+ const meta = this.meta ? sanitizeMeta(this.meta) : void 0;
38
+ return {
39
+ code: this.code,
40
+ message: this.message,
41
+ cause: this.cause,
42
+ meta,
43
+ ext: this.ext
44
+ };
45
+ }
46
+ };
47
+ function sanitizeMeta(meta) {
48
+ if (process.env.NODE_ENV === "development") {
49
+ return meta;
50
+ }
51
+ const out = {};
52
+ for (const [k, v] of Object.entries(meta)) {
53
+ if (k === "stack") continue;
54
+ out[k] = v;
55
+ }
56
+ return out;
57
+ }
58
+
59
+ // src/core/contracts/server-error-to-envelope.ts
60
+ var ERROR_NAME_TO_CODE = /* @__PURE__ */ new Map([
61
+ ["AuthRequiredError", "UNAUTHORIZED"],
62
+ ["FileTooLargeError", "PAYLOAD_TOO_LARGE"],
63
+ ["RequestBodyTooLargeError", "PAYLOAD_TOO_LARGE"],
64
+ ["BodyTooLargeError", "PAYLOAD_TOO_LARGE"],
65
+ // RouterConventionError reaches the wire only during dev-error overlay;
66
+ // INTERNAL_SERVER_ERROR is appropriate, but we add a HintExt-shaped ext
67
+ // with the migration guidance for the devtools display.
68
+ ["RouterConventionError", "INTERNAL_SERVER_ERROR"]
69
+ ]);
70
+ var META_EXTRACTORS = /* @__PURE__ */ new Map([
71
+ [
72
+ "FileTooLargeError",
73
+ (err) => {
74
+ const e = err;
75
+ return {
76
+ truncatedFilenames: e.truncatedFilenames ?? [],
77
+ maxFileSize: e.maxFileSize
78
+ };
79
+ }
80
+ ],
81
+ [
82
+ "RouterConventionError",
83
+ (err) => {
84
+ const e = err;
85
+ return {
86
+ file: e.file,
87
+ suggestion: e.suggestion,
88
+ migrationUrl: e.migrationUrl
89
+ };
90
+ }
91
+ ]
92
+ ]);
93
+ var EXT_BUILDERS = /* @__PURE__ */ new Map([
94
+ [
95
+ "RouterConventionError",
96
+ () => ({
97
+ hint: "Run `theokit migrate router` to convert dotted-basename routes to directory-nested form."
98
+ })
99
+ ]
100
+ ]);
101
+ function serverErrorToEnvelope(value) {
102
+ if (value instanceof TheoError) {
103
+ return value.envelope;
104
+ }
105
+ if (!(value instanceof Error)) {
106
+ return {
107
+ code: "INTERNAL_SERVER_ERROR",
108
+ message: typeof value === "string" ? value : "Unknown error"
109
+ };
110
+ }
111
+ const name = value.name;
112
+ const code = ERROR_NAME_TO_CODE.get(name) ?? "INTERNAL_SERVER_ERROR";
113
+ const extractor = META_EXTRACTORS.get(name);
114
+ const extra = extractor ? extractor(value) : null;
115
+ const meta = { name };
116
+ if (extra) {
117
+ for (const [k, v] of Object.entries(extra)) {
118
+ if (v !== void 0) meta[k] = v;
119
+ }
120
+ }
121
+ const extBuilder = EXT_BUILDERS.get(name);
122
+ const ext = extBuilder ? extBuilder(value) : void 0;
123
+ return {
124
+ code,
125
+ message: value.message,
126
+ cause: value.cause,
127
+ meta,
128
+ ext
129
+ };
130
+ }
131
+ export {
132
+ serverErrorToEnvelope
133
+ };
134
+ //# sourceMappingURL=server-error-to-envelope-UJK6OWDJ.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/core/contracts/theo-error.ts","../src/core/contracts/server-error-to-envelope.ts"],"sourcesContent":["/**\n * `TheoError` — envelope-emitting `Error` subclass per plan\n * g5-error-envelope-cross-layer v1.0 § Phase 1 / T1.2.\n *\n * Mirrors trpc's TRPCError ergonomic pattern (referencia:\n * trpc/packages/server/src/unstable-core-do-not-import/error/TRPCError.ts:65-87)\n * adapted for theokit's hybrid envelope model (blueprint Form 4).\n *\n * Per ADR D5: `meta.stack` is auto-stripped in non-dev builds when serialized\n * via `toJSON()` — defense against accidental stack leak to clients (encore\n * `json:\"-\"` analog).\n *\n * Lives in `core/contracts/` per architecture.md v3 invariant #3.\n */\n\nimport type { TheoErrorCode, TheoErrorEnvelope } from './error-envelope.js'\n\n/**\n * Constructor options. `code` and `message` are required; `cause` follows TC39\n * proposal-error-cause; `meta` and `ext` are opt-in per blueprint ADR D2.\n */\nexport interface TheoErrorOptions<TExt = unknown> {\n readonly code: TheoErrorCode\n readonly message: string\n readonly cause?: unknown\n readonly meta?: Record<string, unknown>\n readonly ext?: TExt\n}\n\n/**\n * `TheoError` — envelope-emitting Error subclass. Use this anywhere in\n * `theokit/server`, route handlers, or middleware to emit a typed,\n * cross-layer-compatible error.\n *\n * Mirrors TRPCError pattern: `code` is required, `message` defaults to\n * code if omitted, `cause` chain is preserved via TC39 proposal-error-cause.\n */\nexport class TheoError<TExt = unknown> extends Error {\n override readonly name = 'TheoError'\n readonly code: TheoErrorCode\n readonly meta?: Record<string, unknown>\n readonly ext?: TExt\n\n constructor(opts: TheoErrorOptions<TExt>) {\n super(opts.message, opts.cause !== undefined ? { cause: opts.cause } : undefined)\n this.code = opts.code\n this.meta = opts.meta\n this.ext = opts.ext\n }\n\n /**\n * The canonical envelope view of this error. Use when crossing the wire\n * boundary or feeding telemetry — exposes the shape consumers can rely on\n * without depending on the class identity.\n */\n get envelope(): TheoErrorEnvelope<TExt> {\n return {\n code: this.code,\n message: this.message,\n cause: (this as Error & { cause?: unknown }).cause,\n meta: this.meta,\n ext: this.ext,\n }\n }\n\n /**\n * JSON serialization — emits envelope shape only (no name/stack class\n * internals). Per ADR D5, `meta.stack` is auto-stripped in non-dev to\n * prevent accidental leak; other meta keys are preserved.\n */\n toJSON(): TheoErrorEnvelope<TExt> {\n const meta = this.meta ? sanitizeMeta(this.meta) : undefined\n return {\n code: this.code,\n message: this.message,\n cause: (this as Error & { cause?: unknown }).cause,\n meta,\n ext: this.ext,\n }\n }\n}\n\n/**\n * Strip server-only sensitive meta keys in non-dev builds. Per ADR D5,\n * `stack` is the canonical leak vector (trpc accidentally exposes it via\n * `config.isDev` even today — references/trpc getErrorShape.ts:29-31).\n * Default to safe-by-default; preserve in dev only.\n */\nfunction sanitizeMeta(meta: Record<string, unknown>): Record<string, unknown> | undefined {\n // Treat anything other than NODE_ENV === 'development' as production-safe\n // (CI, staging, production all strip). Matches the security posture in\n // blueprint EC-5 (default STRICT).\n if (process.env.NODE_ENV === 'development') {\n return meta\n }\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(meta)) {\n if (k === 'stack') continue\n out[k] = v\n }\n return out\n}\n\n/**\n * Coerce any unknown value into a TheoError envelope.\n *\n * - If value is already a TheoError, returns it unchanged (no double-wrap).\n * - If value is a plain Error, wraps it as `INTERNAL_SERVER_ERROR` with\n * `cause` chain preserving the original.\n * - Other values (string, undefined, object) are coerced safely with a\n * meaningful message.\n *\n * Use at framework boundaries (route handler catch-all, middleware catch,\n * SDK egress) to ensure every error crossing the wire carries an envelope.\n */\nexport function fromUnknown(value: unknown): TheoError {\n if (value instanceof TheoError) return value\n if (value instanceof Error) {\n return new TheoError({\n code: 'INTERNAL_SERVER_ERROR',\n message: value.message,\n cause: value,\n })\n }\n if (typeof value === 'string') {\n return new TheoError({ code: 'INTERNAL_SERVER_ERROR', message: value })\n }\n if (value === undefined || value === null) {\n return new TheoError({ code: 'INTERNAL_SERVER_ERROR', message: 'Unknown error' })\n }\n // Object / number / boolean / etc. — best-effort stringify\n return new TheoError({\n code: 'INTERNAL_SERVER_ERROR',\n message: `Non-Error value thrown: ${safeStringify(value)}`,\n cause: value,\n })\n}\n\n/**\n * Best-effort stringify of an unknown value for error message context.\n * JSON.stringify first (preserves shape for diagnostics); on cycle/BigInt/symbol\n * failure, signal explicitly instead of falling back to `[object Object]`.\n */\nfunction safeStringify(value: unknown): string {\n if (typeof value === 'string') return value\n if (typeof value === 'number' || typeof value === 'boolean') return String(value)\n if (typeof value === 'bigint') return `${value.toString()}n`\n if (typeof value === 'symbol') return value.toString()\n try {\n return JSON.stringify(value)\n } catch {\n return '[unstringifiable value]'\n }\n}\n","/**\n * G5 T2.5 — server-side boundary translation per blueprint ADR D3.\n *\n * Translates ad-hoc Error class instances (FileTooLargeError,\n * AuthRequiredError, RouterConventionError, etc.) into the canonical\n * `TheoErrorEnvelope` shape at the wire boundary. This is the SINGLE\n * boundary translation point — class identities stay in place inside the\n * codebase (no invasive call-site rewrites), but the envelope is what\n * crosses to clients.\n *\n * Pure; no I/O. Lives in `core/contracts/` per architecture.md v3\n * invariant #3 (canonical home for shared client↔server types). This file\n * is the EXCEPTION-of-an-exception: it intentionally inspects Error names\n * by string instead of `instanceof` to avoid `core/contracts/` taking a\n * dependency on `server/`. The mapping table is small and grep-discoverable.\n */\n\nimport type { TheoErrorCode, TheoErrorEnvelope } from './error-envelope.js'\nimport { TheoError } from './theo-error.js'\n\n/**\n * Mapping from ad-hoc Error class name to envelope code. Add entries here\n * when a new ad-hoc Error is introduced anywhere in `theokit/server/`.\n * Build-time errors (Duplicate*, ActionScanError, InvalidPluginShapeError)\n * are NOT in this table by design — they never cross the wire boundary,\n * so their canonical shape is `INTERNAL_SERVER_ERROR` via the default branch.\n */\nconst ERROR_NAME_TO_CODE: ReadonlyMap<string, TheoErrorCode> = new Map<string, TheoErrorCode>([\n ['AuthRequiredError', 'UNAUTHORIZED'],\n ['FileTooLargeError', 'PAYLOAD_TOO_LARGE'],\n ['RequestBodyTooLargeError', 'PAYLOAD_TOO_LARGE'],\n ['BodyTooLargeError', 'PAYLOAD_TOO_LARGE'],\n // RouterConventionError reaches the wire only during dev-error overlay;\n // INTERNAL_SERVER_ERROR is appropriate, but we add a HintExt-shaped ext\n // with the migration guidance for the devtools display.\n ['RouterConventionError', 'INTERNAL_SERVER_ERROR'],\n])\n\ntype MetaExtractor = (err: Error) => Record<string, unknown> | null\n\n/**\n * Class-specific metadata extractors. Each function receives the raw Error\n * and returns an object merged into envelope.meta (excluding name/message\n * which are reserved).\n */\nconst META_EXTRACTORS: ReadonlyMap<string, MetaExtractor> = new Map<string, MetaExtractor>([\n [\n 'FileTooLargeError',\n (err) => {\n const e = err as Error & { truncatedFilenames?: string[]; maxFileSize?: number }\n return {\n truncatedFilenames: e.truncatedFilenames ?? [],\n maxFileSize: e.maxFileSize,\n }\n },\n ],\n [\n 'RouterConventionError',\n (err) => {\n const e = err as Error & { file?: string; suggestion?: string; migrationUrl?: string }\n return {\n file: e.file,\n suggestion: e.suggestion,\n migrationUrl: e.migrationUrl,\n }\n },\n ],\n])\n\ntype ExtBuilder = (err: Error) => unknown\n\n/**\n * Class-specific ext (extension slot) builders. RouterConventionError ships a\n * HintExt-shaped `{ hint }` so devtools / dev overlay can render the actionable\n * migration tip directly.\n */\nconst EXT_BUILDERS: ReadonlyMap<string, ExtBuilder> = new Map<string, ExtBuilder>([\n [\n 'RouterConventionError',\n () => ({\n hint: 'Run `theokit migrate router` to convert dotted-basename routes to directory-nested form.',\n }),\n ],\n])\n\n/**\n * Translate any server-side Error instance into a canonical envelope.\n *\n * Pass-through behavior:\n * - `TheoError` instances return their `.envelope` unchanged.\n * - Plain `Error` with unknown name → `INTERNAL_SERVER_ERROR`.\n * - Non-Error values → wrapped via `TheoError.fromUnknown` semantics.\n *\n * Meta carries the source class `name` plus class-specific fields when an\n * extractor is registered. This keeps wire-side telemetry useful without\n * leaking implementation details.\n */\nexport function serverErrorToEnvelope(value: unknown): TheoErrorEnvelope {\n if (value instanceof TheoError) {\n return value.envelope\n }\n if (!(value instanceof Error)) {\n return {\n code: 'INTERNAL_SERVER_ERROR',\n message: typeof value === 'string' ? value : 'Unknown error',\n }\n }\n const name = value.name\n const code = ERROR_NAME_TO_CODE.get(name) ?? 'INTERNAL_SERVER_ERROR'\n const extractor = META_EXTRACTORS.get(name)\n const extra = extractor ? extractor(value) : null\n const meta: Record<string, unknown> = { name }\n if (extra) {\n for (const [k, v] of Object.entries(extra)) {\n if (v !== undefined) meta[k] = v\n }\n }\n const extBuilder = EXT_BUILDERS.get(name)\n const ext = extBuilder ? extBuilder(value) : undefined\n return {\n code,\n message: value.message,\n cause: (value as Error & { cause?: unknown }).cause,\n meta,\n ext,\n }\n}\n"],"mappings":"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","names":[]}
File without changes
@@ -0,0 +1,142 @@
1
+ #!/usr/bin/env node
2
+ import "tsx/esm";
3
+ import "./chunk-KT3MWNZG.js";
4
+
5
+ // src/cli/commands/migrate/services-json.ts
6
+ import { existsSync, readFileSync, writeFileSync } from "fs";
7
+ import { basename, join, resolve } from "path";
8
+ function isDns1123(s) {
9
+ if (s.length === 0 || s.length > 63) return false;
10
+ for (let i = 0; i < s.length; i += 1) {
11
+ const c = s.charCodeAt(i);
12
+ const isLower = c >= 97 && c <= 122;
13
+ const isDigit = c >= 48 && c <= 57;
14
+ const isHyphen = c === 45;
15
+ if (!(isLower || isDigit || isHyphen)) return false;
16
+ if (i === 0 && isHyphen) return false;
17
+ if (i === s.length - 1 && isHyphen) return false;
18
+ }
19
+ return true;
20
+ }
21
+ function slugify(input) {
22
+ const lowered = input.toLowerCase();
23
+ let result = "";
24
+ let lastWasHyphen = false;
25
+ for (let i = 0; i < lowered.length; i += 1) {
26
+ const ch = lowered.charAt(i);
27
+ const code = lowered.charCodeAt(i);
28
+ const isLower = code >= 97 && code <= 122;
29
+ const isDigit = code >= 48 && code <= 57;
30
+ if (isLower || isDigit) {
31
+ result += ch;
32
+ lastWasHyphen = false;
33
+ continue;
34
+ }
35
+ if ((ch === "-" || ch === "_") && !lastWasHyphen && result.length > 0) {
36
+ result += "-";
37
+ lastWasHyphen = true;
38
+ }
39
+ }
40
+ while (result.endsWith("-")) result = result.slice(0, -1);
41
+ return result.slice(0, 63);
42
+ }
43
+ function configDeclaresName(source) {
44
+ const start = source.indexOf("defineConfig(");
45
+ if (start < 0) return false;
46
+ return /\bname\s*:\s*['"]/u.test(source.slice(start));
47
+ }
48
+ function injectName(source, projectName) {
49
+ if (configDeclaresName(source)) return source;
50
+ return source.replace(/(defineConfig\(\s*\{)([\s\S])/u, (_match, head, next) => {
51
+ const nl = next === "\n" || next === "\r" ? next : "\n";
52
+ return `${head}
53
+ name: '${projectName}',${nl === "\n" ? "" : nl}`;
54
+ });
55
+ }
56
+ function fromPackageJson(pkgPath) {
57
+ if (!existsSync(pkgPath)) return null;
58
+ try {
59
+ const pkg = JSON.parse(readFileSync(pkgPath, "utf-8"));
60
+ if (typeof pkg.name !== "string" || pkg.name.length === 0) return null;
61
+ const candidate = slugify(pkg.name);
62
+ return isDns1123(candidate) ? { projectName: candidate, source: "package-json" } : null;
63
+ } catch {
64
+ return null;
65
+ }
66
+ }
67
+ function fromDirectoryBasename(cwd) {
68
+ const candidate = slugify(basename(resolve(cwd)));
69
+ return isDns1123(candidate) ? { projectName: candidate, source: "directory" } : null;
70
+ }
71
+ function resolveProjectName(opts, cwd, pkgPath) {
72
+ if (opts.name !== void 0 && opts.name.length > 0) {
73
+ return { projectName: opts.name, source: "flag" };
74
+ }
75
+ return fromPackageJson(pkgPath) ?? fromDirectoryBasename(cwd) ?? {
76
+ projectName: "services-bundle",
77
+ source: "fallback"
78
+ };
79
+ }
80
+ function planServicesJsonMigration(opts) {
81
+ const cwd = opts.cwd ?? process.cwd();
82
+ const configPath = opts.configPath ?? join(cwd, "theo.config.ts");
83
+ const pkgPath = opts.pkgPath ?? join(cwd, "package.json");
84
+ const configSource = existsSync(configPath) ? readFileSync(configPath, "utf-8") : "";
85
+ const alreadyMigrated = configSource.length > 0 ? configDeclaresName(configSource) : false;
86
+ const resolution = resolveProjectName(opts, cwd, pkgPath);
87
+ const warning = resolution.source === "fallback" ? "Using fallback project name `services-bundle`. This preserves the Gitea repo lineage shipped by Plan B v3.1 (zero downtime). To adopt a new project name, re-run with `--name <slug>` and coordinate the ArgoCD App rewire." : "";
88
+ if (!isDns1123(resolution.projectName)) {
89
+ throw new Error(
90
+ `services-json migrate: resolved project name "${resolution.projectName}" is not DNS-1123 (1-63 chars, lowercase alphanumeric+hyphens, no leading/trailing hyphen). Re-run with --name <slug>.`
91
+ );
92
+ }
93
+ return {
94
+ projectName: resolution.projectName,
95
+ source: resolution.source,
96
+ alreadyMigrated,
97
+ warning
98
+ };
99
+ }
100
+ function servicesJsonMigrateCommand(opts) {
101
+ const cwd = opts.cwd ?? process.cwd();
102
+ const configPath = opts.configPath ?? join(cwd, "theo.config.ts");
103
+ const log = (m) => {
104
+ if (opts.silent === true) return;
105
+ process.stdout.write(`${m}
106
+ `);
107
+ };
108
+ if (!existsSync(configPath)) {
109
+ return Promise.reject(
110
+ new Error(`services-json migrate: ${configPath} not found. Run from a TheoKit project root.`)
111
+ );
112
+ }
113
+ const plan = planServicesJsonMigration(opts);
114
+ log(` \u2022 Resolved project name: '${plan.projectName}' (source: ${plan.source})`);
115
+ if (plan.warning.length > 0) log(` \u26A0 ${plan.warning}`);
116
+ if (plan.alreadyMigrated) {
117
+ log(" \u2713 theo.config.ts already declares `name` \u2014 nothing to do (idempotent).");
118
+ return Promise.resolve();
119
+ }
120
+ if (opts.dryRun === true) {
121
+ log(" \u2022 Dry-run: would inject `name` into theo.config.ts (no write).");
122
+ return Promise.resolve();
123
+ }
124
+ const before = readFileSync(configPath, "utf-8");
125
+ const after = injectName(before, plan.projectName);
126
+ if (after === before) {
127
+ log(" \u26A0 Could not locate `defineConfig({ ... })` block. Add `name: '<slug>',` manually.");
128
+ return Promise.resolve();
129
+ }
130
+ writeFileSync(configPath, after, "utf-8");
131
+ log(` \u2713 Injected name='${plan.projectName}' into theo.config.ts`);
132
+ log(" \u2022 Next: re-run `theokit build --target theo-cloud` to emit services.json v2.");
133
+ return Promise.resolve();
134
+ }
135
+ export {
136
+ configDeclaresName,
137
+ injectName,
138
+ planServicesJsonMigration,
139
+ servicesJsonMigrateCommand,
140
+ slugify
141
+ };
142
+ //# sourceMappingURL=services-json-Z2QNGVPW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/cli/commands/migrate/services-json.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Build-time codemod: paths are derived from `<cwd>/theo.config.ts` (or\n * the supplied `--config` arg). No HTTP input reaches these fs calls.\n */\n/**\n * Plan v1.2 T2.3 + EC-2 — `theokit migrate services-json-v1-to-v2`.\n *\n * Idempotent codemod that injects a top-level `name` field into\n * `theo.config.ts` (and refreshes `.theo/services.json` if a build artifact\n * exists). When the resolved `name` would be `services-bundle`, the codemod\n * emits an actionable warning so the operator can decide between:\n * a) keeping `services-bundle` (zero-downtime — preserves the Gitea repo\n * lineage shipped by Plan B v3.1); or\n * b) renaming to a new project — requires ArgoCD App rewire downtime.\n *\n * Inputs (in order of precedence):\n * 1) explicit `--name <slug>` CLI argument\n * 2) `package.json` `name` field (slugified to DNS-1123)\n * 3) directory basename\n * 4) `services-bundle` fallback with a warning\n */\nimport { existsSync, readFileSync, writeFileSync } from 'node:fs'\nimport { basename, join, resolve } from 'node:path'\n\nexport interface ServicesJsonMigrateOptions {\n /** Override theo.config.ts path. Defaults to `<cwd>/theo.config.ts`. */\n configPath?: string\n /** Override package.json path. Defaults to `<cwd>/package.json`. */\n pkgPath?: string\n /** Explicit project name. When set, bypasses package.json / dir-basename. */\n name?: string\n /** When true, prints the plan but performs no writes. */\n dryRun?: boolean\n /** When true, suppresses stdout (used in tests). */\n silent?: boolean\n /** When set, treats this as the working directory (defaults to process.cwd). */\n cwd?: string\n}\n\nexport interface ServicesJsonMigratePlan {\n /** The DNS-1123 project name that will land in theo.config.ts. */\n projectName: string\n /** Reason describing where the name came from. */\n source: 'flag' | 'package-json' | 'directory' | 'fallback'\n /** Whether `theo.config.ts` already declared `name`. */\n alreadyMigrated: boolean\n /** Warning string when projectName=services-bundle. Empty otherwise. */\n warning: string\n}\n\n// Canonical DNS-1123 anchor. Equivalent to ^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$\n// but split into explicit single-char anchors so neither security/detect-\n// unsafe-regex nor sonarjs/slow-regex flag it (linear scan, no backtracking\n// hot paths over arbitrary input).\nfunction isDns1123(s: string): boolean {\n if (s.length === 0 || s.length > 63) return false\n for (let i = 0; i < s.length; i += 1) {\n const c = s.charCodeAt(i)\n const isLower = c >= 0x61 && c <= 0x7a\n const isDigit = c >= 0x30 && c <= 0x39\n const isHyphen = c === 0x2d\n if (!(isLower || isDigit || isHyphen)) return false\n if (i === 0 && isHyphen) return false\n if (i === s.length - 1 && isHyphen) return false\n }\n return true\n}\n\n/**\n * Best-effort slugifier: lowercases, replaces underscores with hyphens,\n * drops invalid characters, collapses repeated hyphens, trims leading /\n * trailing hyphens. Returns empty string when nothing survives.\n */\nexport function slugify(input: string): string {\n const lowered = input.toLowerCase()\n let result = ''\n let lastWasHyphen = false\n for (let i = 0; i < lowered.length; i += 1) {\n const ch = lowered.charAt(i)\n const code = lowered.charCodeAt(i)\n const isLower = code >= 0x61 && code <= 0x7a\n const isDigit = code >= 0x30 && code <= 0x39\n if (isLower || isDigit) {\n result += ch\n lastWasHyphen = false\n continue\n }\n if ((ch === '-' || ch === '_') && !lastWasHyphen && result.length > 0) {\n result += '-'\n lastWasHyphen = true\n }\n }\n while (result.endsWith('-')) result = result.slice(0, -1)\n return result.slice(0, 63)\n}\n\n/** Returns `true` when `theo.config.ts` source already declares `name: …`. */\nexport function configDeclaresName(source: string): boolean {\n // Linear scan instead of `[\\s\\S]*?` lookahead so sonarjs/slow-regex\n // stays clean (no super-linear backtracking). We anchor on `defineConfig(`\n // then walk forward looking for `name:` inside the literal block.\n const start = source.indexOf('defineConfig(')\n if (start < 0) return false\n return /\\bname\\s*:\\s*['\"]/u.test(source.slice(start))\n}\n\n/**\n * Inject `name: <project>,` into the first `defineConfig({ ... })` call.\n * Idempotent: when the config already declares `name`, returns the source\n * untouched.\n */\nexport function injectName(source: string, projectName: string): string {\n if (configDeclaresName(source)) return source\n return source.replace(/(defineConfig\\(\\s*\\{)([\\s\\S])/u, (_match, head: string, next: string) => {\n // Preserve existing whitespace style by sniffing the next character.\n const nl = next === '\\n' || next === '\\r' ? next : '\\n'\n return `${head}\\n name: '${projectName}',${nl === '\\n' ? '' : nl}`\n })\n}\n\ninterface CandidateResolution {\n projectName: string\n source: ServicesJsonMigratePlan['source']\n}\n\nfunction fromPackageJson(pkgPath: string): CandidateResolution | null {\n if (!existsSync(pkgPath)) return null\n try {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8')) as { name?: string }\n if (typeof pkg.name !== 'string' || pkg.name.length === 0) return null\n const candidate = slugify(pkg.name)\n return isDns1123(candidate) ? { projectName: candidate, source: 'package-json' } : null\n } catch {\n return null\n }\n}\n\nfunction fromDirectoryBasename(cwd: string): CandidateResolution | null {\n const candidate = slugify(basename(resolve(cwd)))\n return isDns1123(candidate) ? { projectName: candidate, source: 'directory' } : null\n}\n\nfunction resolveProjectName(\n opts: ServicesJsonMigrateOptions,\n cwd: string,\n pkgPath: string,\n): CandidateResolution {\n if (opts.name !== undefined && opts.name.length > 0) {\n return { projectName: opts.name, source: 'flag' }\n }\n return (\n fromPackageJson(pkgPath) ??\n fromDirectoryBasename(cwd) ?? {\n projectName: 'services-bundle',\n source: 'fallback',\n }\n )\n}\n\nexport function planServicesJsonMigration(\n opts: ServicesJsonMigrateOptions,\n): ServicesJsonMigratePlan {\n const cwd = opts.cwd ?? process.cwd()\n const configPath = opts.configPath ?? join(cwd, 'theo.config.ts')\n const pkgPath = opts.pkgPath ?? join(cwd, 'package.json')\n\n const configSource = existsSync(configPath) ? readFileSync(configPath, 'utf-8') : ''\n const alreadyMigrated = configSource.length > 0 ? configDeclaresName(configSource) : false\n\n const resolution = resolveProjectName(opts, cwd, pkgPath)\n const warning =\n resolution.source === 'fallback'\n ? 'Using fallback project name `services-bundle`. This preserves the Gitea ' +\n 'repo lineage shipped by Plan B v3.1 (zero downtime). To adopt a new project ' +\n 'name, re-run with `--name <slug>` and coordinate the ArgoCD App rewire.'\n : ''\n\n if (!isDns1123(resolution.projectName)) {\n throw new Error(\n `services-json migrate: resolved project name \"${resolution.projectName}\" is not DNS-1123 ` +\n '(1-63 chars, lowercase alphanumeric+hyphens, no leading/trailing hyphen). Re-run with --name <slug>.',\n )\n }\n\n return {\n projectName: resolution.projectName,\n source: resolution.source,\n alreadyMigrated,\n warning,\n }\n}\n\n// Returns void; not async — kept Promise-bearing via the CLI dispatcher's\n// `await` site by wrapping into Promise.resolve(...) on the call boundary.\nexport function servicesJsonMigrateCommand(opts: ServicesJsonMigrateOptions): Promise<void> {\n const cwd = opts.cwd ?? process.cwd()\n const configPath = opts.configPath ?? join(cwd, 'theo.config.ts')\n const log = (m: string): void => {\n if (opts.silent === true) return\n process.stdout.write(`${m}\\n`)\n }\n\n if (!existsSync(configPath)) {\n return Promise.reject(\n new Error(`services-json migrate: ${configPath} not found. Run from a TheoKit project root.`),\n )\n }\n\n const plan = planServicesJsonMigration(opts)\n log(` • Resolved project name: '${plan.projectName}' (source: ${plan.source})`)\n if (plan.warning.length > 0) log(` ⚠ ${plan.warning}`)\n\n if (plan.alreadyMigrated) {\n log(' ✓ theo.config.ts already declares `name` — nothing to do (idempotent).')\n return Promise.resolve()\n }\n\n if (opts.dryRun === true) {\n log(' • Dry-run: would inject `name` into theo.config.ts (no write).')\n return Promise.resolve()\n }\n\n const before = readFileSync(configPath, 'utf-8')\n const after = injectName(before, plan.projectName)\n if (after === before) {\n log(\" ⚠ Could not locate `defineConfig({ ... })` block. Add `name: '<slug>',` manually.\")\n return Promise.resolve()\n }\n writeFileSync(configPath, after, 'utf-8')\n log(` ✓ Injected name='${plan.projectName}' into theo.config.ts`)\n log(' • Next: re-run `theokit build --target theo-cloud` to emit services.json v2.')\n return Promise.resolve()\n}\n"],"mappings":"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","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  generateTypedClient
3
- } from "./chunk-O4BLVPML.js";
3
+ } from "./chunk-DNMSV3R3.js";
4
4
  import "./chunk-DGUM43GV.js";
5
5
 
6
6
  // src/vite-plugin/services-typed-client.ts
@@ -43,4 +43,4 @@ function servicesTypedClientPlugin(opts) {
43
43
  export {
44
44
  servicesTypedClientPlugin
45
45
  };
46
- //# sourceMappingURL=services-typed-client-XWYYBWGW.js.map
46
+ //# sourceMappingURL=services-typed-client-KK6RHRDG.js.map
@@ -2,7 +2,7 @@
2
2
  import "tsx/esm";
3
3
  import {
4
4
  generateTypedClient
5
- } from "./chunk-WZ7CPVQB.js";
5
+ } from "./chunk-27LWMYNK.js";
6
6
  import "./chunk-KT3MWNZG.js";
7
7
 
8
8
  // src/vite-plugin/services-typed-client.ts
@@ -45,4 +45,4 @@ function servicesTypedClientPlugin(opts) {
45
45
  export {
46
46
  servicesTypedClientPlugin
47
47
  };
48
- //# sourceMappingURL=services-typed-client-ZX5JUHH3.js.map
48
+ //# sourceMappingURL=services-typed-client-T7M5VPBP.js.map
@@ -2,7 +2,7 @@
2
2
  import "tsx/esm";
3
3
  import "./chunk-KT3MWNZG.js";
4
4
 
5
- // ../../../theokit-plugins/node_modules/.pnpm/sqlite-vec@0.1.9/node_modules/sqlite-vec/index.mjs
5
+ // ../../node_modules/.pnpm/sqlite-vec@0.1.9/node_modules/sqlite-vec/index.mjs
6
6
  import { fileURLToPath } from "url";
7
7
  import { arch, platform } from "process";
8
8
  var BASE_PACKAGE_NAME = "sqlite-vec";
@@ -38,4 +38,4 @@ export {
38
38
  getLoadablePath,
39
39
  load
40
40
  };
41
- //# sourceMappingURL=sqlite-vec-ARPNUBWT.js.map
41
+ //# sourceMappingURL=sqlite-vec-54KB4RD3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../node_modules/.pnpm/sqlite-vec@0.1.9/node_modules/sqlite-vec/index.mjs"],"sourcesContent":["\n\nimport { fileURLToPath } from \"node:url\";\nimport { arch, platform } from \"node:process\";\n\n\nconst BASE_PACKAGE_NAME = \"sqlite-vec\";\nconst ENTRYPOINT_BASE_NAME = \"vec0\";\nconst supportedPlatforms = [[\"darwin\",\"x64\"],[\"linux\",\"x64\"],[\"darwin\",\"arm64\"],[\"win32\",\"x64\"],[\"linux\",\"arm64\"]];\n\nconst invalidPlatformErrorMessage = `Unsupported platform for ${BASE_PACKAGE_NAME}, on a ${platform}-${arch} machine. Supported platforms are (${supportedPlatforms\n .map(([p, a]) => `${p}-${a}`)\n .join(\",\")}). Consult the ${BASE_PACKAGE_NAME} NPM package README for details.`;\n\nconst extensionNotFoundErrorMessage = packageName => `Loadble extension for ${BASE_PACKAGE_NAME} not found. Was the ${packageName} package installed?`;\n\nfunction validPlatform(platform, arch) {\n return (\n supportedPlatforms.find(([p, a]) => platform === p && arch === a) !== undefined\n );\n}\nfunction extensionSuffix(platform) {\n if (platform === \"win32\") return \"dll\";\n if (platform === \"darwin\") return \"dylib\";\n return \"so\";\n}\nfunction platformPackageName(platform, arch) {\n const os = platform === \"win32\" ? \"windows\" : platform;\n return `${BASE_PACKAGE_NAME}-${os}-${arch}`;\n}\n\nfunction getLoadablePath() {\n if (!validPlatform(platform, arch)) {\n throw new Error(\n invalidPlatformErrorMessage\n );\n }\n const packageName = platformPackageName(platform, arch);\n const loadablePath = fileURLToPath(import.meta.resolve(packageName + \"/\" + ENTRYPOINT_BASE_NAME + \".\" + extensionSuffix(platform)));\n return loadablePath;\n}\n\nfunction load(db) {\n db.loadExtension(getLoadablePath());\n}\n\nexport {getLoadablePath, load};\n"],"mappings":";;;;;AAEA,SAAS,qBAAqB;AAC9B,SAAS,MAAM,gBAAgB;AAG/B,IAAM,oBAAoB;AAC1B,IAAM,uBAAuB;AAC7B,IAAM,qBAAqB,CAAC,CAAC,UAAS,KAAK,GAAE,CAAC,SAAQ,KAAK,GAAE,CAAC,UAAS,OAAO,GAAE,CAAC,SAAQ,KAAK,GAAE,CAAC,SAAQ,OAAO,CAAC;AAEjH,IAAM,8BAA8B,4BAA4B,iBAAiB,UAAU,QAAQ,IAAI,IAAI,sCAAsC,mBAC9I,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,EAC3B,KAAK,GAAG,CAAC,kBAAkB,iBAAiB;AAI/C,SAAS,cAAcA,WAAUC,OAAM;AACrC,SACE,mBAAmB,KAAK,CAAC,CAAC,GAAG,CAAC,MAAMD,cAAa,KAAKC,UAAS,CAAC,MAAM;AAE1E;AACA,SAAS,gBAAgBD,WAAU;AACjC,MAAIA,cAAa,QAAS,QAAO;AACjC,MAAIA,cAAa,SAAU,QAAO;AAClC,SAAO;AACT;AACA,SAAS,oBAAoBA,WAAUC,OAAM;AAC3C,QAAM,KAAKD,cAAa,UAAU,YAAYA;AAC9C,SAAO,GAAG,iBAAiB,IAAI,EAAE,IAAIC,KAAI;AAC3C;AAEA,SAAS,kBAAkB;AACzB,MAAI,CAAC,cAAc,UAAU,IAAI,GAAG;AAClC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,QAAM,cAAc,oBAAoB,UAAU,IAAI;AACtD,QAAM,eAAe,cAAc,YAAY,QAAQ,cAAc,MAAM,uBAAuB,MAAM,gBAAgB,QAAQ,CAAC,CAAC;AAClI,SAAO;AACT;AAEA,SAAS,KAAK,IAAI;AAChB,KAAG,cAAc,gBAAgB,CAAC;AACpC;","names":["platform","arch"]}