gemi 0.116.0 → 0.117.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 (331) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai/index.js.map +1 -1
  3. package/dist/app/index.js +2 -2
  4. package/dist/app/index.js.map +1 -1
  5. package/dist/auth/AuthServiceProvider.d.ts.map +1 -1
  6. package/dist/auth/config.d.ts +27 -0
  7. package/dist/auth/config.d.ts.map +1 -1
  8. package/dist/auth/connections/ConnectionManager.d.ts +133 -0
  9. package/dist/auth/connections/ConnectionManager.d.ts.map +1 -0
  10. package/dist/auth/connections/ConnectionStore.d.ts +146 -0
  11. package/dist/auth/connections/ConnectionStore.d.ts.map +1 -0
  12. package/dist/auth/connections/ConnectionsController.d.ts +23 -0
  13. package/dist/auth/connections/ConnectionsController.d.ts.map +1 -0
  14. package/dist/auth/connections/OAuthConnectionProvider.d.ts +105 -0
  15. package/dist/auth/connections/OAuthConnectionProvider.d.ts.map +1 -0
  16. package/dist/auth/connections/errors.d.ts +32 -0
  17. package/dist/auth/connections/errors.d.ts.map +1 -0
  18. package/dist/auth/oauth/oauthState.d.ts +15 -2
  19. package/dist/auth/oauth/oauthState.d.ts.map +1 -1
  20. package/dist/auth/routes.d.ts +13 -0
  21. package/dist/auth/routes.d.ts.map +1 -1
  22. package/dist/bin/orm/emit.d.ts.map +1 -1
  23. package/dist/bin/orm-generator.js +51 -4
  24. package/dist/bin/orm-generator.js.map +4 -4
  25. package/dist/bun/plugin.js +2 -2
  26. package/dist/bun/plugin.js.map +1 -1
  27. package/dist/bun/preload.js +2 -2
  28. package/dist/bun/preload.js.map +1 -1
  29. package/dist/chunk-00n3gwr8.js +71 -0
  30. package/dist/chunk-00n3gwr8.js.map +13 -0
  31. package/dist/{chunk-t4yh4nf9.js → chunk-076jezzg.js} +3 -3
  32. package/dist/{chunk-t4yh4nf9.js.map → chunk-076jezzg.js.map} +1 -1
  33. package/dist/{chunk-qjhw8nje.js → chunk-077rea02.js} +1 -1
  34. package/dist/{chunk-6cx8ncd4.js → chunk-1ckha5dt.js} +3 -3
  35. package/dist/{chunk-6cx8ncd4.js.map → chunk-1ckha5dt.js.map} +1 -1
  36. package/dist/{chunk-mschc94q.js → chunk-1zzd39qg.js} +2 -2
  37. package/dist/{chunk-mschc94q.js.map → chunk-1zzd39qg.js.map} +1 -1
  38. package/dist/{chunk-5stgtwqw.js → chunk-2bja99cq.js} +2 -2
  39. package/dist/{chunk-5stgtwqw.js.map → chunk-2bja99cq.js.map} +1 -1
  40. package/dist/chunk-2czfefn2.js +10 -0
  41. package/dist/{chunk-yf1njzd5.js.map → chunk-2czfefn2.js.map} +5 -4
  42. package/dist/{chunk-aazmrxj9.js → chunk-37pk2cjg.js} +2 -2
  43. package/dist/{chunk-aazmrxj9.js.map → chunk-37pk2cjg.js.map} +1 -1
  44. package/dist/{chunk-qsrcdzan.js → chunk-3w4hk6q2.js} +3 -3
  45. package/dist/{chunk-qsrcdzan.js.map → chunk-3w4hk6q2.js.map} +1 -1
  46. package/dist/chunk-51w202vr.js +5 -0
  47. package/dist/{chunk-whtzggn6.js.map → chunk-51w202vr.js.map} +3 -4
  48. package/dist/{chunk-4088szy9.js → chunk-5m8vvtvn.js} +3 -3
  49. package/dist/{chunk-4088szy9.js.map → chunk-5m8vvtvn.js.map} +1 -1
  50. package/dist/{chunk-6d8rvr1v.js → chunk-5p4z1fgc.js} +2 -2
  51. package/dist/{chunk-6d8rvr1v.js.map → chunk-5p4z1fgc.js.map} +1 -1
  52. package/dist/{chunk-kejwjerj.js → chunk-5w6kyxsj.js} +2 -2
  53. package/dist/{chunk-kejwjerj.js.map → chunk-5w6kyxsj.js.map} +1 -1
  54. package/dist/{chunk-pyk3gzvc.js → chunk-62jw0vsf.js} +2 -2
  55. package/dist/{chunk-pyk3gzvc.js.map → chunk-62jw0vsf.js.map} +1 -1
  56. package/dist/chunk-63ewmmhc.js +5 -0
  57. package/dist/{chunk-1q9kd20m.js.map → chunk-63ewmmhc.js.map} +1 -1
  58. package/dist/{chunk-p1aqq0ga.js → chunk-6ggmk2eg.js} +3 -3
  59. package/dist/{chunk-p1aqq0ga.js.map → chunk-6ggmk2eg.js.map} +1 -1
  60. package/dist/{chunk-2tzm58j3.js → chunk-6y4nk9f1.js} +2 -2
  61. package/dist/{chunk-2tzm58j3.js.map → chunk-6y4nk9f1.js.map} +1 -1
  62. package/dist/{chunk-1hr4xht1.js → chunk-8gtc3s1y.js} +2 -2
  63. package/dist/{chunk-1hr4xht1.js.map → chunk-8gtc3s1y.js.map} +1 -1
  64. package/dist/{chunk-frerzsxq.js → chunk-a22h5cby.js} +2 -2
  65. package/dist/{chunk-frerzsxq.js.map → chunk-a22h5cby.js.map} +1 -1
  66. package/dist/{chunk-zyt2w03d.js → chunk-a32wfzdq.js} +2 -2
  67. package/dist/{chunk-zyt2w03d.js.map → chunk-a32wfzdq.js.map} +1 -1
  68. package/dist/{chunk-t04f3akb.js → chunk-a77586gv.js} +2 -2
  69. package/dist/{chunk-t04f3akb.js.map → chunk-a77586gv.js.map} +1 -1
  70. package/dist/chunk-a7r39713.js +5 -0
  71. package/dist/chunk-a7r39713.js.map +10 -0
  72. package/dist/{chunk-vxm6yevm.js → chunk-arwmvgrz.js} +2 -2
  73. package/dist/{chunk-vxm6yevm.js.map → chunk-arwmvgrz.js.map} +1 -1
  74. package/dist/{chunk-41da9628.js → chunk-bvqae0px.js} +1 -1
  75. package/dist/{chunk-d9mar37g.js → chunk-c2n6zdyd.js} +2 -2
  76. package/dist/{chunk-d9mar37g.js.map → chunk-c2n6zdyd.js.map} +1 -1
  77. package/dist/{chunk-56jky6vf.js → chunk-cytss9mb.js} +2 -2
  78. package/dist/{chunk-56jky6vf.js.map → chunk-cytss9mb.js.map} +1 -1
  79. package/dist/{chunk-vw8849ys.js → chunk-dcgvq79a.js} +2 -2
  80. package/dist/{chunk-m54s6jpr.js.map → chunk-dcgvq79a.js.map} +1 -1
  81. package/dist/{chunk-6chz1ktz.js → chunk-de4t48j9.js} +3 -3
  82. package/dist/{chunk-6chz1ktz.js.map → chunk-de4t48j9.js.map} +1 -1
  83. package/dist/{chunk-cbqazg9k.js → chunk-dz99g58c.js} +2 -2
  84. package/dist/{chunk-cbqazg9k.js.map → chunk-dz99g58c.js.map} +1 -1
  85. package/dist/{chunk-e573yxpq.js → chunk-e7ezmag9.js} +3 -3
  86. package/dist/{chunk-e573yxpq.js.map → chunk-e7ezmag9.js.map} +1 -1
  87. package/dist/{chunk-yer1r3t3.js → chunk-epvpmakp.js} +2 -2
  88. package/dist/{chunk-yer1r3t3.js.map → chunk-epvpmakp.js.map} +1 -1
  89. package/dist/{chunk-yhrye9cm.js → chunk-f8vcwzgd.js} +2 -2
  90. package/dist/{chunk-yhrye9cm.js.map → chunk-f8vcwzgd.js.map} +1 -1
  91. package/dist/chunk-fa37qzm3.js +5 -0
  92. package/dist/chunk-fa37qzm3.js.map +12 -0
  93. package/dist/{chunk-fxgxf16k.js → chunk-ffgmqwzy.js} +2 -2
  94. package/dist/{chunk-fxgxf16k.js.map → chunk-ffgmqwzy.js.map} +1 -1
  95. package/dist/{chunk-er3wf6ng.js → chunk-fk6nxhxn.js} +2 -2
  96. package/dist/{chunk-er3wf6ng.js.map → chunk-fk6nxhxn.js.map} +1 -1
  97. package/dist/{chunk-3hrj5rwm.js → chunk-fnwbbmnk.js} +2 -2
  98. package/dist/{chunk-3hrj5rwm.js.map → chunk-fnwbbmnk.js.map} +1 -1
  99. package/dist/chunk-g2wncay4.js +9 -0
  100. package/dist/{chunk-hytt9qyj.js.map → chunk-g2wncay4.js.map} +3 -4
  101. package/dist/{chunk-gts5p6mw.js → chunk-ge9xjwgq.js} +4 -4
  102. package/dist/{chunk-gts5p6mw.js.map → chunk-ge9xjwgq.js.map} +1 -1
  103. package/dist/{chunk-tw5kwbx4.js → chunk-gjy2qjcr.js} +2 -2
  104. package/dist/{chunk-tw5kwbx4.js.map → chunk-gjy2qjcr.js.map} +1 -1
  105. package/dist/{chunk-15c2vgaf.js → chunk-gn7kne7r.js} +2 -2
  106. package/dist/{chunk-15c2vgaf.js.map → chunk-gn7kne7r.js.map} +1 -1
  107. package/dist/{chunk-9n1hx3mq.js → chunk-hr61ekcr.js} +3 -3
  108. package/dist/{chunk-9n1hx3mq.js.map → chunk-hr61ekcr.js.map} +1 -1
  109. package/dist/{chunk-m54s6jpr.js → chunk-hvgmqt6z.js} +2 -2
  110. package/dist/{chunk-vw8849ys.js.map → chunk-hvgmqt6z.js.map} +1 -1
  111. package/dist/{chunk-aeh67ynz.js → chunk-hvpn18bb.js} +3 -3
  112. package/dist/{chunk-aeh67ynz.js.map → chunk-hvpn18bb.js.map} +1 -1
  113. package/dist/{chunk-jdhdrr2k.js → chunk-j1453bn1.js} +2 -2
  114. package/dist/{chunk-jdhdrr2k.js.map → chunk-j1453bn1.js.map} +1 -1
  115. package/dist/{chunk-tn2bryy2.js → chunk-jpetnpzn.js} +2 -2
  116. package/dist/{chunk-tn2bryy2.js.map → chunk-jpetnpzn.js.map} +1 -1
  117. package/dist/{chunk-v1tfdgy1.js → chunk-jqrs16g2.js} +3 -3
  118. package/dist/{chunk-v1tfdgy1.js.map → chunk-jqrs16g2.js.map} +1 -1
  119. package/dist/{chunk-4mfrgd5m.js → chunk-kk77x2v4.js} +2 -2
  120. package/dist/{chunk-4mfrgd5m.js.map → chunk-kk77x2v4.js.map} +1 -1
  121. package/dist/chunk-kpn7f58a.js +14 -0
  122. package/dist/{chunk-pn8v6fj2.js.map → chunk-kpn7f58a.js.map} +11 -6
  123. package/dist/chunk-mhteg4yz.js +57 -0
  124. package/dist/{chunk-ms9k0rx6.js.map → chunk-mhteg4yz.js.map} +15 -11
  125. package/dist/{chunk-n672d4g8.js → chunk-n9jyjp4a.js} +2 -2
  126. package/dist/{chunk-n672d4g8.js.map → chunk-n9jyjp4a.js.map} +1 -1
  127. package/dist/{chunk-vbdty91k.js → chunk-nb2gggba.js} +3 -3
  128. package/dist/{chunk-vbdty91k.js.map → chunk-nb2gggba.js.map} +1 -1
  129. package/dist/chunk-ntxsdchf.js +50 -0
  130. package/dist/chunk-ntxsdchf.js.map +10 -0
  131. package/dist/{chunk-2z1981d0.js → chunk-pepzecrm.js} +2 -2
  132. package/dist/{chunk-2z1981d0.js.map → chunk-pepzecrm.js.map} +1 -1
  133. package/dist/{chunk-785b41h1.js → chunk-pgy3mfxw.js} +3 -3
  134. package/dist/{chunk-785b41h1.js.map → chunk-pgy3mfxw.js.map} +1 -1
  135. package/dist/{chunk-98m15b9x.js → chunk-qhw0hej0.js} +2 -2
  136. package/dist/{chunk-98m15b9x.js.map → chunk-qhw0hej0.js.map} +1 -1
  137. package/dist/{chunk-303mprnv.js → chunk-r3v2cnrj.js} +2 -2
  138. package/dist/{chunk-303mprnv.js.map → chunk-r3v2cnrj.js.map} +1 -1
  139. package/dist/{chunk-ktr3k768.js → chunk-rhmpphhc.js} +3 -3
  140. package/dist/{chunk-ktr3k768.js.map → chunk-rhmpphhc.js.map} +1 -1
  141. package/dist/{chunk-fre6f4nk.js → chunk-s4f56035.js} +2 -2
  142. package/dist/{chunk-fre6f4nk.js.map → chunk-s4f56035.js.map} +1 -1
  143. package/dist/{chunk-sr942vb1.js → chunk-sj4f7x4p.js} +2 -2
  144. package/dist/{chunk-sr942vb1.js.map → chunk-sj4f7x4p.js.map} +1 -1
  145. package/dist/{chunk-wyw6p3fg.js → chunk-sksmnjkn.js} +3 -3
  146. package/dist/{chunk-wyw6p3fg.js.map → chunk-sksmnjkn.js.map} +1 -1
  147. package/dist/{chunk-kqxdsv22.js → chunk-stnd9qht.js} +2 -2
  148. package/dist/{chunk-kqxdsv22.js.map → chunk-stnd9qht.js.map} +1 -1
  149. package/dist/{chunk-1myhm0g3.js → chunk-t65074mw.js} +3 -3
  150. package/dist/{chunk-1myhm0g3.js.map → chunk-t65074mw.js.map} +1 -1
  151. package/dist/chunk-t87w4h84.js +24 -0
  152. package/dist/{chunk-79xg42e7.js.map → chunk-t87w4h84.js.map} +2 -2
  153. package/dist/{chunk-z10cas5r.js → chunk-thz75w6e.js} +2 -2
  154. package/dist/{chunk-z10cas5r.js.map → chunk-thz75w6e.js.map} +1 -1
  155. package/dist/{chunk-xt9tv99x.js → chunk-v8vnxkvp.js} +2 -2
  156. package/dist/{chunk-xt9tv99x.js.map → chunk-v8vnxkvp.js.map} +1 -1
  157. package/dist/{chunk-x7cpth2f.js → chunk-veq07rp8.js} +1 -1
  158. package/dist/{chunk-agyfv3f8.js → chunk-vj5necm0.js} +1 -1
  159. package/dist/{chunk-p91b8zcn.js → chunk-vtc23xpk.js} +2 -2
  160. package/dist/{chunk-p91b8zcn.js.map → chunk-vtc23xpk.js.map} +1 -1
  161. package/dist/{chunk-jmpw6bqz.js → chunk-w4e480he.js} +2 -2
  162. package/dist/{chunk-jmpw6bqz.js.map → chunk-w4e480he.js.map} +1 -1
  163. package/dist/{chunk-8rv62v14.js → chunk-wgb79ysr.js} +2 -2
  164. package/dist/{chunk-8rv62v14.js.map → chunk-wgb79ysr.js.map} +1 -1
  165. package/dist/{chunk-1vzks22y.js → chunk-wk1tp1f1.js} +2 -2
  166. package/dist/{chunk-1vzks22y.js.map → chunk-wk1tp1f1.js.map} +1 -1
  167. package/dist/{chunk-bra1a1fq.js → chunk-wwdbgshx.js} +2 -2
  168. package/dist/{chunk-bra1a1fq.js.map → chunk-wwdbgshx.js.map} +1 -1
  169. package/dist/{chunk-eqse2m6n.js → chunk-wzzrz612.js} +2 -2
  170. package/dist/{chunk-eqse2m6n.js.map → chunk-wzzrz612.js.map} +1 -1
  171. package/dist/{chunk-hdps9n52.js → chunk-x7qwx07b.js} +3 -3
  172. package/dist/{chunk-hdps9n52.js.map → chunk-x7qwx07b.js.map} +1 -1
  173. package/dist/chunk-x84as3vy.js +5 -0
  174. package/dist/chunk-x84as3vy.js.map +12 -0
  175. package/dist/chunk-y0en07zh.js +302 -0
  176. package/dist/chunk-y0en07zh.js.map +17 -0
  177. package/dist/{chunk-d2gfcf85.js → chunk-yfwrbfnw.js} +2 -2
  178. package/dist/{chunk-d2gfcf85.js.map → chunk-yfwrbfnw.js.map} +1 -1
  179. package/dist/{chunk-mazznq15.js → chunk-yhp6bvhj.js} +3 -3
  180. package/dist/{chunk-mazznq15.js.map → chunk-yhp6bvhj.js.map} +1 -1
  181. package/dist/{chunk-tzm3c7n6.js → chunk-yvtmygrk.js} +4 -4
  182. package/dist/{chunk-tzm3c7n6.js.map → chunk-yvtmygrk.js.map} +1 -1
  183. package/dist/{chunk-mqfzdfnz.js → chunk-zkjs3m5m.js} +2 -2
  184. package/dist/{chunk-mqfzdfnz.js.map → chunk-zkjs3m5m.js.map} +1 -1
  185. package/dist/chunk-zw6843j3.js +5 -0
  186. package/dist/chunk-zw6843j3.js.map +12 -0
  187. package/dist/client/Head.d.ts.map +1 -1
  188. package/dist/client/fonts.d.ts +69 -0
  189. package/dist/client/fonts.d.ts.map +1 -0
  190. package/dist/client/index.d.ts +1 -0
  191. package/dist/client/index.d.ts.map +1 -1
  192. package/dist/client/index.js +75 -1
  193. package/dist/client/index.js.map +1 -1
  194. package/dist/config/index.js +1 -1
  195. package/dist/console/builtins.d.ts +13 -0
  196. package/dist/console/builtins.d.ts.map +1 -0
  197. package/dist/console/run.js +13 -11
  198. package/dist/console/run.js.map +6 -5
  199. package/dist/console/runner.d.ts.map +1 -1
  200. package/dist/console/usage.d.ts +2 -0
  201. package/dist/console/usage.d.ts.map +1 -1
  202. package/dist/container/index.js +2 -2
  203. package/dist/container/index.js.map +1 -1
  204. package/dist/database/index.js +2 -2
  205. package/dist/database/index.js.map +1 -1
  206. package/dist/email/index.js +2 -2
  207. package/dist/email/index.js.map +1 -1
  208. package/dist/facades/Connections.d.ts +36 -0
  209. package/dist/facades/Connections.d.ts.map +1 -0
  210. package/dist/facades/Crypt.d.ts +26 -0
  211. package/dist/facades/Crypt.d.ts.map +1 -0
  212. package/dist/facades/Meta.d.ts +7 -1
  213. package/dist/facades/Meta.d.ts.map +1 -1
  214. package/dist/facades/Storage.d.ts +29 -0
  215. package/dist/facades/Storage.d.ts.map +1 -1
  216. package/dist/facades/index.d.ts +2 -0
  217. package/dist/facades/index.d.ts.map +1 -1
  218. package/dist/facades/index.js +2 -2
  219. package/dist/facades/index.js.map +1 -1
  220. package/dist/foundation/index.js +2 -2
  221. package/dist/foundation/index.js.map +1 -1
  222. package/dist/http/HttpRequest.d.ts +1 -0
  223. package/dist/http/HttpRequest.d.ts.map +1 -1
  224. package/dist/http/Metadata.d.ts +5 -0
  225. package/dist/http/Metadata.d.ts.map +1 -1
  226. package/dist/http/index.d.ts +3 -1
  227. package/dist/http/index.d.ts.map +1 -1
  228. package/dist/http/index.js +2 -2
  229. package/dist/http/index.js.map +1 -1
  230. package/dist/http/requestContext.d.ts +1 -0
  231. package/dist/http/requestContext.d.ts.map +1 -1
  232. package/dist/http/safeFetch/errors.d.ts +10 -0
  233. package/dist/http/safeFetch/errors.d.ts.map +1 -1
  234. package/dist/http/safeFetch/index.d.ts +1 -1
  235. package/dist/http/safeFetch/index.d.ts.map +1 -1
  236. package/dist/http/sitemap/Robots.d.ts +95 -0
  237. package/dist/http/sitemap/Robots.d.ts.map +1 -0
  238. package/dist/http/sitemap/Sitemap.d.ts +145 -0
  239. package/dist/http/sitemap/Sitemap.d.ts.map +1 -0
  240. package/dist/http/sitemap/fetchText.d.ts +16 -0
  241. package/dist/http/sitemap/fetchText.d.ts.map +1 -0
  242. package/dist/http/sitemap/index.d.ts +3 -0
  243. package/dist/http/sitemap/index.d.ts.map +1 -0
  244. package/dist/http/sitemap/xml.d.ts +21 -0
  245. package/dist/http/sitemap/xml.d.ts.map +1 -0
  246. package/dist/i18n/Translator.d.ts.map +1 -1
  247. package/dist/i18n/dictionaryRuntime.js +2 -2
  248. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  249. package/dist/i18n/index.d.ts +1 -1
  250. package/dist/i18n/index.d.ts.map +1 -1
  251. package/dist/i18n/index.js +2 -2
  252. package/dist/i18n/index.js.map +2 -2
  253. package/dist/i18n/resolveLocale.d.ts +18 -0
  254. package/dist/i18n/resolveLocale.d.ts.map +1 -1
  255. package/dist/kernel/index.js +3 -3
  256. package/dist/kernel/index.js.map +3 -3
  257. package/dist/kernel/providers.d.ts +2 -2
  258. package/dist/kernel/providers.d.ts.map +1 -1
  259. package/dist/orm/Model.d.ts.map +1 -1
  260. package/dist/orm/encryption-rotate.d.ts +44 -0
  261. package/dist/orm/encryption-rotate.d.ts.map +1 -0
  262. package/dist/orm/encryption.d.ts +54 -0
  263. package/dist/orm/encryption.d.ts.map +1 -0
  264. package/dist/orm/index.d.ts +2 -0
  265. package/dist/orm/index.d.ts.map +1 -1
  266. package/dist/orm/index.js +3 -3
  267. package/dist/orm/index.js.map +4 -4
  268. package/dist/orm/schema.d.ts +25 -1
  269. package/dist/orm/schema.d.ts.map +1 -1
  270. package/dist/server/index.js +2 -2
  271. package/dist/server/index.js.map +1 -1
  272. package/dist/services/encryption/Encrypter.d.ts +86 -0
  273. package/dist/services/encryption/Encrypter.d.ts.map +1 -0
  274. package/dist/services/encryption/EncryptionServiceProvider.d.ts +13 -0
  275. package/dist/services/encryption/EncryptionServiceProvider.d.ts.map +1 -0
  276. package/dist/services/encryption/config.d.ts +36 -0
  277. package/dist/services/encryption/config.d.ts.map +1 -0
  278. package/dist/services/file-storage/drivers/FileStorageDriver.d.ts +12 -1
  279. package/dist/services/file-storage/drivers/FileStorageDriver.d.ts.map +1 -1
  280. package/dist/services/file-storage/drivers/FileSystemDriver.d.ts +8 -1
  281. package/dist/services/file-storage/drivers/FileSystemDriver.d.ts.map +1 -1
  282. package/dist/services/file-storage/drivers/types.d.ts +17 -0
  283. package/dist/services/file-storage/drivers/types.d.ts.map +1 -1
  284. package/dist/services/file-storage/putFromUrl.d.ts +56 -0
  285. package/dist/services/file-storage/putFromUrl.d.ts.map +1 -0
  286. package/dist/services/file-storage/sniffContentType.d.ts +33 -0
  287. package/dist/services/file-storage/sniffContentType.d.ts.map +1 -0
  288. package/dist/services/index.d.ts +18 -4
  289. package/dist/services/index.d.ts.map +1 -1
  290. package/dist/services/index.js +10 -10
  291. package/dist/services/index.js.map +4 -3
  292. package/dist/services/queue/DatabaseQueueDriver.d.ts +96 -7
  293. package/dist/services/queue/DatabaseQueueDriver.d.ts.map +1 -1
  294. package/dist/services/queue/Job.d.ts +72 -0
  295. package/dist/services/queue/Job.d.ts.map +1 -1
  296. package/dist/services/queue/MemoryQueueDriver.d.ts +22 -2
  297. package/dist/services/queue/MemoryQueueDriver.d.ts.map +1 -1
  298. package/dist/services/queue/QueueDriver.d.ts +74 -1
  299. package/dist/services/queue/QueueDriver.d.ts.map +1 -1
  300. package/dist/services/queue/QueueManager.d.ts +47 -0
  301. package/dist/services/queue/QueueManager.d.ts.map +1 -1
  302. package/dist/services/queue/batch.d.ts +112 -0
  303. package/dist/services/queue/batch.d.ts.map +1 -0
  304. package/dist/services/queue/queueDriverContract.d.ts +5 -0
  305. package/dist/services/queue/queueDriverContract.d.ts.map +1 -1
  306. package/dist/services/queue/work.js +2 -2
  307. package/dist/services/queue/work.js.map +1 -1
  308. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  309. package/dist/stats/route-table.js +1 -1
  310. package/dist/support/index.js +2 -2
  311. package/dist/support/index.js.map +1 -1
  312. package/dist/vitest/index.js +2 -2
  313. package/dist/vitest/index.js.map +1 -1
  314. package/package.json +1 -1
  315. package/dist/chunk-1q9kd20m.js +0 -5
  316. package/dist/chunk-49nyyjfe.js +0 -5
  317. package/dist/chunk-49nyyjfe.js.map +0 -11
  318. package/dist/chunk-79xg42e7.js +0 -24
  319. package/dist/chunk-7vb4eey2.js +0 -217
  320. package/dist/chunk-7vb4eey2.js.map +0 -16
  321. package/dist/chunk-hytt9qyj.js +0 -54
  322. package/dist/chunk-jmg2zsaf.js +0 -5
  323. package/dist/chunk-jmg2zsaf.js.map +0 -12
  324. package/dist/chunk-ms9k0rx6.js +0 -46
  325. package/dist/chunk-pn8v6fj2.js +0 -14
  326. package/dist/chunk-whtzggn6.js +0 -5
  327. package/dist/chunk-yf1njzd5.js +0 -10
  328. /package/dist/{chunk-qjhw8nje.js.map → chunk-077rea02.js.map} +0 -0
  329. /package/dist/{chunk-41da9628.js.map → chunk-bvqae0px.js.map} +0 -0
  330. /package/dist/{chunk-x7cpth2f.js.map → chunk-veq07rp8.js.map} +0 -0
  331. /package/dist/{chunk-agyfv3f8.js.map → chunk-vj5necm0.js.map} +0 -0
@@ -0,0 +1,112 @@
1
+ /**
2
+ * The bookkeeping of a job batch, shared by every driver so that the rules for
3
+ * when a batch is cancelled and which callbacks run are written once.
4
+ *
5
+ * A driver keeps a `BatchRecord` per batch and calls these functions while it
6
+ * holds that record exclusively: inside the transaction that also ends the job
7
+ * (the database driver, with the batch row locked), or synchronously (the
8
+ * memory driver). Everything here is pure; the driver writes what comes back,
9
+ * and enqueues the callback jobs `settle` returns in the same step, which is
10
+ * what makes each callback run exactly once.
11
+ *
12
+ * The rules:
13
+ *
14
+ * - Every job of the batch ends exactly once as `succeeded`, `failed` (it was
15
+ * dead-lettered) or `cancelled` (it never ran to the end because the batch was
16
+ * cancelled). `pending` counts the ones that have not ended yet.
17
+ * - `catch` is due at the first failure or cancellation, whichever comes first.
18
+ * - Without `allowFailures`, the first failure cancels the batch: the jobs still
19
+ * waiting are ended as `cancelled` at once, and running ones see it through
20
+ * `this.batch.cancelled()`.
21
+ * - Once `pending` reaches 0 the batch is finished: `then` is due when it was
22
+ * not cancelled and nothing failed (or `allowFailures` is set), and `finally`
23
+ * is always due.
24
+ */
25
+ /** A job and the arguments to dispatch it with: what `Job.with(...)` returns. */
26
+ export type JobCall = {
27
+ /** The job's registered name: its class's `static name`. */
28
+ name: string;
29
+ /** The `run` arguments, before the batch status is appended. */
30
+ args: unknown[];
31
+ };
32
+ export type BatchCallbacks = {
33
+ then?: JobCall;
34
+ catch?: JobCall;
35
+ finally?: JobCall;
36
+ };
37
+ /** What `Job.findBatch` resolves to, and the last argument a batch callback gets. */
38
+ export type BatchStatus = {
39
+ id: string;
40
+ /** The `name` given to `dispatchBatch`, or `null`. */
41
+ name: string | null;
42
+ /** How many jobs the batch was dispatched with. */
43
+ total: number;
44
+ /** Jobs that have not ended yet: waiting, running, or waiting out a retry. */
45
+ pending: number;
46
+ succeeded: number;
47
+ /** Jobs that were dead-lettered. */
48
+ failed: number;
49
+ /** Jobs that ended without running to the end because the batch was cancelled. */
50
+ cancelled: number;
51
+ /** The ids of the dead-lettered jobs, in the order they failed. */
52
+ failedJobIds: string[];
53
+ /**
54
+ * 0 to 1: the ended jobs plus the share each running job reported with
55
+ * `this.progress()`, over `total`. 1 for a batch of no jobs.
56
+ */
57
+ progress: number;
58
+ /** When the batch was cancelled, in epoch milliseconds, or `null`. */
59
+ cancelledAt: number | null;
60
+ /** When its last job ended, in epoch milliseconds, or `null` while it runs. */
61
+ finishedAt: number | null;
62
+ createdAt: number;
63
+ };
64
+ /** What a driver stores per batch. */
65
+ export type BatchRecord = Omit<BatchStatus, "progress"> & {
66
+ allowFailures: boolean;
67
+ callbacks: BatchCallbacks;
68
+ };
69
+ /** How one job of a batch ended. */
70
+ export type BatchOutcome = "succeeded" | "failed" | "cancelled";
71
+ /** The callback jobs to enqueue, their arguments already serialised. */
72
+ export type BatchCallbackJob = {
73
+ name: string;
74
+ args: string;
75
+ };
76
+ export declare function newBatchRecord(batch: {
77
+ id: string;
78
+ name: string | null;
79
+ total: number;
80
+ allowFailures: boolean;
81
+ callbacks: BatchCallbacks;
82
+ now: number;
83
+ }): BatchRecord;
84
+ /** Counts one job's end. A batch with nothing pending is left as it is. */
85
+ export declare function countOutcome(record: BatchRecord, outcome: BatchOutcome, jobId: string): BatchRecord;
86
+ /**
87
+ * Whether going from `prev` to `next` is the failure that cancels the batch:
88
+ * its first, without `allowFailures`, in a batch not already cancelled.
89
+ */
90
+ export declare function cancelsBatch(prev: BatchRecord, next: BatchRecord): boolean;
91
+ /**
92
+ * Marks the batch cancelled, counting the `waiting` jobs the driver has just
93
+ * ended as `cancelled`.
94
+ */
95
+ export declare function markCancelled(record: BatchRecord, now: number, waiting: number): BatchRecord;
96
+ /**
97
+ * Finishes the batch when nothing is pending, and says which callbacks became
98
+ * due between `prev` and `next`. Each callback's arguments are its own followed
99
+ * by the batch's status as it stands after this step.
100
+ */
101
+ export declare function settle(prev: BatchRecord, next: BatchRecord, now: number): {
102
+ record: BatchRecord;
103
+ calls: BatchCallbackJob[];
104
+ };
105
+ /**
106
+ * The status of a batch. `running` is the sum of the progress the batch's
107
+ * unfinished jobs have reported, each 0 to 1.
108
+ */
109
+ export declare function statusOf(record: BatchRecord, running?: number): BatchStatus;
110
+ /** A progress value as stored: a finite number clamped to 0..1. */
111
+ export declare function clampProgress(value: number): number;
112
+ //# sourceMappingURL=batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../services/queue/batch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,iFAAiF;AACjF,MAAM,MAAM,OAAO,GAAG;IACpB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,qFAAqF;AACrF,MAAM,MAAM,WAAW,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,sDAAsD;IACtD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;IACd,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,kFAAk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M,GAAG,WAAW,CAQ5F;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CACpB,IAAI,EAAE,WAAW,EACjB,IAAI,EAAE,WAAW,EACjB,GAAG,EAAE,MAAM,GACV;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,KAAK,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAwBpD;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,WAAW,EAAE,OAAO,SAAI,GAAG,WAAW,CAMtE;AAED,mEAAmE;AACnE,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKnD"}
@@ -24,6 +24,9 @@ import type { QueueDriver } from "./QueueDriver";
24
24
  * checks that the driver says so, because the manager then holds the dispatch
25
25
  * until the commit itself; that half is `QueueManager.transaction.test.ts`.
26
26
  *
27
+ * `features.batches` runs the batch tests: `enqueueBatch`, the counters
28
+ * `complete` and `fail` keep, `findBatch`, `cancelBatch` and `reportProgress`.
29
+ *
27
30
  * Not a `*.test.ts` file, so vitest never runs it on its own, and not exported
28
31
  * from `gemi/services`, because it imports vitest.
29
32
  *
@@ -42,5 +45,7 @@ export declare function queueDriverContract(name: string, create: () => QueueDri
42
45
  run(driver: QueueDriver, fn: () => Promise<void>): Promise<void>;
43
46
  joins: boolean;
44
47
  };
48
+ /** The driver implements the batch methods, and runs the tests that pin them. */
49
+ batches?: boolean;
45
50
  }): void;
46
51
  //# sourceMappingURL=queueDriverContract.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"queueDriverContract.d.ts","sourceRoot":"","sources":["../../../services/queue/queueDriverContract.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,EAChD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACvD,QAAQ,GAAE;IACR,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE;QACZ,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACjE,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;CACE,QAulBP"}
1
+ {"version":3,"file":"queueDriverContract.d.ts","sourceRoot":"","sources":["../../../services/queue/queueDriverContract.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,eAAe,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,EAChD,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,EACvD,QAAQ,GAAE;IACR,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE;QACZ,GAAG,CAAC,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QACjE,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC;IACF,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;CACd,QAo4BP"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Ec as E,Hc as T}from"../../chunk-7vb4eey2.js";import"../../chunk-tn2bryy2.js";import"../../chunk-cbqazg9k.js";import"../../chunk-1myhm0g3.js";import"../../chunk-kejwjerj.js";import"../../chunk-t4yh4nf9.js";import"../../chunk-1vzks22y.js";import{fi as I,gi as J,ji as O}from"../../chunk-zyt2w03d.js";import{ni as N}from"../../chunk-1hr4xht1.js";import"../../chunk-vw8849ys.js";import L from"path";class F extends Error{name="QueueWorkerRefused"}class H{kernel;stopping;keepAlive;settings;constructor(y,z={}){this.kernel=y;this.settings={...J(),...z}}async start(){if(await this.kernel.waitForBoot(),this.stopping)return;let y=this.kernel.app;if(!y.bound(E))throw new F("[gemi] `gemi queue:work` has no queue to claim from: this application does not register QueueServiceProvider.");let z=y.make(E);if(!z.durable)throw new F('[gemi] `gemi queue:work` refuses to start: the queue uses the memory driver, which keeps each job in the process that dispatched it, so a worker never sees one. Set `driver: "database"` (or another driver every process can reach) in app/config/queue.ts, or run jobs in the server and drop the worker.');z.start(),this.keepAlive=setInterval(()=>{},1073741824),console.log(`[gemi] Queue worker started: claiming up to ${z.config.concurrency} job(s) at a time.`)}stop(y={}){return this.stopping??=this.drain({...this.settings,...y}),this.stopping}async drain(y){I();let z=this.kernel.app,A=z.resolved(E)?z.make(E):void 0;if(A)console.log(`[gemi] Shutting down: waiting for ${A.running} running job(s) (up to ${y.timeoutMs/1000}s).`),await A.drain(y.timeoutMs);let B=await this.kernel.shutdown({timeoutMs:y.providerTimeoutMs});clearInterval(this.keepAlive);let C=(A?.running??0)===0&&B.failed.length===0&&B.timedOut.length===0;return console.log(`[gemi] Shutdown ${C?"complete":"finished with errors"}.`),C?0:1}}async function U(){let y=N();process.env.ROOT_DIR=y,process.env.APP_DIR=L.join(y,"app"),T();let z=L.join(y,"app/kernel/Kernel.ts"),{default:A}=await import(z);if(typeof A!=="function")return console.error(`[gemi] ${z} has no default export to boot the worker from.`),1;let B=new A;B.boot();let C=new H(B);O(()=>C.stop());try{await C.start()}catch(G){if(!(G instanceof F))throw G;return console.error(G.message),1}return}U().then((y)=>{if(y!==void 0)process.exit(y)},(y)=>{console.error("[gemi] The queue worker failed to start:",y),process.exit(1)});
2
+ import{Gc as E,Jc as T}from"../../chunk-y0en07zh.js";import"../../chunk-jpetnpzn.js";import"../../chunk-dz99g58c.js";import"../../chunk-t65074mw.js";import"../../chunk-5w6kyxsj.js";import"../../chunk-076jezzg.js";import"../../chunk-wk1tp1f1.js";import{Ki as I,Li as J,Oi as O}from"../../chunk-a32wfzdq.js";import{Si as N}from"../../chunk-8gtc3s1y.js";import"../../chunk-dcgvq79a.js";import L from"path";class F extends Error{name="QueueWorkerRefused"}class H{kernel;stopping;keepAlive;settings;constructor(y,z={}){this.kernel=y;this.settings={...J(),...z}}async start(){if(await this.kernel.waitForBoot(),this.stopping)return;let y=this.kernel.app;if(!y.bound(E))throw new F("[gemi] `gemi queue:work` has no queue to claim from: this application does not register QueueServiceProvider.");let z=y.make(E);if(!z.durable)throw new F('[gemi] `gemi queue:work` refuses to start: the queue uses the memory driver, which keeps each job in the process that dispatched it, so a worker never sees one. Set `driver: "database"` (or another driver every process can reach) in app/config/queue.ts, or run jobs in the server and drop the worker.');z.start(),this.keepAlive=setInterval(()=>{},1073741824),console.log(`[gemi] Queue worker started: claiming up to ${z.config.concurrency} job(s) at a time.`)}stop(y={}){return this.stopping??=this.drain({...this.settings,...y}),this.stopping}async drain(y){I();let z=this.kernel.app,A=z.resolved(E)?z.make(E):void 0;if(A)console.log(`[gemi] Shutting down: waiting for ${A.running} running job(s) (up to ${y.timeoutMs/1000}s).`),await A.drain(y.timeoutMs);let B=await this.kernel.shutdown({timeoutMs:y.providerTimeoutMs});clearInterval(this.keepAlive);let C=(A?.running??0)===0&&B.failed.length===0&&B.timedOut.length===0;return console.log(`[gemi] Shutdown ${C?"complete":"finished with errors"}.`),C?0:1}}async function U(){let y=N();process.env.ROOT_DIR=y,process.env.APP_DIR=L.join(y,"app"),T();let z=L.join(y,"app/kernel/Kernel.ts"),{default:A}=await import(z);if(typeof A!=="function")return console.error(`[gemi] ${z} has no default export to boot the worker from.`),1;let B=new A;B.boot();let C=new H(B);O(()=>C.stop());try{await C.start()}catch(G){if(!(G instanceof F))throw G;return console.error(G.message),1}return}U().then((y)=>{if(y!==void 0)process.exit(y)},(y)=>{console.error("[gemi] The queue worker failed to start:",y),process.exit(1)});
3
3
 
4
- //# debugId=94D4E3D8DDBEA88A64756E2164756E21
4
+ //# debugId=71570968BCFFF1AB64756E2164756E21
@@ -6,6 +6,6 @@
6
6
  "import type { Application, ShutdownReport } from \"../../foundation/Application\";\nimport { markShuttingDown, shutdownSettings, type ShutdownSettings } from \"../../server/shutdown\";\nimport { QueueManager } from \"./QueueManager\";\n\n/** The part of a `Kernel` a worker drives. */\nexport type WorkerKernel = {\n readonly app: Application;\n waitForBoot(): Promise<void>;\n shutdown(options?: { timeoutMs?: number }): Promise<ShutdownReport>;\n};\n\n/**\n * A worker that was told to start in an application it cannot claim for. The\n * message is written for the operator reading the deploy's logs.\n */\nexport class QueueWorkerRefused extends Error {\n name = \"QueueWorkerRefused\";\n}\n\n/**\n * The process `gemi queue:work` runs: the application booted as a server boots\n * it, claiming from the queue, and no `Bun.serve`. It exists so job capacity\n * can be scaled apart from request traffic, which needs a driver both kinds of\n * process can reach; see `start` for why the memory driver is refused.\n *\n * The caller marks the process as a worker (`markQueueWorker`) before the\n * kernel registers, so every claim rule that asks `claimsInThisProcess` sees a\n * process that claims, whatever `GEMI_QUEUE_CLAIM` says.\n */\nexport class QueueWorker {\n private stopping: Promise<number> | undefined;\n private keepAlive: ReturnType<typeof setInterval> | undefined;\n private readonly settings: ShutdownSettings;\n\n /**\n * `settings` default to the `GEMI_SHUTDOWN_*` variables, read here rather\n * than at the signal so a bad value is warned about while the deploy is\n * being watched, as `Server.start` does.\n */\n constructor(\n private readonly kernel: WorkerKernel,\n settings: Partial<ShutdownSettings> = {},\n ) {\n this.settings = { ...shutdownSettings(), ...settings };\n }\n\n /**\n * Boots the application and starts claiming. Rejects with\n * `QueueWorkerRefused` when the application has no queue, or its queue uses\n * the memory driver.\n *\n * Refused rather than warned about, because a memory worker can never do\n * anything: its jobs live in a `Map` in the process that dispatched them,\n * so a worker's is always empty. Left running, it looks like a healthy\n * deploy — a process up, no errors — that runs nothing, and scaling it out\n * adds no capacity. An exit the platform reports as a crash loop is a form\n * of the mistake someone will see.\n */\n async start(): Promise<void> {\n await this.kernel.waitForBoot();\n // A signal during the boot has already drained and cleared the handle\n // below. Going on would start the loop again and arm a handle nothing\n // clears, holding open a worker that has finished shutting down.\n if (this.stopping) return;\n\n const application = this.kernel.app;\n // `bound`, not `make` in a try: an application built without the queue\n // provider is a configuration to name, not an unbound-token stack trace.\n if (!application.bound(QueueManager)) {\n throw new QueueWorkerRefused(\n \"[gemi] `gemi queue:work` has no queue to claim from: this application \" +\n \"does not register QueueServiceProvider.\",\n );\n }\n const queue = application.make(QueueManager);\n if (!queue.durable) {\n throw new QueueWorkerRefused(\n \"[gemi] `gemi queue:work` refuses to start: the queue uses the memory \" +\n \"driver, which keeps each job in the process that dispatched it, so \" +\n 'a worker never sees one. Set `driver: \"database\"` (or another driver ' +\n \"every process can reach) in app/config/queue.ts, or run jobs in the \" +\n \"server and drop the worker.\",\n );\n }\n\n // Idempotent: a production boot with a durable driver has already started\n // it (`startClaimingIfServing`). Development has not, and a worker claims\n // in either.\n queue.start();\n // The queue's poll timer is unref'd, so that a script's queue does not\n // hold it open; here the queue is the process, and without a handle of its\n // own an idle worker would exit 0 as soon as it booted.\n this.keepAlive = setInterval(() => {}, 1 << 30);\n console.log(\n `[gemi] Queue worker started: claiming up to ${queue.config.concurrency} job(s) at a time.`,\n );\n }\n\n /**\n * Stops claiming, waits for the running jobs, runs every provider's\n * `shutdown()`, and resolves with the exit code: 0 when no job was left\n * running and every provider finished in time, 1 otherwise. Idempotent.\n *\n * `gemi start`'s drain, with the jobs where the requests were:\n * `isShuttingDown()` turns true, which stops a durable queue claiming;\n * running jobs get `timeoutMs` (`GEMI_SHUTDOWN_TIMEOUT`), which a server\n * spends on requests; then `Application.shutdown` gets `providerTimeoutMs`,\n * and in it the queue provider waits for whatever is still running and\n * names it. The two budgets add up as they do for a server, so a worker\n * fits the same grace period. `delayMs` is not waited: it is for a load\n * balancer, and nothing routes to a worker.\n */\n stop(settings: Partial<ShutdownSettings> = {}): Promise<number> {\n this.stopping ??= this.drain({ ...this.settings, ...settings });\n return this.stopping;\n }\n\n private async drain(settings: ShutdownSettings): Promise<number> {\n markShuttingDown();\n const application = this.kernel.app;\n // Resolving the manager now would build a driver only to stop it, which\n // is what a signal during the boot, before the provider resolved it, finds.\n const queue = application.resolved(QueueManager) ? application.make(QueueManager) : undefined;\n if (queue) {\n console.log(\n `[gemi] Shutting down: waiting for ${queue.running} running job(s) ` +\n `(up to ${settings.timeoutMs / 1000}s).`,\n );\n await queue.drain(settings.timeoutMs);\n }\n\n const report = await this.kernel.shutdown({ timeoutMs: settings.providerTimeoutMs });\n clearInterval(this.keepAlive);\n const clean =\n (queue?.running ?? 0) === 0 && report.failed.length === 0 && report.timedOut.length === 0;\n console.log(`[gemi] Shutdown ${clean ? \"complete\" : \"finished with errors\"}.`);\n return clean ? 0 : 1;\n }\n}\n"
7
7
  ],
8
8
  "mappings": ";iZAYA,kBCGO,IAAM,QAA2B,GAAM,DAC5C,GAAO,kBACT,DAYO,IAAM,CAAY,CAWJ,OAVX,SACA,UACS,SAOjB,WAAW,CACQ,EACjB,EAAsC,CAAC,EACvC,CAFiB,cAGjB,KAAK,SAAW,IAAK,EAAiB,KAAM,CAAS,OAejD,MAAK,EAAkB,CAK3B,GAJA,MAAM,KAAK,OAAO,YAAY,EAI1B,KAAK,SAAU,OAEnB,IAAM,EAAc,KAAK,OAAO,IAGhC,GAAI,CAAC,EAAY,MAAM,CAAY,EACjC,MAAM,IAAI,EACR,+GAEF,EAEF,IAAM,EAAQ,EAAY,KAAK,CAAY,EAC3C,GAAI,CAAC,EAAM,QACT,MAAM,IAAI,EACR,8SAKF,EAMF,EAAM,MAAM,EAIZ,KAAK,UAAY,YAAY,IAAM,GAAI,UAAO,EAC9C,QAAQ,IACN,+CAA+C,EAAM,OAAO,+BAC9D,EAiBF,IAAI,CAAC,EAAsC,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T,QAAQ,MAAM,2CAA4C,CAAK,EAC/D,QAAQ,KAAK,CAAC,EAElB",
9
- "debugId": "94D4E3D8DDBEA88A64756E2164756E21",
9
+ "debugId": "71570968BCFFF1AB64756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ViewRouteDispatcher.d.ts","sourceRoot":"","sources":["../../../services/router/ViewRouteDispatcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC,OAAO,EAAE,KAAK,cAAc,EAAmC,MAAM,2BAA2B,CAAC;AAEjG,OAAO,EAEL,KAAK,cAAc,EAEpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAA2B,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,UAAU,CAAC;AAU7F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAyBxD,OAAO,EAAoC,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAiHzF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,EAAE,QAY9D;AAaD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAM1D;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,YAM7D;AAED,qBAAa,mBAAmB;IAC9B,MAAM,CAAC,KAAK,SAAiB;IAE7B,cAAc,EAAE,cAAc,CAAM;IACpC,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAM;IAC7C,0FAA0F;IAC1F,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,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,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,OAAO,CAAC;YAAC,MAAM,CAAC,EAAE,MAAM,CAAA;SAAE,KAAK,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC5F,aAAa,EAAE,GAAG,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;QAC5B,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC3B;;;;WAIG;QACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAClC;;;;;;;;;;;WAWG;QACH,WAAW,CAAC,EAAE;YAAE,MAAM,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC;QACpD;;;WAGG;QACH,qBAAqB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACjD;;;;WAIG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,wEAAwE;QACxE,aAAa,CAAC,EAAE,cAAc,CAAC;KAChC;CAo7BJ"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import"../chunk-vw8849ys.js";import M from"path";import{writeFileSync as Q}from"fs";var L=new Set(["FILE","REDIRECT"]);function H(j){return j.run(()=>{let x=[];for(let{group:z,view:D}of j.domains().viewGroups())for(let[G,B]of Object.entries(D.flatViewRoutes)){let C=D.routeManifest[G]??B.segments.map((K)=>K.viewPath);if(C.length===0||L.has(C.at(-1)))continue;x.push({path:G,group:z,views:C,...B.static?{static:B.static.layout?{layout:B.static.layout}:{}}:{}})}return x})}var J=process.argv[2];async function U(){if(!J)throw Error("usage: route-table <out.json>");let j=M.resolve(process.cwd(),"app/kernel/Kernel.ts"),x=await import(j);if(typeof x.default!=="function")throw Error(`${j} has no default export (the Kernel subclass).`);let z=new x.default;z.boot();try{Q(J,JSON.stringify(H(z)))}finally{z.destroy()}}U().then(()=>process.exit(0),(j)=>{console.error(j?.stack??String(j)),process.exit(1)});
2
+ import"../chunk-dcgvq79a.js";import M from"path";import{writeFileSync as Q}from"fs";var L=new Set(["FILE","REDIRECT"]);function H(j){return j.run(()=>{let x=[];for(let{group:z,view:D}of j.domains().viewGroups())for(let[G,B]of Object.entries(D.flatViewRoutes)){let C=D.routeManifest[G]??B.segments.map((K)=>K.viewPath);if(C.length===0||L.has(C.at(-1)))continue;x.push({path:G,group:z,views:C,...B.static?{static:B.static.layout?{layout:B.static.layout}:{}}:{}})}return x})}var J=process.argv[2];async function U(){if(!J)throw Error("usage: route-table <out.json>");let j=M.resolve(process.cwd(),"app/kernel/Kernel.ts"),x=await import(j);if(typeof x.default!=="function")throw Error(`${j} has no default export (the Kernel subclass).`);let z=new x.default;z.boot();try{Q(J,JSON.stringify(H(z)))}finally{z.destroy()}}U().then(()=>process.exit(0),(j)=>{console.error(j?.stack??String(j)),process.exit(1)});
3
3
 
4
4
  //# debugId=2C354352EBF6475164756E2164756E21
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Lc as Y}from"../chunk-n672d4g8.js";import{_g as M}from"../chunk-cbqazg9k.js";import{$h as P,bi as R}from"../chunk-t4yh4nf9.js";import"../chunk-1vzks22y.js";import{ki as Q,li as U,mi as V,ni as W}from"../chunk-1hr4xht1.js";import"../chunk-vw8849ys.js";class S{static token;async boot(){}static inject(){if(!this.token)throw Error(`Service [${this.name}] does not declare a \`static token\`, so the container has no key to resolve it by.`);try{return R(this)}catch(x){throw Error(`Could not inject [${this.name}]. Services are constructed when the kernel boots, so `+"inject() only works from code that runs after that \u2014 a constructor default or a method "+`body, never module top level. Check that [${this.name}] is listed in \`services\` on your Kernel.`,{cause:x})}}static with(x){let f=new this;for(let[C,g]of Object.entries(x))if(g!==void 0)f[C]=g;return f}}import{readdir as z}from"fs/promises";import{join as B,parse as j}from"path";var H=[".ts",".tsx",".js",".mjs",".jsx"];function J(x={}){let f={};for(let[C,g]of Object.entries(x))f[C]=q(g);return new P(f)}async function L(x,f=new P){let C=[];try{C=await z(x)}catch(D){return f}let g=C.filter((D)=>{let{ext:v,name:F}=j(D);return H.includes(v)&&!F.startsWith(".")}).sort();for(let D of g){let{name:v}=j(D),F=await import(B(x,D));f.set(v,q(F))}return f}function q(x){if(x&&typeof x==="object"&&"default"in x)return x.default;return x}export{M as withDefaults,Q as sourceFiles,W as projectRoot,L as loadConfigFrom,V as discoverClasses,J as createConfigRepository,Y as ServiceProvider,S as Service,P as Repository,U as DiscoveryError};
2
+ import{Nc as Y}from"../chunk-n9jyjp4a.js";import{Ch as M}from"../chunk-dz99g58c.js";import{Ei as P,Gi as R}from"../chunk-076jezzg.js";import"../chunk-wk1tp1f1.js";import{Pi as Q,Qi as U,Ri as V,Si as W}from"../chunk-8gtc3s1y.js";import"../chunk-dcgvq79a.js";class S{static token;async boot(){}static inject(){if(!this.token)throw Error(`Service [${this.name}] does not declare a \`static token\`, so the container has no key to resolve it by.`);try{return R(this)}catch(x){throw Error(`Could not inject [${this.name}]. Services are constructed when the kernel boots, so `+"inject() only works from code that runs after that \u2014 a constructor default or a method "+`body, never module top level. Check that [${this.name}] is listed in \`services\` on your Kernel.`,{cause:x})}}static with(x){let f=new this;for(let[C,g]of Object.entries(x))if(g!==void 0)f[C]=g;return f}}import{readdir as z}from"fs/promises";import{join as B,parse as j}from"path";var H=[".ts",".tsx",".js",".mjs",".jsx"];function J(x={}){let f={};for(let[C,g]of Object.entries(x))f[C]=q(g);return new P(f)}async function L(x,f=new P){let C=[];try{C=await z(x)}catch(D){return f}let g=C.filter((D)=>{let{ext:v,name:F}=j(D);return H.includes(v)&&!F.startsWith(".")}).sort();for(let D of g){let{name:v}=j(D),F=await import(B(x,D));f.set(v,q(F))}return f}function q(x){if(x&&typeof x==="object"&&"default"in x)return x.default;return x}export{M as withDefaults,Q as sourceFiles,W as projectRoot,L as loadConfigFrom,V as discoverClasses,J as createConfigRepository,Y as ServiceProvider,S as Service,P as Repository,U as DiscoveryError};
3
3
 
4
- //# debugId=6197F3E996C8C49964756E2164756E21
4
+ //# debugId=65AB04009D57471764756E2164756E21
@@ -6,6 +6,6 @@
6
6
  "import { readdir } from \"node:fs/promises\";\nimport { join, parse } from \"node:path\";\n\nimport { Repository } from \"./Repository\";\n\nconst CONFIG_EXTENSIONS = [\".ts\", \".tsx\", \".js\", \".mjs\", \".jsx\"];\n\n// Builds a Repository from an already-imported map of config modules. The map\n// key becomes the top-level config key, so `{ mail: mailModule }` is readable\n// as `config.get(\"mail.driver\")`. Each entry may be either the module namespace\n// (its `default` export is unwrapped) or the config object itself.\nexport function createConfigRepository(\n modules: Record<string, any> = {},\n): Repository {\n const items: Record<string, any> = {};\n\n for (const [key, mod] of Object.entries(modules)) {\n items[key] = unwrap(mod);\n }\n\n return new Repository(items);\n}\n\n// Reads every config module in an app's `app/config` directory into a\n// Repository. The file's basename is the top-level key: `app/config/mail.ts`\n// populates `mail.*`. A missing directory yields an empty Repository so apps\n// that declare no config still boot.\nexport async function loadConfigFrom(\n directory: string,\n repository = new Repository(),\n): Promise<Repository> {\n let entries: string[] = [];\n\n try {\n entries = await readdir(directory);\n } catch (err) {\n return repository;\n }\n\n const files = entries\n .filter((entry) => {\n const { ext, name } = parse(entry);\n return CONFIG_EXTENSIONS.includes(ext) && !name.startsWith(\".\");\n })\n .sort();\n\n for (const file of files) {\n const { name } = parse(file);\n const mod = await import(join(directory, file));\n repository.set(name, unwrap(mod));\n }\n\n return repository;\n}\n\nfunction unwrap(mod: any) {\n if (mod && typeof mod === \"object\" && \"default\" in mod) {\n return mod.default;\n }\n return mod;\n}\n"
7
7
  ],
8
8
  "mappings": ";2RAgCO,CAAe,JAAQ,EAOrB,OAMD,AAAI,EAAkB,QAmBrB,OAAS,EAKX,CACH,GAAI,CAAC,KAAK,MACR,MAAU,MACR,YAAY,KAAK,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1
1
  // @bun
2
- import{ea as B,fa as D}from"../chunk-gts5p6mw.js";import"../chunk-9n1hx3mq.js";import"../chunk-hdps9n52.js";import{za as J}from"../chunk-p1aqq0ga.js";import"../chunk-4mfrgd5m.js";import"../chunk-vw8849ys.js";function N(){return{name:"gemi-custom-request",enforce:"pre",async transform(G,H){let j=H.split("?",1)[0];if(j.includes("/node_modules/")||!B.test(j))return null;return{code:await D(G),map:null}}}}export{N as gemiRequestPlugin,J as gemiIslandPlugin};
2
+ import{fa as B,ga as D}from"../chunk-ge9xjwgq.js";import"../chunk-hr61ekcr.js";import"../chunk-x7qwx07b.js";import{Aa as J}from"../chunk-6ggmk2eg.js";import"../chunk-kk77x2v4.js";import"../chunk-dcgvq79a.js";function N(){return{name:"gemi-custom-request",enforce:"pre",async transform(G,H){let j=H.split("?",1)[0];if(j.includes("/node_modules/")||!B.test(j))return null;return{code:await D(G),map:null}}}}export{N as gemiRequestPlugin,J as gemiIslandPlugin};
3
3
 
4
- //# debugId=69032BE0B0AA208664756E2164756E21
4
+ //# debugId=C11E8611E15123D864756E2164756E21
@@ -5,6 +5,6 @@
5
5
  "import type { Plugin } from \"vite\";\nimport {\n CUSTOM_REQUEST_FILTER,\n customRequestParser,\n} from \"../bun/customRequestParser\";\n\n/**\n * The request-param rewrite, as a Vite plugin, for running an app's routes\n * under vitest.\n *\n * gemi calls a route handler and a controller method with no arguments, and a\n * handler written `async (req: HttpRequest<…>) => …` only gets its request\n * because the build rewrites it to `async (req = new HttpRequest()) => …`, which\n * reads the current request from the request context. The app's build and dev\n * server get that rewrite from `gemi/bun/plugin`. Vitest loads modules through\n * Vite instead, even under `bun --bun vitest`, so without this plugin a route\n * dispatched with `App.fetch` in a test sees `req === undefined`.\n *\n * Same transform, same files (`/http/controllers/` and `/http/routes/`) as the\n * Bun plugin. `enforce: \"pre\"` so it sees the TypeScript annotations before\n * Vite strips them.\n *\n * ```ts\n * // vitest.config.ts\n * import { defineConfig } from \"vitest/config\";\n * import { gemiRequestPlugin } from \"gemi/vitest\";\n *\n * export default defineConfig({ plugins: [gemiRequestPlugin()] });\n * ```\n */\nexport function gemiRequestPlugin(): Plugin {\n return {\n name: \"gemi-custom-request\",\n enforce: \"pre\",\n async transform(code, id) {\n const path = id.split(\"?\", 1)[0];\n if (path.includes(\"/node_modules/\") || !CUSTOM_REQUEST_FILTER.test(path)) {\n return null;\n }\n return { code: await customRequestParser(code), map: null };\n },\n };\n}\n\n/**\n * gemi's island transform, for an app's `vitest.config.ts`: with it, a test\n * that renders a static view through `App.fetch` sees each\n * `island(() => import(\"./Counter\"))` with the same module key as the build,\n * and a hydrated view renders the component in place instead of lazily.\n *\n * Without it islands still render (the component is loaded with the\n * `import()`), but their keys are unknown.\n *\n * ```ts\n * // vitest.config.ts\n * import { defineConfig } from \"vitest/config\";\n * import { gemiIslandPlugin, gemiRequestPlugin } from \"gemi/vitest\";\n *\n * export default defineConfig({ plugins: [gemiRequestPlugin(), gemiIslandPlugin()] });\n * ```\n */\nexport { gemiIslandPlugin } from \"../vite/islandPlugin\";\n"
6
6
  ],
7
7
  "mappings": ";yOA8BO,IAAS,JAAiB,HAAW,JAC1C,CAAO,CACL,KAAM,sBACN,QAAS,WACH,UAAS,CAAC,EAAM,EAAI,CACxB,IAAM,EAAO,EAAG,MAAM,IAAK,CAAC,EAAE,GAC9B,GAAI,EAAK,SAAS,gBAAgB,GAAK,CAAC,EAAsB,KAAK,CAAI,EACrE,OAAO,KAET,MAAO,CAAE,KAAM,MAAM,EAAoB,CAAI,EAAG,IAAK,IAAK,EAE9D",
8
- "debugId": "69032BE0B0AA208664756E2164756E21",
8
+ "debugId": "C11E8611E15123D864756E2164756E21",
9
9
  "names": []
10
10
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gemi",
3
- "version": "0.116.0",
3
+ "version": "0.117.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "author": "Enes Tufekci <enes@gemijs.dev>",
@@ -1,5 +0,0 @@
1
- // @bun
2
- import{Kc as o}from"./chunk-v1tfdgy1.js";import{Lc as i}from"./chunk-n672d4g8.js";import{_g as t}from"./chunk-cbqazg9k.js";import{Zh as r}from"./chunk-jmg2zsaf.js";class n extends i{register(){this.app.singleton(r,()=>new r(t(o(),this.app.config.get("translation",{}))))}}
3
- export{n as eb};
4
-
5
- //# debugId=C32FA7347CB1EE1064756E2164756E21
@@ -1,5 +0,0 @@
1
- // @bun
2
- import{AsyncLocalStorage as E}from"async_hooks";class Q{content={title:"Gemi App",description:null,openGraph:null,htmlAttributes:null,canonical:null,alternates:null};touched=!1;render(){return{title:this.content.title,description:this.content.description,openGraph:this.content.openGraph,htmlAttributes:this.content.htmlAttributes,canonical:this.content.canonical,alternates:this.content.alternates}}htmlAttributes(j){this.touched=!0;let B=Object.fromEntries(Object.entries(j).filter(([,z])=>z!==void 0));this.content.htmlAttributes={...this.content.htmlAttributes,...B}}canonical(j){this.touched=!0,this.content.canonical=j}alternates(j){this.touched=!0,this.content.alternates=j}title(j){this.touched=!0,this.content.title=j}description(j){this.touched=!0,this.content.description=j}openGraph({title:j,description:B,type:z,url:G,image:J,imageAlt:U,imageWidth:V,imageHeight:X,twitterImage:Y=J,twitterImageAlt:K=U,twitterImageWidth:N=V,twitterImageHeight:b=X}){this.touched=!0;let Z=J,$=Y;if(J&&!J.startsWith("http"))Z=`${process.env.HOST_NAME}${J}`,$=`${process.env.HOST_NAME}${Y}`;this.content.openGraph=Object.fromEntries(Object.entries({title:j,description:B,type:z,url:G,image:Z,imageAlt:U,imageWidth:V,imageHeight:X,twitterImage:$,twitterImageAlt:K,twitterImageWidth:N,twitterImageHeight:b}).filter(([H,M])=>M!==void 0))}}function F(j,B,z={}){return[`${j}=${B}`,z.maxAge?`Max-Age=${z.maxAge}`:"",z.httpOnly?"HttpOnly":"",z.secure?"Secure":"",z.sameSite?`SameSite=${z.sameSite}`:"SameSite=Strict",z.path?`Path=${z.path}`:"Path=/",z.domain?`Domain=${z.domain}`:"",z.expires?`Expires=${z.expires.toUTCString()}`:"",z.partitioned?"Partitioned":""].filter((G)=>G!=="").join("; ")}var P=new E;class L{req;cookies=new Set;headers=new Headers;serverQueries=null;user=null;csrfHmac=null;locale=null;metadata=new Q;rangeRequest=null;sessionId=null;featureEvaluations=null;featureContext=null;featureBuckets=null;pendingWork=new Set;ended=!1;constructor(j){this.req=j}waitUntil(j){if(this.ended)return;let B=Promise.resolve(j).then(()=>{},()=>{});this.pendingWork.add(B),B.then(()=>this.pendingWork.delete(B))}hasPendingWork(){return this.pendingWork.size>0}async whenIdle(){while(this.pendingWork.size>0)await Promise.all(Array.from(this.pendingWork))}setLocale(j){this.locale=j}renderMeta(){return this.metadata.render()}setCSRFHmac(j){this.csrfHmac=j}setCookie(j,B,z={}){this.cookies.add(F(j,B,z))}deleteCookie(j,B={}){this.cookies.add(F(j,"",{...B,maxAge:-1}))}setHeaders(j,B){this.headers.set(j,B)}setUser(j){this.user=j}setRequest(j){this.req=j}destroy(){this.ended=!0,delete this.cookies,delete this.headers,this.serverQueries=null,this.sessionId=null,this.featureEvaluations=null,this.featureContext=null,this.featureBuckets=null,delete this.user}}var D="session_id";function y(){let j=T.getStore();if(!j)return null;if(j.sessionId)return j.sessionId;let B=j.req?.cookies?.get(D);if(B)j.sessionId=B;return j.sessionId}function A(){let j=T.getStore();if(!j)return null;let B=y();if(B)return B;let z=Bun.randomUUIDv7();return j.sessionId=z,j.setCookie(D,z,{httpOnly:!0,secure:Bun.env.NODE_ENV==="production",sameSite:"Lax",expires:new Date(Date.now()+31536000000)}),z}class T{static getStore(){return P.getStore()}static setRequest(j){P.getStore().req=j}static run(j,B,z){let G=new L(j);if(z)G.user=z.user;return P.run(G,B)}static runWith(j,B){return P.run(j,B)}static exit(j){return P.exit(j)}}
3
- export{y as Ug,A as Vg,T as Wg};
4
-
5
- //# debugId=6CD53DADDD8CD4E664756E2164756E21
@@ -1,11 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../http/requestContext.ts", "../http/Metadata.ts"],
4
- "sourcesContent": [
5
- "import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { HttpRequest } from \"./HttpRequest\";\nimport { Metadata } from \"./Metadata\";\nimport type { ByteRange } from \"./range\";\n// Type-only: `services/router` imports from `http`, so a runtime import here\n// would be circular.\nimport type { ServerQueryStore } from \"../services/router/ServerQueryStore\";\n\nexport interface CreateCookieOptions {\n maxAge?: number;\n expires?: Date;\n httpOnly?: boolean;\n secure?: boolean;\n sameSite?: \"Strict\" | \"Lax\";\n path?: string;\n domain?: string;\n partitioned?: boolean;\n}\n\nexport function createCookie(\n name: string,\n value: string,\n options: CreateCookieOptions = {},\n) {\n return [\n `${name}=${value}`,\n options.maxAge ? `Max-Age=${options.maxAge}` : \"\",\n options.httpOnly ? \"HttpOnly\" : \"\",\n options.secure ? \"Secure\" : \"\",\n options.sameSite ? `SameSite=${options.sameSite}` : \"SameSite=Strict\",\n options.path ? `Path=${options.path}` : \"Path=/\",\n options.domain ? `Domain=${options.domain}` : \"\",\n options.expires ? `Expires=${options.expires.toUTCString()}` : \"\",\n options.partitioned ? \"Partitioned\" : \"\",\n ]\n .filter((i) => i !== \"\")\n .join(\"; \");\n}\n\nconst requestContext = new AsyncLocalStorage<Store>();\n\n/**\n * What a route's request context takes over from the global middleware list's\n * (see `runGlobalMiddleware`): the user, so one the list resolved is not\n * looked up a second time.\n */\nexport interface CarriedContext {\n user: any;\n}\n\nclass Store {\n cookies: Set<string> = new Set();\n headers: Headers = new Headers();\n /**\n * Every server-side query of this request — prefetched or discovered during\n * the streaming render. Assigned by the view router (or lazily by the\n * `Query` facade); `null` for api requests, which must not query themselves.\n */\n serverQueries: ServerQueryStore | null = null;\n user: any = null;\n csrfHmac: string | null = null;\n locale: string | null = null;\n metadata = new Metadata();\n /**\n * The parsed `Range` of the in-flight request, picked up by\n * `FileStorage.read()` so a range reaches the storage backend without every\n * handler having to thread it through by hand.\n *\n * Only populated inside a `this.stream()` route, and cleared once that route\n * returns: a `FileStorage.read()` in an ordinary handler must never start\n * silently returning partial bytes.\n */\n rangeRequest: ByteRange | null = null;\n\n /**\n * This request's `session_id`, once read or minted.\n *\n * The cookie itself cannot answer for it. `setCookie` appends a *serialized*\n * `Set-Cookie` string to `cookies`, so a value written during this request is\n * not readable back out of it, and `req.cookies` still holds only what the\n * browser sent. Anything needing the id in the same request that mints it —\n * feature-flag bucketing, most obviously — has to read it from here.\n */\n sessionId: string | null = null;\n\n /**\n * This request's feature-flag evaluations, computed once.\n *\n * One map per request is what keeps a handler and the SSR payload from\n * disagreeing: a percentage rollout evaluated twice would be consistent\n * anyway — the bucketing is deterministic — but an attribute hook reading a\n * clock, or a `now`-based rule, would not be. Anything the page renders and\n * anything the server branched on have to be the same answer.\n */\n featureEvaluations: Map<string, unknown> | null = null;\n /** The context those evaluations were made against, built at most once. */\n featureContext: unknown = null;\n /** Bucket memo, shared across every flag evaluated for this request. */\n featureBuckets: Map<string, number> | null = null;\n\n /**\n * What `waitUntil` was handed and has not settled yet. Public only because\n * `req.ctx()`'s declared type spells this class out, which a private field\n * cannot be part of; nothing outside the store should touch either.\n */\n pendingWork = new Set<Promise<void>>();\n ended = false;\n\n constructor(public req: HttpRequest) {}\n\n /**\n * Keeps this request open until `work` settles: the api router holds\n * `onRequestEnd` and `destroy()` back until then, so code in `work` still\n * finds `user`, headers and cookies here.\n *\n * For work that outlives the response on purpose. An agent run is the\n * reason it exists: a client that disconnects has not stopped the run, and\n * its next tool call still reads the user who started it. Ignored once the\n * request has ended — there is nothing left to hold open.\n *\n * Only api routes honour this. A view request ends regardless, so work\n * handed to its store — a run started in a view loader — finds no user.\n */\n waitUntil(work: PromiseLike<unknown>) {\n if (this.ended) {\n return;\n }\n const settled = Promise.resolve(work).then(\n () => {},\n () => {},\n );\n this.pendingWork.add(settled);\n void settled.then(() => this.pendingWork.delete(settled));\n }\n\n /** Whether anything handed to `waitUntil` is still running. */\n hasPendingWork() {\n return this.pendingWork.size > 0;\n }\n\n /**\n * Settles once everything handed to `waitUntil` has, including work added\n * while waiting — a run can start another before it ends.\n */\n async whenIdle() {\n while (this.pendingWork.size > 0) {\n await Promise.all(Array.from(this.pendingWork));\n }\n }\n\n setLocale(locale: string) {\n this.locale = locale;\n }\n\n renderMeta() {\n return this.metadata.render();\n }\n\n setCSRFHmac(hmac: string) {\n this.csrfHmac = hmac;\n }\n\n setCookie(name: string, value: string, options: CreateCookieOptions = {}) {\n this.cookies.add(createCookie(name, value, options));\n }\n\n /**\n * A cookie set with a `domain` or `path` is only cleared by a deletion that\n * names the same ones.\n */\n deleteCookie(name: string, options: Pick<CreateCookieOptions, \"domain\" | \"path\"> = {}) {\n this.cookies.add(createCookie(name, \"\", { ...options, maxAge: -1 }));\n }\n\n setHeaders(name: string, value: string) {\n this.headers.set(name, value);\n }\n\n setUser(user: any) {\n this.user = user;\n }\n\n setRequest(req: HttpRequest<any, any>) {\n this.req = req;\n }\n\n destroy() {\n this.ended = true;\n delete this.cookies;\n delete this.headers;\n this.serverQueries = null;\n this.sessionId = null;\n this.featureEvaluations = null;\n this.featureContext = null;\n this.featureBuckets = null;\n delete this.user;\n }\n}\n\nexport const SESSION_ID_COOKIE = \"session_id\";\n\n/**\n * The `session_id` the browser sent, or the one minted earlier in this request.\n * Never mints one, so it is safe on an api request, where a `Set-Cookie` nobody\n * asked for would be a surprise.\n *\n * `null` outside a request, and for an anonymous visitor whose first request is\n * not a view — both meaning \"no stable subject\", which callers must handle\n * rather than paper over with a random value. A per-call random id would give\n * every request its own bucket, which is worse than no bucketing at all: a\n * percentage rollout would reshuffle on every page load.\n *\n * ## It is client-supplied, and unauthenticated\n *\n * Whatever the browser sent, unvalidated. It is a bucketing subject, not a\n * credential — never authenticate or authorize on it. A visitor can pick a value\n * that lands them in any percentage rollout, and signing it would not change\n * that: they can discard the cookie and collect fresh ones until one does. Load\n * bearing enough to state, because `.feature()` route gating is built on top of\n * evaluation — see its documentation for what may safely gate a route.\n */\nexport function sessionId(): string | null {\n const store = RequestContext.getStore();\n if (!store) {\n return null;\n }\n if (store.sessionId) {\n return store.sessionId;\n }\n const sent = store.req?.cookies?.get(SESSION_ID_COOKIE);\n if (sent) {\n store.sessionId = sent;\n }\n return store.sessionId;\n}\n\n/**\n * The same, but mints and sets the cookie when the browser sent none.\n *\n * Call this once per **view** request, early enough that everything downstream —\n * flag evaluation included — sees the same id the browser is about to be given.\n * It used to live inline in `ViewRouteDispatcher.onRequestEnd`, which ran only\n * on the document path and only after the response was decided, so a client-side\n * navigation minted nothing and a first-ever visitor had no id at the point\n * flags were evaluated.\n */\nexport function ensureSessionId(): string | null {\n const store = RequestContext.getStore();\n if (!store) {\n return null;\n }\n const existing = sessionId();\n if (existing) {\n return existing;\n }\n\n const minted = Bun.randomUUIDv7();\n store.sessionId = minted;\n store.setCookie(SESSION_ID_COOKIE, minted, {\n httpOnly: true,\n secure: process.env.NODE_ENV === \"production\",\n // `Lax`, not `Strict`, and the difference is load-bearing. `Strict`\n // withholds the cookie on cross-site *top-level navigation*, so a visitor\n // arriving from a search result or a shared link would arrive without it,\n // be minted a new id, and overwrite the old one — re-bucketing on every\n // external entry, which is how most anonymous traffic arrives. This is not\n // a credential (`access_token` stays `Strict`); it is an opaque bucketing\n // id, and `Lax` still blocks cross-site POST.\n sameSite: \"Lax\",\n expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * 365),\n });\n return minted;\n}\n\nexport class RequestContext {\n static getStore() {\n return requestContext.getStore()!;\n }\n\n static setRequest(req: HttpRequest<any, any>) {\n requestContext.getStore().req = req;\n }\n\n /**\n * Opens a fresh request scope. `carried` seeds it with what the global\n * middleware list resolved for the same request; nothing else crosses over.\n */\n static run<T>(\n httpRequest: HttpRequest,\n fn: () => T,\n carried?: CarriedContext | null,\n ): T {\n const store = new Store(httpRequest);\n if (carried) {\n store.user = carried.user;\n }\n return requestContext.run(store, fn);\n }\n\n /**\n * Re-enters an *existing* request scope. Stream lifecycle callbacks fire\n * after the HTTP server has taken over the response body — outside the\n * AsyncLocalStorage scope the request ran in — so the view router captures\n * the live store and re-enters it around user-facing hooks, keeping\n * `req.ctx()` (and everything context-backed) working inside them.\n */\n static runWith<T>(store: Store, fn: () => T): T {\n return requestContext.run(store, fn);\n }\n\n /**\n * Runs `fn` outside any request scope, as the server's own `fetch` handler\n * is. For a request dispatched from inside another one, which must start from\n * where a client's request would, not from its initiator's store.\n */\n static exit<T>(fn: () => T): T {\n return requestContext.exit(fn);\n }\n}\n",
6
- "export type OpenGraphParams = {\n title: string;\n description?: string;\n type: string;\n url: string;\n image: string;\n imageAlt?: string;\n imageWidth?: number;\n imageHeight?: number;\n twitterImage?: string;\n twitterImageAlt?: string;\n twitterImageWidth?: number;\n twitterImageHeight?: number;\n};\n/**\n * Attributes for the document's `<html>` element, handed to the root (or a\n * static view's) layout as its `htmlAttributes` prop.\n */\nexport type HtmlAttributes = {\n /** The document's language, e.g. `\"tr\"`. Defaults to the request's locale. */\n lang?: string;\n /** Text direction. Defaults to the one `lang` is written in. */\n dir?: \"ltr\" | \"rtl\" | \"auto\";\n};\n\n/** One `<link rel=\"alternate\" hreflang>`: the same page in another language. */\nexport type AlternateLink = {\n /** A BCP 47 tag, or `\"x-default\"` for the page to use when none matches. */\n hrefLang: string;\n href: string;\n};\n\nexport class Metadata {\n content: any = {\n title: \"Gemi App\",\n description: null,\n openGraph: null,\n htmlAttributes: null,\n canonical: null,\n alternates: null,\n };\n\n /**\n * Whether a handler set anything, as opposed to `content` still being the\n * defaults. A partially rendered response that touched no metadata sends\n * none, so the client keeps what the skipped segments put there.\n */\n touched = false;\n\n render() {\n return {\n title: this.content.title,\n description: this.content.description,\n openGraph: this.content.openGraph,\n htmlAttributes: this.content.htmlAttributes,\n canonical: this.content.canonical,\n alternates: this.content.alternates,\n };\n }\n\n /** Merged into what earlier calls set; `undefined` leaves an attribute alone. */\n htmlAttributes(attributes: HtmlAttributes) {\n this.touched = true;\n const defined = Object.fromEntries(\n Object.entries(attributes).filter(([, value]) => value !== undefined),\n );\n this.content.htmlAttributes = { ...this.content.htmlAttributes, ...defined };\n }\n\n canonical(url: string) {\n this.touched = true;\n this.content.canonical = url;\n }\n\n alternates(links: AlternateLink[]) {\n this.touched = true;\n this.content.alternates = links;\n }\n\n title(title: string) {\n this.touched = true;\n this.content.title = title;\n }\n\n description(description: string) {\n this.touched = true;\n this.content.description = description;\n }\n\n openGraph({\n title,\n description,\n type,\n url,\n image,\n imageAlt,\n imageWidth,\n imageHeight,\n twitterImage = image,\n twitterImageAlt = imageAlt,\n twitterImageWidth = imageWidth,\n twitterImageHeight = imageHeight,\n }: OpenGraphParams) {\n this.touched = true;\n let _image = image;\n let _twitterImage = twitterImage;\n if (image && !image.startsWith(\"http\")) {\n _image = `${process.env.HOST_NAME}${image}`;\n _twitterImage = `${process.env.HOST_NAME}${twitterImage}`;\n }\n this.content.openGraph = Object.fromEntries(\n Object.entries({\n title,\n description,\n type,\n url,\n image: _image,\n imageAlt,\n imageWidth,\n imageHeight,\n twitterImage: _twitterImage,\n twitterImageAlt,\n twitterImageWidth,\n twitterImageHeight,\n }).filter(([_, value]) => value !== undefined),\n );\n }\n}\n"
7
- ],
8
- "mappings": ";AAAA,4BAAS,oBCgCF,MAAM,CAAS,CACpB,QAAe,CACb,MAAO,WACP,YAAa,KACb,UAAW,KACX,eAAgB,KAChB,UAAW,KACX,WAAY,IACd,EAOA,QAAU,GAEV,MAAM,EAAG,CACP,MAAO,CACL,MAAO,KAAK,QAAQ,MACpB,YAAa,KAAK,QAAQ,YAC1B,UAAW,KAAK,QAAQ,UACxB,eAAgB,KAAK,QAAQ,eAC7B,UAAW,KAAK,QAAQ,UACxB,WAAY,KAAK,QAAQ,UAC3B,EAIF,cAAc,CAAC,EAA4B,CACzC,KAAK,QAAU,GACf,IAAM,EAAU,OAAO,YACrB,OAAO,QAAQ,CAAU,EAAE,OAAO,GAAI,KAAW,IAAU,MAAS,CACtE,EACA,KAAK,QAAQ,eAAiB,IAAK,KAAK,QAAQ,kBAAmB,CAAQ,EAG7E,SA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AK,mBAAqB,KAC1B,KAAK,eAAiB,KACtB,KAAK,eAAiB,KACtB,OAAO,KAAK,KAEhB,CAEO,IAAM,EAAoB,aAsB1B,SAAS,CAAS,EAAkB,CACzC,IAAM,EAAQ,EAAe,SAAS,EACtC,GAAI,CAAC,EACH,OAAO,KAET,GAAI,EAAM,UACR,OAAO,EAAM,UAEf,IAAM,EAAO,EAAM,KAAK,SAAS,IAAI,CAAiB,EACtD,GAAI,EACF,EAAM,UAAY,EAEpB,OAAO,EAAM,UAaR,SAAS,CAAe,EAAkB,CAC/C,IAAM,EAAQ,EAAe,SAAS,EACtC,GAAI,CAAC,EACH,OAAO,KAET,IAAM,EAAW,EAAU,EAC3B,GAAI,EACF,OAAO,EAGT,IAAM,EAAS,IAAI,aAAa,EAehC,OAdA,EAAM,UAAY,EAClB,EAAM,UAAU,EAAmB,EAAQ,CACzC,SAAU,GACV,OAAQ,mBAAyB,aAQjC,SAAU,MACV,QAAS,IAAI,KAAK,KAAK,IAAI,EAAI,WAAyB,CAC1D,CAAC,EACM,EAGF,MAAM,CAAe,OACnB,SAAQ,EAAG,CAChB,OAAO,EAAe,SAAS,QAG1B,WAAU,CAAC,EAA4B,CAC5C,EAAe,SAAS,EAAE,IAAM,QAO3B,IAAM,CACX,EACA,EACA,EACG,CACH,IAAM,EAAQ,IAAI,EAAM,CAAW,EACnC,GAAI,EACF,EAAM,KAAO,EAAQ,KAEvB,OAAO,EAAe,IAAI,EAAO,CAAE,QAU9B,QAAU,CAAC,EAAc,EAAgB,CAC9C,OAAO,EAAe,IAAI,EAAO,CAAE,QAQ9B,KAAO,CAAC,EAAgB,CAC7B,OAAO,EAAe,KAAK,CAAE,EAEjC",
9
- "debugId": "6CD53DADDD8CD4E664756E2164756E21",
10
- "names": []
11
- }
@@ -1,24 +0,0 @@
1
- // @bun
2
- import{S as D,T as KJ,U as OJ}from"./chunk-6d8rvr1v.js";import{na as B,ra as L,sa as UJ}from"./chunk-frerzsxq.js";import{Ca as e}from"./chunk-4mfrgd5m.js";import"./chunk-5stgtwqw.js";import{Nc as a,qe as QJ,re as A}from"./chunk-ms9k0rx6.js";import"./chunk-whtzggn6.js";import"./chunk-hytt9qyj.js";import{cg as o,dg as n,gg as i}from"./chunk-pn8v6fj2.js";import{Tg as WJ}from"./chunk-15c2vgaf.js";import"./chunk-49nyyjfe.js";import"./chunk-tn2bryy2.js";import"./chunk-cbqazg9k.js";import"./chunk-1myhm0g3.js";import"./chunk-kejwjerj.js";import"./chunk-aazmrxj9.js";import"./chunk-jmg2zsaf.js";import"./chunk-t4yh4nf9.js";import"./chunk-1vzks22y.js";import"./chunk-zyt2w03d.js";import{ni as YJ}from"./chunk-1hr4xht1.js";import{oi as N}from"./chunk-d9mar37g.js";import"./chunk-vw8849ys.js";import{join as w,resolve as VJ,sep as zJ}from"path";import{Duplex as qJ}from"stream";import{constants as P,createBrotliCompress as TJ,createGzip as RJ}from"zlib";var bJ=["br","gzip"],kJ=1024,SJ=5,wJ=19,vJ=6;function EJ(J){if(J===void 0)return 1;if(!/^\d+(\.\d{0,3})?$/.test(J.trim()))return 1;let $=Number(J.trim());return Number.isFinite($)?Math.min($,1):1}function yJ(J){if(J===null||J===void 0)return null;let $=new Map;for(let Z of J.split(",")){let[X,...Q]=Z.split(";"),W=X.trim().toLowerCase();if(W==="")continue;let j=1;for(let Y of Q){let K=Y.indexOf("=");if(K===-1)continue;if(Y.slice(0,K).trim().toLowerCase()==="q"){j=EJ(Y.slice(K+1));break}}$.set(W,j)}return $}function b(J,$=bJ){let Z=yJ(J);if(!Z)return null;let X=Z.get("*"),Q=null,W=0;for(let j of $){let Y=Z.get(j)??X??0;if(Y>W)Q=j,W=Y}return Q}function gJ(J,$){if(!J)return!1;return J.split(",").some((Z)=>Z.trim().toLowerCase().split("=")[0].trim()===$)}function fJ(J,$){if(J==="HEAD")return!1;if($.status<200||$.status===204||$.status===206||$.status===304)return!1;if($.headers.has("Content-Range"))return!1;let Z=$.headers.get("Content-Type");if(!Z||!/^\s*text\/html\s*(;|$)/i.test(Z))return!1;if(!$.body)return!1;let X=$.headers.get("Content-Encoding");if(X&&X.trim().toLowerCase()!=="identity")return!1;if(gJ($.headers.get("Cache-Control"),"no-transform"))return!1;let Q=$.headers.get("Content-Length");if(Q!==null&&Number(Q)<kJ)return!1;return!0}function mJ(J){let $=J==="br"?TJ({params:{[P.BROTLI_PARAM_QUALITY]:SJ,[P.BROTLI_PARAM_LGWIN]:wJ},flush:P.BROTLI_OPERATION_FLUSH}):RJ({level:vJ,flush:P.Z_SYNC_FLUSH});return qJ.toWeb($)}function uJ(J){let $=J.get("Vary");if(!$){J.set("Vary","Accept-Encoding");return}let Z=$.split(",").map((X)=>X.trim().toLowerCase());if(Z.includes("*")||Z.includes("accept-encoding"))return;J.append("Vary","Accept-Encoding")}function c(J,$){if(!fJ(J.method,$))return $;let Z=new Headers($.headers);uJ(Z);let X=b(J.headers.get("Accept-Encoding"));if(!X)return new Response($.body,{status:$.status,statusText:$.statusText,headers:Z});let Q;try{Q=mJ(X)}catch{return new Response($.body,{status:$.status,statusText:$.statusText,headers:Z})}return Z.set("Content-Encoding",X),Z.delete("Content-Length"),new Response($.body.pipeThrough(Q),{status:$.status,statusText:$.statusText,headers:Z})}import{readdir as nJ,stat as t}from"fs/promises";import{join as iJ}from"path";import{mkdir as U2,readFile as hJ,stat as K2,writeFile as O2}from"fs/promises";import{dirname as z2,join as cJ}from"path";import{promisify as p}from"util";import{brotliCompress as pJ,constants as C2,gzip as dJ}from"zlib";var lJ=".vite/static-assets.json";var d={br:".br",gzip:".gz"},oJ=["br","gzip"],I2=p(pJ),F2=p(dJ);async function l(J){let $;try{$=await hJ(cJ(J,lJ),"utf8")}catch{return null}let Z;try{Z=JSON.parse($)?.files}catch{return null}if(!Z||typeof Z!=="object")return null;let X={files:{}};for(let[Q,W]of Object.entries(Z)){if(!Array.isArray(W))continue;X.files[Q]=oJ.filter((j)=>W.includes(j))}return X}function k(J){let $=J.toString(),Z=new Bun.CryptoHasher("sha1");return Z.update($),Z.digest("hex")}async function r(J){let $=new Set;async function Z(X,Q){let W;try{W=await nJ(X,{withFileTypes:!0})}catch{return}for(let j of W){if(j.name.startsWith("."))continue;if(Q&&j.name==="assets")continue;let Y=iJ(X,j.name),K=j.isDirectory(),V=j.isFile();if(j.isSymbolicLink())try{let I=await t(Y);K=I.isDirectory(),V=I.isFile()}catch{continue}if(V)$.add(Y);else if(K&&!j.isSymbolicLink())await Z(Y,!1)}}return await Z(J,!0),$}var aJ="public, max-age=31536000, must-revalidate",tJ="public, max-age=31536000, immutable";async function rJ(J,$,Z){if(Z.length===0||J.headers.has("Range"))return null;let X=b(J.headers.get("Accept-Encoding"),Z);if(!X)return null;let Q=$+d[X];try{let W=await t(Q);return W.isFile()?{encoding:X,path:Q,size:W.size}:null}catch{return null}}async function s(J,$,Z={}){let X=Bun.file($),Q=Z.encodings??[],W={"Content-Type":X.type||"application/octet-stream","Cache-Control":Z.immutable?tJ:aJ,"Accept-Ranges":"bytes"};if(Q.length>0)W.Vary="Accept-Encoding";let j=await rJ(J,$,Q);if(j){let V=Bun.file(j.path);return new Response(V.stream(),{headers:{...W,"Content-Encoding":j.encoding,"Content-Length":String(j.size),ETag:`${k(V.lastModified)}-${j.encoding}`}})}let Y=X.size;W.ETag=k(X.lastModified);let K=o(J.headers.get("Range"));if(K){let V=n(K,Y);if(!V)return a(Y);return new Response(X.slice(V.start,V.end+1).stream(),{status:206,headers:{...W,"Content-Range":i(V.start,V.end,Y),"Content-Length":String(V.length)}})}return new Response(X.stream(),{headers:{...W,"Content-Length":String(Y)}})}import{stat as Z2}from"fs/promises";var _="app/client.tsx";function JJ(J,$=B){let Z=J[_]?.file;if(!Z)return;return{module:L(Z,$),preload:M(J,_,$)}}function M(J,$,Z=B){let X=[],Q=new Set,W=(j)=>{if(Q.has(j))return;Q.add(j);let Y=J[j];if(!Y?.file)return;X.push(L(Y.file,Z));for(let K of Y.imports??[])W(K)};return W($),X}function $J(J,$){let Z=[],X=new Set,Q=new Set,W=(j)=>{if(Q.has(j))return;Q.add(j);let Y=J[j];if(!Y)return;for(let K of Y.imports??[])W(K);for(let K of Y.css??[])if(!X.has(K))X.add(K),Z.push(K)};return W($),Z}function ZJ(J,$=B){let Z=new Map;return(X)=>{if(!Z.has(X)){let Q=`${X}${e}`,W=J[Q]?.file;Z.set(X,W?{src:L(W,$),preload:M(J,Q,$)}:void 0)}return Z.get(X)}}function XJ(J,$=30000){let Z=JSON.stringify("gemi:chunk-reload"),X=JSON.stringify(`Failed to fetch dynamically imported module: ${J}`);return`var r=!1;try{var s=window.sessionStorage,m=JSON.parse(s.getItem(${Z})||"null");var d=m?Date.now()-m.at:NaN;if(navigator.onLine!==!1&&!(d>=0&&d<${$})){s.setItem(${Z},JSON.stringify({url:window.location.href,at:Date.now()}));r=!0}}catch(e){}if(r)window.location.reload();else throw new Error(${X});export {}`}var sJ=new RegExp(`^${QJ}/.+\\.m?js$`);function eJ(J){return sJ.test(J)}function HJ(J){if(eJ(J))return new Response(XJ(J),{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store"}});if(A(J))return new Response("Not found",{status:404});return}var J2=`<!DOCTYPE html>
3
- <html lang="en">
4
- <head>
5
- <meta charset="UTF-8" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
- <title>Internal Server Error</title>
8
- <style>
9
- body { font-family: system-ui, sans-serif; margin: 0; min-height: 100vh; display: grid; place-items: center; }
10
- main { text-align: center; padding: 16px; }
11
- h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }
12
- p { margin: 0; opacity: 0.7; }
13
- </style>
14
- </head>
15
- <body>
16
- <main>
17
- <h1>Something went wrong</h1>
18
- <p>Please try again later.</p>
19
- </main>
20
- </body>
21
- </html>`;function S(J,$,Z){if(!Z)console.error(J);else try{Z(J instanceof Error?J:Error(String(J),{cause:J}))}catch(X){console.error(J),console.error(X)}if(N($))return new Response(JSON.stringify({error:WJ("server_error","Internal Server Error",500)}),{status:500,headers:{"Content-Type":"application/json"}});return new Response(J2,{status:500,headers:{"Content-Type":"text/html; charset=utf-8"}})}var $2={kind:"none"};function jJ(J){let $=(J??"").trim().toLowerCase();if($===""||$==="false"||$==="off"||$==="0")return $2;if($==="true")return{kind:"all"};if(/^[1-9]\d*$/.test($))return{kind:"hops",hops:Number($)};throw Error(`GEMI_TRUST_PROXY must be "false", "true" or the number of proxies in front of the app (e.g. 1). Got ${JSON.stringify(J)}.`)}function GJ(J,$,Z){if(Z.kind==="all"){if(!J.get("x-forwarded-for")&&$)J.set("x-forwarded-for",$);return}J.delete("x-real-ip");let X=$;if(Z.kind==="hops"){let Q=(J.get("x-forwarded-for")??"").split(",").map((j)=>j.trim()).filter(Boolean),W=Q.length-Z.hops;X=W>=0?Q[W]:Q[0]??$}if(X)J.set("x-forwarded-for",X);else J.delete("x-forwarded-for")}var q=YJ(),X2=w(q,"app"),x=w(q,"dist"),C=w(x,"client");function Q2(J){let $;try{$=decodeURIComponent(J)}catch{return null}let Z=VJ(C,"."+$.replace("/assets/assets","/assets"));return Z.startsWith(C+zJ)?Z:null}async function H2(J){try{return(await Z2(J)).isFile()}catch{return!1}}async function Z3(J,$){let Z=await import(`${x}/client/.vite/manifest.json`),X=await import(`${x}/server/.vite/manifest.json`),Q=await UJ(`${x}/client`);process.env.ROOT_DIR=q,process.env.APP_DIR=X2,process.env.DIST_DIR=x;let W={},j={},Y={},K={},V={},I=(H,G)=>`"${H}": () => import("${G}")`,v=[];for(let H of["404",...J.getFlatComponentTree.call(J)]){let G=X[`app/views/${H}.tsx`];if(!G?.file){console.log(`Server file not found for ${H}`),console.log(G);let z=Object.keys(X),F=`app/views/${H}.tsx`;console.log(`${F} not found in server manifest`),console.log(z)}let U=await import(`${process.env.DIST_DIR}/server/${G?.file}`);W[H]=U.default,j[H]=U.OpenGraph,Y[H]=U;let O=Z[`app/views/${H}.tsx`];if(O?.css&&O?.css.length>0)K[H]=O?.css;if(O)v.push(I(H,L(O?.file,Q))),V[H]=M(Z,`app/views/${H}.tsx`,Q)}let xJ=`{${v.join(",")}}`,E=JJ(Z,Q);if(!E)console.error(`Client manifest has no "${_}" entry \u2014 dist/client is incomplete, so documents will render but never hydrate.`);let LJ=Z["app/client.tsx"]?.css??[],y=(await Promise.all(LJ.map((H)=>Bun.file(`${x}/client/${H}`).text()))).join(`
22
- `),CJ=ZJ(Z,Q),g=new Map,IJ=(H)=>{let G=g.get(H);if(!G)G=Bun.file(`${x}/client/${H}`).text(),g.set(H,G);return G},FJ=async(H,G)=>{let U=new Set;for(let z of G?[G,...H]:H)for(let F of $J(Z,`app/views/${z}.tsx`))U.add(F);let O=await Promise.all([...U].map(async(z)=>({id:z,content:await IJ(z)})));return D(G?O:[{content:y},...O])},PJ=await r(C),f=new Map;for(let[H,G]of Object.entries((await l(C))?.files??{})){let U=VJ(C,H);if(U.startsWith(C+zJ))f.set(U,{immutable:!0,encodings:G})}async function _J(H){let{pathname:G}=new URL(H.url);if(N(G))return await T(H,G);let U=Q2(G);if(A(G)||G.startsWith("/.well-known")||U!==null&&PJ.has(U)){if(!U||!await H2(U))return HJ(G)??await T(H,G);try{return await s(H,U,f.get(U))}catch(z){return J.onException?.(z),new Response("Not found",{status:404})}}return await T(H,G)}async function T(H,G){let U=J.fetch.bind(J);try{let O=await U(H);if(O instanceof Response)return O;else{let z=[];return z.push({content:y}),await O({getStyles:async(R,u)=>{if(!R)return D([]);if(u?.static)return FJ(R,u.layout);for(let AJ of R){let NJ=Z[`app/views/${AJ}.tsx`];for(let h of NJ?.css??[]){let DJ=Bun.file(`${process.env.DIST_DIR}/client/${h}`);z.push({id:h,content:await DJ.text()})}}return D(z)},clientEntry:E,modulePreloadManifest:V,loaders:xJ,viewImportMap:W,viewModules:Y,ogMap:j,cssManifest:K,assetBase:Q,resolveIsland:CJ})}}catch(O){return S(O,G,J.onException)}}let BJ=(process.env.GEMI_COMPRESSION??"auto").toLowerCase()!=="off",MJ=jJ(process.env.GEMI_TRUST_PROXY),m=Bun.serve({maxRequestBodySize:10737418240,fetch:async(H,G)=>{GJ(H.headers,G.requestIP(H)?.address??null,MJ);let U=await $(H,(O)=>J.withGlobalMiddleware(O,_J,(z)=>S(z,new URL(O.url).pathname,J.onException)));return BJ?c(H,U):U},idleTimeout:OJ(),port:process.env.PORT||5173});return KJ({port:m.port,rootDir:q}),m}export{Z3 as httpProd};
23
-
24
- //# debugId=436C7117592AA70664756E2164756E21