gemi 0.123.0 → 0.125.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.
- package/dist/ai/AgentController.d.ts +185 -3
- package/dist/ai/AgentController.d.ts.map +1 -1
- package/dist/ai/client/index.d.ts +1 -1
- package/dist/ai/client/index.d.ts.map +1 -1
- package/dist/ai/client/index.js +38 -9
- package/dist/ai/client/index.js.map +1 -1
- package/dist/ai/client/reducer.d.ts.map +1 -1
- package/dist/ai/index.d.ts +2 -2
- package/dist/ai/index.d.ts.map +1 -1
- package/dist/ai/index.js +31 -48
- package/dist/ai/index.js.map +6 -15
- package/dist/ai/types.d.ts +26 -0
- package/dist/ai/types.d.ts.map +1 -1
- package/dist/ai/useChat.d.ts +35 -2
- package/dist/ai/useChat.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/auth/AuthController.d.ts.map +1 -1
- package/dist/auth/AuthManager.d.ts +11 -0
- package/dist/auth/AuthManager.d.ts.map +1 -1
- package/dist/auth/AuthServiceProvider.d.ts +2 -0
- package/dist/auth/AuthServiceProvider.d.ts.map +1 -1
- package/dist/auth/config.d.ts +71 -2
- package/dist/auth/config.d.ts.map +1 -1
- package/dist/auth/oauth/providers.d.ts +10 -0
- package/dist/auth/oauth/providers.d.ts.map +1 -0
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-fyk07w01.js → chunk-0x1s02r1.js} +3 -3
- package/dist/{chunk-fyk07w01.js.map → chunk-0x1s02r1.js.map} +1 -1
- package/dist/{chunk-ycsrpf47.js → chunk-1jcngq6w.js} +3 -3
- package/dist/{chunk-ycsrpf47.js.map → chunk-1jcngq6w.js.map} +1 -1
- package/dist/{chunk-gwnmgkq5.js → chunk-1mxb44n9.js} +2 -2
- package/dist/{chunk-gwnmgkq5.js.map → chunk-1mxb44n9.js.map} +1 -1
- package/dist/{chunk-y67evsdy.js → chunk-1n40bdxf.js} +2 -2
- package/dist/{chunk-y67evsdy.js.map → chunk-1n40bdxf.js.map} +1 -1
- package/dist/chunk-1xmh61fg.js +5 -0
- package/dist/{chunk-tazvfppr.js.map → chunk-1xmh61fg.js.map} +1 -1
- package/dist/{chunk-sxa70wgn.js → chunk-3br5zr7a.js} +3 -3
- package/dist/{chunk-sxa70wgn.js.map → chunk-3br5zr7a.js.map} +1 -1
- package/dist/{chunk-w61sphn5.js → chunk-3kxe9geg.js} +3 -3
- package/dist/{chunk-w61sphn5.js.map → chunk-3kxe9geg.js.map} +1 -1
- package/dist/{chunk-w0jfqnw9.js → chunk-5fh4pvyt.js} +2 -2
- package/dist/{chunk-w0jfqnw9.js.map → chunk-5fh4pvyt.js.map} +1 -1
- package/dist/{chunk-hnrzm5pf.js → chunk-6gwxvmjv.js} +3 -3
- package/dist/{chunk-hnrzm5pf.js.map → chunk-6gwxvmjv.js.map} +1 -1
- package/dist/{chunk-j0cnsgjq.js → chunk-6q6bhkyf.js} +1 -1
- package/dist/{chunk-5a4qbtez.js → chunk-6vz75swk.js} +2 -2
- package/dist/{chunk-5a4qbtez.js.map → chunk-6vz75swk.js.map} +1 -1
- package/dist/chunk-6wgh7nk6.js +15 -0
- package/dist/{chunk-z23h4s1a.js.map → chunk-6wgh7nk6.js.map} +6 -5
- package/dist/chunk-7vrrgxwm.js +22 -0
- package/dist/chunk-7vrrgxwm.js.map +21 -0
- package/dist/{chunk-kvas36p6.js → chunk-7zj6bk9a.js} +2 -2
- package/dist/{chunk-kvas36p6.js.map → chunk-7zj6bk9a.js.map} +1 -1
- package/dist/{chunk-kdjhgtp9.js → chunk-8tvfmy1a.js} +4 -4
- package/dist/{chunk-kdjhgtp9.js.map → chunk-8tvfmy1a.js.map} +1 -1
- package/dist/{chunk-vd6zn8c4.js → chunk-910p6ne6.js} +2 -2
- package/dist/{chunk-vd6zn8c4.js.map → chunk-910p6ne6.js.map} +1 -1
- package/dist/{chunk-96a1459v.js → chunk-ap3g6rbw.js} +2 -2
- package/dist/{chunk-96a1459v.js.map → chunk-ap3g6rbw.js.map} +1 -1
- package/dist/{chunk-4qpypa3h.js → chunk-ayfjjgv2.js} +1 -1
- package/dist/chunk-b4x1dt3s.js +10 -0
- package/dist/chunk-b4x1dt3s.js.map +43 -0
- package/dist/{chunk-aafanq8n.js → chunk-b7a22evs.js} +3 -3
- package/dist/{chunk-aafanq8n.js.map → chunk-b7a22evs.js.map} +1 -1
- package/dist/{chunk-rjtmgbay.js → chunk-bny9s44t.js} +2 -2
- package/dist/{chunk-rjtmgbay.js.map → chunk-bny9s44t.js.map} +1 -1
- package/dist/{chunk-k17wx7gz.js → chunk-by5gwr8x.js} +2 -2
- package/dist/{chunk-k17wx7gz.js.map → chunk-by5gwr8x.js.map} +1 -1
- package/dist/{chunk-53hc0ah1.js → chunk-c0qpv8x7.js} +2 -2
- package/dist/{chunk-53hc0ah1.js.map → chunk-c0qpv8x7.js.map} +1 -1
- package/dist/{chunk-9t08wbkd.js → chunk-cpem1j1x.js} +2 -2
- package/dist/{chunk-9t08wbkd.js.map → chunk-cpem1j1x.js.map} +1 -1
- package/dist/{chunk-vwnd4jb5.js → chunk-crnfxn9n.js} +2 -2
- package/dist/{chunk-vwnd4jb5.js.map → chunk-crnfxn9n.js.map} +1 -1
- package/dist/{chunk-s5jxc63j.js → chunk-cwt8e782.js} +3 -3
- package/dist/{chunk-s5jxc63j.js.map → chunk-cwt8e782.js.map} +1 -1
- package/dist/{chunk-0tc0j3pf.js → chunk-dxyxd7b3.js} +2 -2
- package/dist/{chunk-0tc0j3pf.js.map → chunk-dxyxd7b3.js.map} +1 -1
- package/dist/{chunk-nf608sb1.js → chunk-dy58aztm.js} +2 -2
- package/dist/{chunk-nf608sb1.js.map → chunk-dy58aztm.js.map} +1 -1
- package/dist/chunk-entpqjyn.js +5 -0
- package/dist/chunk-entpqjyn.js.map +10 -0
- package/dist/{chunk-qen6587t.js → chunk-eq5svwca.js} +2 -2
- package/dist/{chunk-qen6587t.js.map → chunk-eq5svwca.js.map} +1 -1
- package/dist/{chunk-n1a2zj5z.js → chunk-erzfs4t2.js} +2 -2
- package/dist/{chunk-n1a2zj5z.js.map → chunk-erzfs4t2.js.map} +3 -3
- package/dist/{chunk-pfm9ngch.js → chunk-ex41d03h.js} +2 -2
- package/dist/{chunk-pfm9ngch.js.map → chunk-ex41d03h.js.map} +1 -1
- package/dist/{chunk-fxxbwyce.js → chunk-ey1xrbaz.js} +2 -2
- package/dist/{chunk-fxxbwyce.js.map → chunk-ey1xrbaz.js.map} +1 -1
- package/dist/chunk-eyptwf54.js +57 -0
- package/dist/{chunk-gvp6brdt.js.map → chunk-eyptwf54.js.map} +25 -22
- package/dist/{chunk-x0jahbqj.js → chunk-g52fcwca.js} +2 -2
- package/dist/{chunk-x0jahbqj.js.map → chunk-g52fcwca.js.map} +1 -1
- package/dist/{chunk-hs88b8gt.js → chunk-ghcvztxn.js} +2 -2
- package/dist/{chunk-hs88b8gt.js.map → chunk-ghcvztxn.js.map} +1 -1
- package/dist/{chunk-rjm1kj8n.js → chunk-gp00enrk.js} +1 -1
- package/dist/{chunk-08fcqny0.js → chunk-h8w9mzjj.js} +6 -6
- package/dist/{chunk-08fcqny0.js.map → chunk-h8w9mzjj.js.map} +7 -7
- package/dist/{chunk-9p7eq7bz.js → chunk-hff9w6rt.js} +2 -2
- package/dist/{chunk-9p7eq7bz.js.map → chunk-hff9w6rt.js.map} +1 -1
- package/dist/{chunk-ay8nat73.js → chunk-hxn0s3zh.js} +2 -2
- package/dist/{chunk-ay8nat73.js.map → chunk-hxn0s3zh.js.map} +1 -1
- package/dist/{chunk-de7hxe73.js → chunk-hzen9gh4.js} +2 -2
- package/dist/{chunk-de7hxe73.js.map → chunk-hzen9gh4.js.map} +1 -1
- package/dist/{chunk-xhmtph39.js → chunk-j10a0m7q.js} +1 -1
- package/dist/{chunk-wqharhrp.js → chunk-j12hpdxk.js} +1 -1
- package/dist/{chunk-bk2aheea.js → chunk-j5rwv09s.js} +2 -2
- package/dist/{chunk-bk2aheea.js.map → chunk-j5rwv09s.js.map} +1 -1
- package/dist/{chunk-zjej5vqh.js → chunk-jykkqwcy.js} +3 -3
- package/dist/{chunk-zjej5vqh.js.map → chunk-jykkqwcy.js.map} +1 -1
- package/dist/{chunk-9a9ef0f1.js → chunk-k1ebt28j.js} +2 -2
- package/dist/{chunk-9a9ef0f1.js.map → chunk-k1ebt28j.js.map} +1 -1
- package/dist/{chunk-q1e3q01h.js → chunk-kcsa57km.js} +2 -2
- package/dist/{chunk-q1e3q01h.js.map → chunk-kcsa57km.js.map} +1 -1
- package/dist/{chunk-r5tadf14.js → chunk-khdkrfxp.js} +2 -2
- package/dist/{chunk-r5tadf14.js.map → chunk-khdkrfxp.js.map} +1 -1
- package/dist/{chunk-fsy344zb.js → chunk-knq4ack4.js} +2 -2
- package/dist/{chunk-fsy344zb.js.map → chunk-knq4ack4.js.map} +1 -1
- package/dist/{chunk-f1thqe6j.js → chunk-m7pghdcy.js} +2 -2
- package/dist/{chunk-f1thqe6j.js.map → chunk-m7pghdcy.js.map} +1 -1
- package/dist/{chunk-enta97jb.js → chunk-mmqnq1qh.js} +3 -3
- package/dist/{chunk-enta97jb.js.map → chunk-mmqnq1qh.js.map} +1 -1
- package/dist/{chunk-0qmc7snf.js → chunk-n3z83qhq.js} +2 -2
- package/dist/{chunk-0qmc7snf.js.map → chunk-n3z83qhq.js.map} +1 -1
- package/dist/{chunk-mxbtcaed.js → chunk-npbf06c1.js} +2 -2
- package/dist/{chunk-mxbtcaed.js.map → chunk-npbf06c1.js.map} +1 -1
- package/dist/{chunk-6gjvqtcp.js → chunk-p5df4pn7.js} +2 -2
- package/dist/{chunk-6gjvqtcp.js.map → chunk-p5df4pn7.js.map} +1 -1
- package/dist/{chunk-ywgvxx35.js → chunk-p6jbmcrg.js} +2 -2
- package/dist/{chunk-ywgvxx35.js.map → chunk-p6jbmcrg.js.map} +1 -1
- package/dist/{chunk-d3ywmeb7.js → chunk-p7mvp5nf.js} +2 -2
- package/dist/{chunk-d3ywmeb7.js.map → chunk-p7mvp5nf.js.map} +1 -1
- package/dist/{chunk-52xkw2bs.js → chunk-q6ah4yjg.js} +2 -2
- package/dist/{chunk-52xkw2bs.js.map → chunk-q6ah4yjg.js.map} +1 -1
- package/dist/{chunk-6pxavyh3.js → chunk-r923001x.js} +2 -2
- package/dist/{chunk-6pxavyh3.js.map → chunk-r923001x.js.map} +1 -1
- package/dist/{chunk-1f1sb3w7.js → chunk-rany5zgk.js} +2 -2
- package/dist/{chunk-1f1sb3w7.js.map → chunk-rany5zgk.js.map} +1 -1
- package/dist/{chunk-30xxc6r7.js → chunk-rmgkc3a2.js} +2 -2
- package/dist/{chunk-30xxc6r7.js.map → chunk-rmgkc3a2.js.map} +1 -1
- package/dist/{chunk-ebx5hnqn.js → chunk-rvspb96n.js} +3 -3
- package/dist/{chunk-ebx5hnqn.js.map → chunk-rvspb96n.js.map} +1 -1
- package/dist/{chunk-kzstewtm.js → chunk-rwmja4zs.js} +2 -2
- package/dist/{chunk-kzstewtm.js.map → chunk-rwmja4zs.js.map} +1 -1
- package/dist/{chunk-8x73yyfs.js → chunk-s4semb89.js} +1 -1
- package/dist/chunk-s4xg69r9.js +24 -0
- package/dist/{chunk-vpgbn494.js.map → chunk-s4xg69r9.js.map} +2 -2
- package/dist/{chunk-58ffbwdc.js → chunk-stn0a56e.js} +2 -2
- package/dist/{chunk-58ffbwdc.js.map → chunk-stn0a56e.js.map} +1 -1
- package/dist/{chunk-73v34hw8.js → chunk-sv125fqq.js} +2 -2
- package/dist/{chunk-73v34hw8.js.map → chunk-sv125fqq.js.map} +1 -1
- package/dist/{chunk-h76mddt3.js → chunk-t2t63wa0.js} +2 -2
- package/dist/{chunk-h76mddt3.js.map → chunk-t2t63wa0.js.map} +1 -1
- package/dist/{chunk-675kzd7z.js → chunk-t6qpm2j7.js} +2 -2
- package/dist/{chunk-675kzd7z.js.map → chunk-t6qpm2j7.js.map} +1 -1
- package/dist/chunk-tabsxzg9.js +5 -0
- package/dist/chunk-tabsxzg9.js.map +13 -0
- package/dist/{chunk-2vc72qez.js → chunk-vhvvjaj3.js} +3 -3
- package/dist/{chunk-2vc72qez.js.map → chunk-vhvvjaj3.js.map} +1 -1
- package/dist/{chunk-2amj1eyp.js → chunk-x2j84d06.js} +2 -2
- package/dist/{chunk-2amj1eyp.js.map → chunk-x2j84d06.js.map} +1 -1
- package/dist/{chunk-dmj6ysym.js → chunk-xe2pm36q.js} +2 -2
- package/dist/{chunk-dmj6ysym.js.map → chunk-xe2pm36q.js.map} +1 -1
- package/dist/{chunk-rkgsvsrj.js → chunk-xfvegbxn.js} +2 -2
- package/dist/{chunk-rkgsvsrj.js.map → chunk-xfvegbxn.js.map} +1 -1
- package/dist/{chunk-nvngb4ed.js → chunk-y9f2see3.js} +3 -3
- package/dist/{chunk-nvngb4ed.js.map → chunk-y9f2see3.js.map} +1 -1
- package/dist/{chunk-1kdga1b2.js → chunk-yhht1j7f.js} +2 -2
- package/dist/{chunk-1kdga1b2.js.map → chunk-yhht1j7f.js.map} +1 -1
- package/dist/{chunk-eevna943.js → chunk-z5nfve1k.js} +2 -2
- package/dist/chunk-z5nfve1k.js.map +10 -0
- package/dist/{chunk-j8vc3bze.js → chunk-zq5375wd.js} +3 -3
- package/dist/{chunk-j8vc3bze.js.map → chunk-zq5375wd.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-CgK2mmVV.js → ThemeProvider-CS2a1snV.js} +34 -3
- package/dist/chunks/ThemeProvider-CS2a1snV.js.map +1 -0
- package/dist/client/Mutation.d.ts +7 -6
- package/dist/client/Mutation.d.ts.map +1 -1
- package/dist/client/MutationError.d.ts +53 -1
- package/dist/client/MutationError.d.ts.map +1 -1
- package/dist/client/QueryResource.d.ts +9 -0
- package/dist/client/QueryResource.d.ts.map +1 -1
- package/dist/client/auth/useEmailCode.d.ts +3 -3
- package/dist/client/auth/useForgotPassword.d.ts +1 -1
- package/dist/client/auth/useResetPassword.d.ts +1 -1
- package/dist/client/auth/useSignIn.d.ts +1 -1
- package/dist/client/auth/useSignOut.d.ts +1 -1
- package/dist/client/auth/useSignUp.d.ts +1 -1
- package/dist/client/index.d.ts +4 -2
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +136 -9
- package/dist/client/index.js.map +1 -1
- package/dist/client/realtime/RealtimeClient.d.ts +8 -1
- package/dist/client/realtime/RealtimeClient.d.ts.map +1 -1
- package/dist/client/useMutation.d.ts +18 -8
- package/dist/client/useMutation.d.ts.map +1 -1
- package/dist/client/useSetQueryData.d.ts +69 -0
- package/dist/client/useSetQueryData.d.ts.map +1 -0
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/Auth.d.ts +29 -2
- package/dist/facades/Auth.d.ts.map +1 -1
- package/dist/facades/RateLimiter.d.ts +16 -1
- package/dist/facades/RateLimiter.d.ts.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/HttpRequest.d.ts +14 -0
- package/dist/http/HttpRequest.d.ts.map +1 -1
- package/dist/http/McpRouter.d.ts +121 -2
- package/dist/http/McpRouter.d.ts.map +1 -1
- package/dist/http/RateLimitExceededError.d.ts +24 -0
- package/dist/http/RateLimitExceededError.d.ts.map +1 -0
- package/dist/http/RateLimitMiddleware.d.ts +2 -5
- package/dist/http/RateLimitMiddleware.d.ts.map +1 -1
- package/dist/http/index.d.ts +2 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/http/refusal.d.ts +6 -1
- package/dist/http/refusal.d.ts.map +1 -1
- package/dist/http/requestContext.d.ts +3 -1
- package/dist/http/requestContext.d.ts.map +1 -1
- package/dist/http/requestState.d.ts +57 -0
- package/dist/http/requestState.d.ts.map +1 -0
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +2 -2
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +2 -2
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/server/Server.d.ts.map +1 -1
- package/dist/server/health.d.ts +67 -0
- package/dist/server/health.d.ts.map +1 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +5 -4
- package/dist/server/shutdown.d.ts +3 -4
- package/dist/server/shutdown.d.ts.map +1 -1
- package/dist/services/broadcast/BroadcastDriver.d.ts +3 -1
- package/dist/services/broadcast/BroadcastDriver.d.ts.map +1 -1
- package/dist/services/broadcast/BroadcastManager.d.ts.map +1 -1
- package/dist/services/broadcast/BroadcastServiceProvider.d.ts +10 -0
- package/dist/services/broadcast/BroadcastServiceProvider.d.ts.map +1 -1
- package/dist/services/broadcast/RedisBroadcastDriver.d.ts +155 -0
- package/dist/services/broadcast/RedisBroadcastDriver.d.ts.map +1 -0
- package/dist/services/broadcast/SocketHub.d.ts +9 -0
- package/dist/services/broadcast/SocketHub.d.ts.map +1 -1
- package/dist/services/broadcast/config.d.ts +16 -3
- package/dist/services/broadcast/config.d.ts.map +1 -1
- package/dist/services/broadcast/workerWarning.d.ts +10 -0
- package/dist/services/broadcast/workerWarning.d.ts.map +1 -0
- package/dist/services/features/gate.d.ts +11 -0
- package/dist/services/features/gate.d.ts.map +1 -0
- package/dist/services/index.d.ts +6 -5
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -3
- package/dist/services/index.js.map +2 -2
- package/dist/services/logging/LogManager.d.ts +1 -0
- package/dist/services/logging/LogManager.d.ts.map +1 -1
- package/dist/services/logging/config.d.ts +23 -1
- package/dist/services/logging/config.d.ts.map +1 -1
- package/dist/services/logging/consoleSink.d.ts +25 -0
- package/dist/services/logging/consoleSink.d.ts.map +1 -0
- package/dist/services/mcp/McpRegistry.d.ts +106 -14
- package/dist/services/mcp/McpRegistry.d.ts.map +1 -1
- package/dist/services/mcp/http/McpHttpServer.d.ts +41 -2
- package/dist/services/mcp/http/McpHttpServer.d.ts.map +1 -1
- package/dist/services/mcp/toAgentTools.d.ts +21 -3
- package/dist/services/mcp/toAgentTools.d.ts.map +1 -1
- package/dist/services/queue/WorkerProcess.d.ts.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +5 -4
- package/dist/services/rate-limiter/RateLimiter.d.ts +12 -0
- package/dist/services/rate-limiter/RateLimiter.d.ts.map +1 -1
- package/dist/services/router/globalMiddleware.d.ts +4 -3
- package/dist/services/router/globalMiddleware.d.ts.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +1 -1
- package/dist/vitest/index.js +1 -1
- package/package.json +1 -1
- package/skills/gemi-react-best-practices/SKILL.md +1 -1
- package/skills/gemi-react-best-practices/rules/query-mutate-over-refetch.md +14 -0
- package/skills/gemi-react-best-practices/rules/routing-middleware-dsl.md +2 -1
- package/dist/chunk-39dx7xrz.js +0 -10
- package/dist/chunk-39dx7xrz.js.map +0 -43
- package/dist/chunk-d0wr9jk4.js +0 -5
- package/dist/chunk-d0wr9jk4.js.map +0 -12
- package/dist/chunk-eevna943.js.map +0 -10
- package/dist/chunk-gvp6brdt.js +0 -57
- package/dist/chunk-kc924zjz.js +0 -5
- package/dist/chunk-kc924zjz.js.map +0 -12
- package/dist/chunk-tazvfppr.js +0 -5
- package/dist/chunk-vpgbn494.js +0 -24
- package/dist/chunk-z23h4s1a.js +0 -14
- package/dist/chunks/ThemeProvider-CgK2mmVV.js.map +0 -1
- /package/dist/{chunk-j0cnsgjq.js.map → chunk-6q6bhkyf.js.map} +0 -0
- /package/dist/{chunk-4qpypa3h.js.map → chunk-ayfjjgv2.js.map} +0 -0
- /package/dist/{chunk-rjm1kj8n.js.map → chunk-gp00enrk.js.map} +0 -0
- /package/dist/{chunk-xhmtph39.js.map → chunk-j10a0m7q.js.map} +0 -0
- /package/dist/{chunk-wqharhrp.js.map → chunk-j12hpdxk.js.map} +0 -0
- /package/dist/{chunk-8x73yyfs.js.map → chunk-s4semb89.js.map} +0 -0
|
@@ -8,6 +8,6 @@
|
|
|
8
8
|
"import { DatabaseManager } from \"../../database/DatabaseManager\";\nimport { app } from \"../../foundation/app\";\nimport { currentEncrypter } from \"../../orm/encryption\";\nimport { LockManager } from \"../../services/lock/LockManager\";\nimport {\n type ConnectionRecord,\n type ConnectionStore,\n DatabaseConnectionStore,\n MemoryConnectionStore,\n} from \"./ConnectionStore\";\nimport { OAuthConnectionError, OAuthReconnectRequiredError } from \"./errors\";\nimport {\n type ConnectionRefreshReason,\n type OAuthConnectionProvider,\n type OAuthTokenSet,\n isLoopback,\n} from \"./OAuthConnectionProvider\";\n\n/** A user, as far as a connection is concerned: anything with an `id`. */\nexport type ConnectionOwner = { id: string | number } | string | number;\n\n/** See `ProviderConnection.status`. */\nexport type ConnectionStatus = \"connected\" | \"needs_reconnect\";\n\n/** What `Connections.fake` answers an API request with. */\nexport type FakeConnectionHandler = (request: Request) => Response | Promise<Response>;\n\nexport interface ConnectionManagerOptions {\n providers: Record<string, OAuthConnectionProvider>;\n /** Default: a `DatabaseConnectionStore` on the default database connection. */\n store?: ConnectionStore | (() => ConnectionStore);\n}\n\n/**\n * The OAuth connections a user has made, and the one place their tokens are\n * read, refreshed and spent. Reached through the `Connections` facade.\n */\nexport class ConnectionManager {\n static token = \"auth.connections\";\n\n private resolvedStore: ConnectionStore | undefined;\n private readonly refreshing = new Map<string, Promise<ConnectionRecord>>();\n private fakes: Map<string, FakeConnectionHandler> | undefined;\n private fakeStore: MemoryConnectionStore | undefined;\n readonly fakeRequests: Request[] = [];\n\n constructor(private readonly options: ConnectionManagerOptions) {\n for (const [name, provider] of Object.entries(options.providers)) {\n if (!provider.config.multiple) continue;\n // A multiple-account provider's connections are stored under\n // `<name>:<account id>`, which must not be read as another provider's.\n const clash = Object.keys(options.providers).find((other) => other.startsWith(`${name}${ACCOUNT_SEPARATOR}`));\n if (name.includes(ACCOUNT_SEPARATOR) || clash) {\n throw new Error(\n `auth.connections: \"${clash ?? name}\" cannot be used alongside the multiple-account provider \"${name}\" ` +\n `(\"${ACCOUNT_SEPARATOR}\" separates a provider from an account id in the store).`,\n );\n }\n }\n }\n\n get providers(): Record<string, OAuthConnectionProvider> {\n return this.options.providers;\n }\n\n /** The store connections are kept in. */\n get store(): ConnectionStore {\n if (this.fakeStore) return this.fakeStore;\n if (!this.resolvedStore) {\n const configured = this.options.store;\n this.resolvedStore =\n typeof configured === \"function\"\n ? configured()\n : (configured ??\n new DatabaseConnectionStore(app(DatabaseManager).connection(), () => currentEncrypter()));\n }\n return this.resolvedStore;\n }\n\n provider(name: string): OAuthConnectionProvider {\n const provider = this.options.providers[name];\n if (!provider) {\n const known = Object.keys(this.options.providers);\n throw new OAuthConnectionError(\n \"unknown_provider\",\n `No OAuth connection provider \"${name}\" in auth.connections` +\n (known.length > 0 ? ` (configured: ${known.join(\", \")}).` : \" (none are configured).\"),\n );\n }\n return provider;\n }\n\n /**\n * The user's connection to `provider`, or `null` when they have not\n * connected it. With `accountId`, only the connection to that account\n * (`providerAccountId`). For a provider with `multiple: true` and no\n * `accountId`, the account added most recently; use `list(user,\n * provider)` for all of them.\n */\n async for(user: ConnectionOwner, provider: string, accountId?: string): Promise<ProviderConnection | null> {\n const config = this.provider(provider);\n const userId = ownerId(user);\n if (!config.config.multiple) {\n const record = await this.store.find(userId, provider);\n if (!record || (accountId !== undefined && record.providerAccountId !== accountId)) return null;\n return new ProviderConnection(this, record);\n }\n if (accountId !== undefined) {\n const record =\n (await this.store.find(userId, storeKey(provider, accountId))) ??\n // Stored before the provider was switched to `multiple`.\n (await this.store.find(userId, provider));\n return record && record.providerAccountId === accountId ? new ProviderConnection(this, record) : null;\n }\n const [latest] = (await this.list(user, provider)).sort(\n (a, b) => b.connectedAt.getTime() - a.connectedAt.getTime(),\n );\n return latest ?? null;\n }\n\n /** Every connection the user has, or only those to `provider`. */\n async list(user: ConnectionOwner, provider?: string): Promise<ProviderConnection[]> {\n if (provider !== undefined) this.provider(provider);\n const records = await this.store.list(ownerId(user));\n return records\n .filter((record) => {\n const name = this.providerName(record.provider);\n return name !== null && (provider === undefined || name === provider);\n })\n .map((record) => new ProviderConnection(this, record));\n }\n\n /**\n * Stores tokens for the user, replacing any earlier connection to the same\n * provider — or, for a provider with `multiple: true`, to the same account\n * (`providerAccountId`, required there). The connect callback calls this;\n * call it yourself for tokens obtained some other way.\n */\n async save(\n user: ConnectionOwner,\n provider: string,\n tokens: Partial<OAuthTokenSet> & { accessToken: string },\n ): Promise<ProviderConnection> {\n const config = this.provider(provider);\n const userId = ownerId(user);\n const { profile: _profile, ...grant } = tokens;\n const set: OAuthTokenSet = {\n refreshToken: null,\n tokenType: null,\n expiresAt: null,\n providerAccountId: null,\n scopes: config.config.scopes,\n ...grant,\n };\n if (!config.config.multiple) {\n return new ProviderConnection(this, await this.store.save(userId, provider, set));\n }\n\n const accountId = set.providerAccountId;\n if (typeof accountId !== \"string\" || accountId === \"\") {\n throw new OAuthConnectionError(\n \"missing_account_id\",\n `\"${provider}\" allows several accounts per user, so a connection needs the provider's account id ` +\n \"(providerAccountId), and the token exchange did not supply one.\",\n );\n }\n const record = await this.store.save(userId, storeKey(provider, accountId), set);\n // The same account, stored before the provider was switched to `multiple`.\n const legacy = await this.store.find(userId, provider);\n if (legacy && legacy.providerAccountId === accountId) await this.store.delete(legacy.id);\n return new ProviderConnection(this, record);\n }\n\n /**\n * The configured provider a stored connection belongs to: the store key\n * itself, or `<name>` of a multiple-account provider's `<name>:<account id>`.\n * `null` for a provider no longer configured.\n *\n * @internal\n */\n providerName(key: string): string | null {\n const providers = this.options.providers;\n if (Object.hasOwn(providers, key)) return key;\n const at = key.indexOf(ACCOUNT_SEPARATOR);\n if (at <= 0) return null;\n const name = key.slice(0, at);\n return Object.hasOwn(providers, name) && providers[name].config.multiple ? name : null;\n }\n\n // --- testing ---------------------------------------------------------------\n\n /**\n * Fakes every provider's API: connections live in memory, `fetch` answers\n * through `handlers[provider]` (recorded in `fakeRequests`), and nothing\n * reaches a token or revocation endpoint. Returns `this` so a test can\n * `save` a connection to start from.\n */\n fake(handlers: Record<string, FakeConnectionHandler> = {}): this {\n this.fakes = new Map(Object.entries(handlers));\n this.fakeStore = new MemoryConnectionStore();\n this.fakeRequests.length = 0;\n return this;\n }\n\n /** Undoes `fake`. */\n restore(): void {\n this.fakes = undefined;\n this.fakeStore = undefined;\n this.fakeRequests.length = 0;\n }\n\n get faked(): boolean {\n return this.fakes !== undefined;\n }\n\n // --- internals, for ProviderConnection ---------------------------------------\n\n /** @internal */\n async send(provider: string, request: Request): Promise<Response> {\n if (!this.fakes) return fetch(request);\n this.fakeRequests.push(request.clone());\n const handler = this.fakes.get(provider);\n if (!handler) {\n throw new Error(`Connections.fake() has no handler for \"${provider}\". Pass one: Connections.fake({ ${provider}: (req) => ... }).`);\n }\n return handler(request);\n }\n\n /**\n * A record whose access token is not the one at `staleRevision`: refreshed\n * by this call, or by whoever refreshed it first. Serialised per connection\n * in this process (concurrent callers share one refresh) and, through the\n * app's lock store, across processes — a rotating refresh token must be\n * spent exactly once.\n *\n * @internal\n */\n refresh(record: ConnectionRecord, reason: ConnectionRefreshReason = \"requested\"): Promise<ConnectionRecord> {\n const inFlight = this.refreshing.get(record.id);\n if (inFlight) return inFlight;\n const task = this.withLock(record.id, () => this.refreshOnce(record, reason)).finally(() =>\n this.refreshing.delete(record.id),\n );\n this.refreshing.set(record.id, task);\n return task;\n }\n\n private async refreshOnce(seen: ConnectionRecord, reason: ConnectionRefreshReason): Promise<ConnectionRecord> {\n // Re-read under the lock: another process may have refreshed already.\n const name = this.providerName(seen.provider) ?? seen.provider;\n const current = await this.store.find(seen.userId, seen.provider);\n if (!current || current.id !== seen.id) {\n throw new OAuthReconnectRequiredError(name);\n }\n if (current.revision !== seen.revision && !current.needsReconnect) return current;\n if (current.needsReconnect) throw new OAuthReconnectRequiredError(name);\n\n const provider = this.provider(name);\n if (this.faked) return current;\n const strategy = provider.config.refreshStrategy;\n if (!strategy && current.refreshToken === null) {\n await this.store.markNeedsReconnect(current.id);\n throw new OAuthReconnectRequiredError(name);\n }\n\n let tokens: OAuthTokenSet | null;\n try {\n tokens = strategy\n ? await strategy({\n accessToken: current.accessToken,\n refreshToken: current.refreshToken,\n scopes: [...current.scopes],\n expiresAt: current.expiresAt,\n issuedAt: current.updatedAt,\n reason,\n providerAccountId: current.providerAccountId,\n })\n : await provider.refresh(current.refreshToken as string, current.scopes);\n } catch (error) {\n // A refusal from the token endpoint is final: the grant is gone. A\n // network error or a 5xx is not, and leaves the connection alone. Nor\n // is `invalid_client`: the app's own credentials (or `clientAuth`) are\n // wrong, reconnecting would fail the same way, and marking would make\n // every user reconnect once the config is fixed.\n if (\n error instanceof OAuthConnectionError &&\n error.status !== undefined &&\n error.status >= 400 &&\n error.status < 500 &&\n error.providerError !== \"invalid_client\"\n ) {\n await this.store.markNeedsReconnect(current.id);\n throw new OAuthReconnectRequiredError(name, {\n cause: error,\n status: error.status,\n providerError: error.providerError,\n });\n }\n throw error;\n }\n // The strategy has nothing to refresh yet: keep the current token.\n if (tokens === null) return current;\n\n const updated = await this.store.updateTokens(current.id, current.revision, tokens);\n if (updated) return updated;\n // Someone else wrote first (only possible without a shared lock store).\n const winner = await this.store.find(current.userId, current.provider);\n if (!winner) throw new OAuthReconnectRequiredError(name);\n return winner;\n }\n\n private async withLock<T>(id: string, fn: () => Promise<T>): Promise<T> {\n const application = app();\n if (this.faked || !application.bound(LockManager)) return fn();\n const result = await application\n .make(LockManager)\n .run(`gemi:oauth-connection:${id}`, { ttl: 30_000, wait: 20_000 }, () => fn());\n if (!result.acquired) {\n throw new OAuthConnectionError(\n \"refresh_failed\",\n \"Timed out waiting for another refresh of this connection to finish.\",\n );\n }\n return result.value as T;\n }\n}\n\n/**\n * One user's connection to one provider. Never exposes a token as a property,\n * and serialises (`toJSON`, `console.log`) without them.\n */\nexport class ProviderConnection {\n constructor(\n private readonly manager: ConnectionManager,\n private record: ConnectionRecord,\n ) {}\n\n /** The provider's name under `auth.connections`. */\n get provider(): string {\n return this.manager.providerName(this.record.provider) ?? this.record.provider;\n }\n get userId(): string {\n return this.record.userId;\n }\n get providerAccountId(): string | null {\n return this.record.providerAccountId;\n }\n /** The scopes the provider granted. */\n get scopes(): readonly string[] {\n return this.record.scopes;\n }\n get expiresAt(): Date | null {\n return this.record.expiresAt;\n }\n /** A refresh was refused: the user has to connect again. */\n get needsReconnect(): boolean {\n return this.record.needsReconnect;\n }\n get connectedAt(): Date {\n return this.record.createdAt;\n }\n\n /**\n * What to show the user: `\"needs_reconnect\"` when a refresh was refused, or\n * when the access token has expired and there is no refresh token to renew\n * it; `\"connected\"` otherwise. Read without calling the provider.\n */\n get status(): ConnectionStatus {\n if (this.record.needsReconnect) return \"needs_reconnect\";\n const expiresAt = this.record.expiresAt?.getTime();\n if (this.record.refreshToken === null && expiresAt !== undefined && expiresAt <= Date.now()) {\n return \"needs_reconnect\";\n }\n return \"connected\";\n }\n\n /** Whether every one of `scopes` was granted. */\n hasScopes(...scopes: string[]): boolean {\n return scopes.every((scope) => this.record.scopes.includes(scope));\n }\n\n /**\n * `fetch`, as the user: adds `Authorization: Bearer <token>`, refreshes the\n * token first when it is about to expire, and after a 401 refreshes and\n * retries once. A refresh the provider refuses marks the connection and\n * throws `OAuthReconnectRequiredError`.\n *\n * A path is resolved against the provider's `apiBaseUrl`, and a URL on any\n * other origin is refused (`OAuthConnectionError`,\n * `forbidden_url`), so the token only ever goes to the provider. Redirects\n * are followed by hand: the token is dropped on one that leaves the origin.\n * A streamed request body cannot be sent twice, so a 401 for one is\n * returned rather than retried.\n */\n async fetch(input: string | URL, init: RequestInit = {}): Promise<Response> {\n const url = this.resolveUrl(input);\n const record = await this.current();\n const first = await this.send(url, init, record.accessToken);\n // Retry only a refusal of the token itself, not one from where a redirect\n // led after the token was dropped.\n if (!first.authorized || init.body instanceof ReadableStream) return first.response;\n const provider = this.manager.provider(this.provider);\n if (!(await provider.isTokenRejected(first.response))) return first.response;\n\n await first.response.body?.cancel().catch(() => {});\n const refreshed = await this.refreshFrom(record, \"rejected\");\n return (await this.send(url, init, refreshed.accessToken)).response;\n }\n\n /**\n * A valid access token, refreshed first if it is about to expire — for an\n * SDK that wants the token itself. Prefer `fetch`, which also retries a 401.\n */\n async accessToken(): Promise<string> {\n return (await this.current()).accessToken;\n }\n\n /** Refreshes now, whatever the expiry says. */\n async refresh(): Promise<void> {\n await this.refreshFrom(this.record);\n }\n\n /**\n * Revokes the grant at the provider (the refresh token when there is one,\n * which ends the whole grant, else the access token) and deletes the\n * connection. If the provider refuses, nothing is deleted and\n * `OAuthConnectionError` (`revoke_failed`) is thrown — call `disconnect()`\n * to forget the tokens anyway. A provider without a `revokeUrl` throws\n * `revoke_unsupported`; use `disconnect()`.\n */\n async revoke(): Promise<void> {\n if (!this.manager.faked) {\n const provider = this.manager.provider(this.provider);\n if (this.record.refreshToken !== null) {\n await provider.revoke(this.record.refreshToken, \"refresh_token\");\n } else {\n await provider.revoke(this.record.accessToken, \"access_token\");\n }\n }\n await this.manager.store.delete(this.record.id);\n }\n\n /** Forgets the tokens locally without telling the provider. */\n async disconnect(): Promise<void> {\n await this.manager.store.delete(this.record.id);\n }\n\n toJSON() {\n return {\n provider: this.provider,\n providerAccountId: this.providerAccountId,\n scopes: [...this.scopes],\n expiresAt: this.expiresAt,\n needsReconnect: this.needsReconnect,\n status: this.status,\n connectedAt: this.connectedAt,\n };\n }\n\n [Symbol.for(\"nodejs.util.inspect.custom\")]() {\n return { ProviderConnection: this.toJSON() };\n }\n\n private async current(): Promise<ConnectionRecord> {\n if (this.record.needsReconnect) throw new OAuthReconnectRequiredError(this.provider);\n const leeway = this.manager.provider(this.provider).config.refreshLeewaySeconds * 1000;\n const expiresAt = this.record.expiresAt?.getTime();\n if (expiresAt !== undefined && expiresAt - Date.now() <= leeway) {\n return this.refreshFrom(this.record, \"expiring\");\n }\n return this.record;\n }\n\n private async refreshFrom(\n record: ConnectionRecord,\n reason: ConnectionRefreshReason = \"requested\",\n ): Promise<ConnectionRecord> {\n try {\n this.record = await this.manager.refresh(record, reason);\n } catch (error) {\n if (error instanceof OAuthReconnectRequiredError) {\n this.record = { ...this.record, needsReconnect: true };\n }\n throw error;\n }\n return this.record;\n }\n\n private resolveUrl(input: string | URL): URL {\n const base = this.manager.provider(this.provider).config.apiBaseUrl;\n let url: URL;\n try {\n url = new URL(String(input), base);\n } catch {\n throw new OAuthConnectionError(\n \"forbidden_url\",\n `connection.fetch was given ${JSON.stringify(String(input))}, which is not a URL.`,\n );\n }\n if (url.origin !== new URL(base).origin) {\n throw new OAuthConnectionError(\n \"forbidden_url\",\n `connection.fetch only sends the ${this.provider} token to ${new URL(base).origin} ` +\n `(apiBaseUrl), not to ${url.origin}.`,\n );\n }\n if (url.protocol !== \"https:\" && !(url.protocol === \"http:\" && isLoopback(url.hostname))) {\n throw new OAuthConnectionError(\n \"forbidden_url\",\n `connection.fetch only sends a token over https, not to ${url.origin}.`,\n );\n }\n return url;\n }\n\n private async send(url: URL, init: RequestInit, token: string): Promise<{ response: Response; authorized: boolean }> {\n let target = url;\n let method = (init.method ?? \"GET\").toUpperCase();\n let body = init.body;\n let authorized = true;\n\n // Followed by hand (unless the caller asked for \"manual\" or \"error\"), so\n // the token never follows a redirect to another origin.\n if (init.redirect === \"manual\" || init.redirect === \"error\") {\n const response = await this.manager.send(this.provider, this.request(target, init, method, body, token));\n return { response, authorized };\n }\n\n for (let hop = 0; ; hop++) {\n const request = this.request(target, { ...init, redirect: \"manual\" }, method, body, authorized ? token : null);\n const response = await this.manager.send(this.provider, request);\n const location = response.headers.get(\"location\");\n if (!REDIRECTS.has(response.status) || location === null || hop >= 5) return { response, authorized };\n\n await response.body?.cancel().catch(() => {});\n const next = new URL(location, target);\n if (next.origin !== target.origin) authorized = false;\n if (response.status === 303 || ((response.status === 301 || response.status === 302) && method === \"POST\")) {\n method = \"GET\";\n body = undefined;\n }\n target = next;\n }\n }\n\n private request(url: URL, init: RequestInit, method: string, body: RequestInit[\"body\"], token: string | null): Request {\n const headers = new Headers(init.headers);\n const target = new URL(url);\n const placement = this.manager.provider(this.provider).config.tokenPlacement;\n if (token === null) {\n headers.delete(\"authorization\");\n } else if (placement === \"query\") {\n // Where the provider documents it (Instagram's Graph API). Only ever on\n // `apiBaseUrl`'s origin: a redirect elsewhere is sent with `token` null.\n target.searchParams.set(\"access_token\", token);\n } else {\n headers.set(\"Authorization\", `Bearer ${token}`);\n }\n return new Request(target, { ...init, method, body, headers });\n }\n}\n\nconst REDIRECTS = new Set([301, 302, 303, 307, 308]);\n\n/** Between a multiple-account provider's name and the account id, in the store's `provider` column. */\nconst ACCOUNT_SEPARATOR = \":\";\n\nfunction storeKey(provider: string, accountId: string): string {\n return `${provider}${ACCOUNT_SEPARATOR}${accountId}`;\n}\n\nfunction ownerId(user: ConnectionOwner): string {\n const id = typeof user === \"object\" && user !== null ? user.id : user;\n if (id === undefined || id === null || id === \"\") {\n throw new TypeError(\"An OAuth connection belongs to a user: pass the user (or its id).\");\n }\n return String(id);\n}\n"
|
|
9
9
|
],
|
|
10
10
|
"mappings": ";sLAwCO,AAAM,LAAiD,LAC3C,KAAO,IAAI,SAEtB,KAAI,CAAC,EAAgB,EAAkB,CAC3C,QAAW,KAAO,KAAK,KAAK,OAAO,EACjC,GAAI,EAAI,SAAW,GAAU,EAAI,WAAa,EAAU,MAAO,IAAK,CAAI,EAE1E,OAAO,UAGH,KAAI,CAAC,EAAgB,CACzB,MAAO,CAAC,GAAG,KAAK,KAAK,OAAO,CAAC,EAAE,OAAO,CAAC,IAAQ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E7C,OAAQ,IAAI,gBAAiB,UAAU,GAAO,EAEhD,OAAO,IAAI,QAAQ,EAAQ,IAAK,EAAM,SAAQ,OAAM,SAAQ,CAAC,EAEjE,CAEA,IAAM,EAAY,IAAI,IAAI,CAAC,IAAK,IAAK,IAAK,IAAK,GAAG,CAAC,EAG7C,EAAoB,IAE1B,SAAS,CAAQ,CAAC,EAAkB,EAA2B,CAC7D,MAAO,GAAG,IAAW,IAAoB,IAG3C,SAAS,CAAO,CAAC,EAA+B,CAC9C,IAAM,EAAK,OAAO,IAAS,UAAY,IAAS,KAAO,EAAK,GAAK,EACjE,GAAI,IAAO,QAAa,IAAO,MAAQ,IAAO,GAC5C,MAAU,UAAU,mEAAmE,EAEzF,OAAO,OAAO,CAAE",
|
|
11
|
-
"debugId": "
|
|
11
|
+
"debugId": "38A8DEECB767A5F064756E2164756E21",
|
|
12
12
|
"names": []
|
|
13
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
class A extends Error{constructor(p,q){super(`Target [${p}] is not bound in the container.`+(q.length>0?` Bound tokens: ${q.join(", ")}.`:" No tokens are bound \u2014 was the application booted?"));this.name="BindingResolutionError"}}class C{bindings=new Map;instances=new Map;bind(p,q){this.bindings.set(p.token,{factory:q,shared:!1}),this.instances.delete(p.token)}singleton(p,q){this.bindings.set(p.token,{factory:q,shared:!0}),this.instances.delete(p.token)}instance(p,q){return this.instances.set(p.token,q),q}bound(p){return this.bindings.has(p.token)||this.instances.has(p.token)}resolved(p){return this.instances.has(p.token)}make(p){let q=p.token;if(this.instances.has(q))return this.instances.get(q);let v=this.bindings.get(q);if(!v)throw new A(q,this.keys());let x=v.factory(this);if(v.shared)this.instances.set(q,x);return x}forget(p){this.instances.delete(p.token)}keys(){return[...new Set([...this.bindings.keys(),...this.instances.keys()])]}flush(){this.bindings.clear(),this.instances.clear()}}
|
|
3
|
-
export{A as
|
|
3
|
+
export{A as ik,C as jk};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=9EBA5D129BEFACCE64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Tokens are the service classes themselves, so `make(MailManager)` is typed\n * `MailManager` without a cast. The container keys its bindings off the class's\n * `static token` string rather than the constructor object: the built binary\n * (`dist/bin/gemi.js`) bundles its own copy of gemi while the app resolves\n * `gemi/*` to source, so the same service is two distinct class objects across\n * that boundary. A string survives it. Laravel binds both `'mail'` and\n * `MailManager::class` for the same reason.\n */\nexport type ServiceToken<T> = (abstract new (...args: any[]) => T) & {\n token: string;\n};\n\nexport type Factory<T> = (app: Container) => T;\n\ninterface Binding {\n factory: Factory<any>;\n shared: boolean;\n}\n\nexport class BindingResolutionError extends Error {\n constructor(token: string, known: string[]) {\n super(\n `Target [${token}] is not bound in the container.` +\n (known.length > 0\n ? ` Bound tokens: ${known.join(\", \")}.`\n : \" No tokens are bound — was the application booted?\"),\n );\n this.name = \"BindingResolutionError\";\n }\n}\n\nexport class Container {\n private bindings = new Map<string, Binding>();\n private instances = new Map<string, any>();\n\n bind<T>(token: ServiceToken<T>, factory: Factory<T>) {\n this.bindings.set(token.token, { factory, shared: false });\n this.instances.delete(token.token);\n }\n\n /**\n * Lazy by design — `factory` is not called until the first `make()`.\n */\n singleton<T>(token: ServiceToken<T>, factory: Factory<T>) {\n this.bindings.set(token.token, { factory, shared: true });\n this.instances.delete(token.token);\n }\n\n instance<T>(token: ServiceToken<T>, object: T): T {\n this.instances.set(token.token, object);\n return object;\n }\n\n bound<T>(token: ServiceToken<T>): boolean {\n return (\n this.bindings.has(token.token) || this.instances.has(token.token)\n );\n }\n\n resolved<T>(token: ServiceToken<T>): boolean {\n return this.instances.has(token.token);\n }\n\n make<T>(token: ServiceToken<T>): T {\n const key = token.token;\n\n if (this.instances.has(key)) {\n return this.instances.get(key) as T;\n }\n\n const binding = this.bindings.get(key);\n if (!binding) {\n throw new BindingResolutionError(key, this.keys());\n }\n\n const object = binding.factory(this) as T;\n if (binding.shared) {\n this.instances.set(key, object);\n }\n return object;\n }\n\n forget<T>(token: ServiceToken<T>) {\n this.instances.delete(token.token);\n }\n\n keys(): string[] {\n return [\n ...new Set([...this.bindings.keys(), ...this.instances.keys()]),\n ];\n }\n\n flush() {\n this.bindings.clear();\n this.instances.clear();\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAoBO,MAAM,UAA+B,KAAM,CAChD,WAAW,CAAC,EAAe,EAAiB,CAC1C,MACE,WAAW,qCACR,EAAM,OAAS,EACZ,kBAAkB,EAAM,KAAK,IAAI,KACjC,0DACR,EACA,KAAK,KAAO,yBAEhB,CAEO,MAAM,CAAU,CACb,SAAW,IAAI,IACf,UAAY,IAAI,IAExB,IAAO,CAAC,EAAwB,EAAqB,CACnD,KAAK,SAAS,IAAI,EAAM,MAAO,CAAE,UAAS,OAAQ,EAAM,CAAC,EACzD,KAAK,UAAU,OAAO,EAAM,KAAK,EAMnC,SAAY,CAAC,EAAwB,EAAqB,CACxD,KAAK,SAAS,IAAI,EAAM,MAAO,CAAE,UAAS,OAAQ,EAAK,CAAC,EACxD,KAAK,UAAU,OAAO,EAAM,KAAK,EAGnC,QAAW,CAAC,EAAwB,EAAc,CAEhD,OADA,KAAK,UAAU,IAAI,EAAM,MAAO,CAAM,EAC/B,EAGT,KAAQ,CAAC,EAAiC,CACxC,OACE,KAAK,SAAS,IAAI,EAAM,KAAK,GAAK,KAAK,UAAU,IAAI,EAAM,KAAK,EAIpE,QAAW,CAAC,EAAiC,CAC3C,OAAO,KAAK,UAAU,IAAI,EAAM,KAAK,EAGvC,IAAO,CAAC,EAA2B,CACjC,IAAM,EAAM,EAAM,MAElB,GAAI,KAAK,UAAU,IAAI,CAAG,EACxB,OAAO,KAAK,UAAU,IAAI,CAAG,EAG/B,IAAM,EAAU,KAAK,SAAS,IAAI,CAAG,EACrC,GAAI,CAAC,EACH,MAAM,IAAI,EAAuB,EAAK,KAAK,KAAK,CAAC,EAGnD,IAAM,EAAS,EAAQ,QAAQ,IAAI,EACnC,GAAI,EAAQ,OACV,KAAK,UAAU,IAAI,EAAK,CAAM,EAEhC,OAAO,EAGT,MAAS,CAAC,EAAwB,CAChC,KAAK,UAAU,OAAO,EAAM,KAAK,EAGnC,IAAI,EAAa,CACf,MAAO,CACL,GAAG,IAAI,IAAI,CAAC,GAAG,KAAK,SAAS,KAAK,EAAG,GAAG,KAAK,UAAU,KAAK,CAAC,CAAC,CAChE,EAGF,KAAK,EAAG,CACN,KAAK,SAAS,MAAM,EACpB,KAAK,UAAU,MAAM,EAEzB",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "9EBA5D129BEFACCE64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{a,b,c,d,e,f,g}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g}from"./chunk-x2j84d06.js";import"./chunk-6vz75swk.js";import"./chunk-7zj6bk9a.js";import"./chunk-hxn0s3zh.js";export{g as fromEnv,c as ENV_SESSION,b as ENV_SECRET,a as ENV_KEY,d as ENV_EXPIRATION,e as ENV_CREDENTIAL_SCOPE,f as ENV_ACCOUNT_ID};
|
|
3
3
|
|
|
4
4
|
//# debugId=30E142423ED216F064756E2164756E21
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{S as R,T as VJ,U as zJ}from"./chunk-j5rwv09s.js";import{oa as M,sa as L,ta as OJ}from"./chunk-a22h5cby.js";import"./chunk-kk18xqgc.js";import{Hf as HJ,If as N,Nd as r}from"./chunk-eyptwf54.js";import"./chunk-3kxe9geg.js";import"./chunk-cwt8e782.js";import{Ug as i,Vg as a,Yg as t}from"./chunk-6wgh7nk6.js";import{Zh as GJ}from"./chunk-erzfs4t2.js";import"./chunk-tabsxzg9.js";import"./chunk-rvspb96n.js";import"./chunk-y9f2see3.js";import"./chunk-ap3g6rbw.js";import"./chunk-entpqjyn.js";import"./chunk-rany5zgk.js";import"./chunk-sv125fqq.js";import"./chunk-vhvvjaj3.js";import"./chunk-npbf06c1.js";import"./chunk-ex41d03h.js";import"./chunk-kcsa57km.js";import"./chunk-6gwxvmjv.js";import"./chunk-rwmja4zs.js";import{mk as $J}from"./chunk-xe2pm36q.js";import"./chunk-z5nfve1k.js";import{Ak as KJ}from"./chunk-yhht1j7f.js";import{Bk as D}from"./chunk-xfvegbxn.js";import"./chunk-hxn0s3zh.js";import{createHash as Q2}from"crypto";import{join as E,resolve as xJ,sep as LJ}from"path";import{Duplex as qJ}from"stream";import{constants as _,createBrotliCompress as bJ,createGzip as SJ}from"zlib";var kJ=["br","gzip"],wJ=1024,vJ=5,EJ=19,yJ=6;function gJ(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 fJ(J){if(J===null||J===void 0)return null;let $=new Map;for(let Z of J.split(",")){let[X,...Q]=Z.split(";"),H=X.trim().toLowerCase();if(H==="")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=gJ(Y.slice(K+1));break}}$.set(H,j)}return $}function k(J,$=kJ){let Z=fJ(J);if(!Z)return null;let X=Z.get("*"),Q=null,H=0;for(let j of $){let Y=Z.get(j)??X??0;if(Y>H)Q=j,H=Y}return Q}function mJ(J,$){if(!J)return!1;return J.split(",").some((Z)=>Z.trim().toLowerCase().split("=")[0].trim()===$)}function uJ(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(mJ($.headers.get("Cache-Control"),"no-transform"))return!1;let Q=$.headers.get("Content-Length");if(Q!==null&&Number(Q)<wJ)return!1;return!0}function hJ(J){let $=J==="br"?bJ({params:{[_.BROTLI_PARAM_QUALITY]:vJ,[_.BROTLI_PARAM_LGWIN]:EJ},flush:_.BROTLI_OPERATION_FLUSH}):SJ({level:yJ,flush:_.Z_SYNC_FLUSH});return qJ.toWeb($)}function cJ(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 d(J,$){if(!uJ(J.method,$))return $;let Z=new Headers($.headers);cJ(Z);let X=k(J.headers.get("Accept-Encoding"));if(!X)return new Response($.body,{status:$.status,statusText:$.statusText,headers:Z});let Q;try{Q=hJ(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 aJ,stat as s}from"fs/promises";import{join as tJ}from"path";import{mkdir as V2,readFile as pJ,stat as z2,writeFile as x2}from"fs/promises";import{dirname as C2,join as dJ}from"path";import{promisify as l}from"util";import{brotliCompress as lJ,constants as P2,gzip as oJ}from"zlib";var nJ=".vite/static-assets.json";var o={br:".br",gzip:".gz"},iJ=["br","gzip"],_2=l(lJ),B2=l(oJ);async function n(J){let $;try{$=await pJ(dJ(J,nJ),"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,H]of Object.entries(Z)){if(!Array.isArray(H))continue;X.files[Q]=iJ.filter((j)=>H.includes(j))}return X}function w(J){let $=J.toString(),Z=new Bun.CryptoHasher("sha1");return Z.update($),Z.digest("hex")}async function e(J){let $=new Set;async function Z(X,Q){let H;try{H=await aJ(X,{withFileTypes:!0})}catch{return}for(let j of H){if(j.name.startsWith("."))continue;if(Q&&j.name==="assets")continue;let Y=tJ(X,j.name),K=j.isDirectory(),V=j.isFile();if(j.isSymbolicLink())try{let I=await s(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 rJ="public, max-age=31536000, must-revalidate",sJ="public, max-age=31536000, immutable";async function eJ(J,$,Z){if(Z.length===0||J.headers.has("Range"))return null;let X=k(J.headers.get("Accept-Encoding"),Z);if(!X)return null;let Q=$+o[X];try{let H=await s(Q);return H.isFile()?{encoding:X,path:Q,size:H.size}:null}catch{return null}}async function JJ(J,$,Z={}){let X=Bun.file($),Q=Z.encodings??[],H={"Content-Type":X.type||"application/octet-stream","Cache-Control":Z.immutable?sJ:rJ,"Accept-Ranges":"bytes"};if(Q.length>0)H.Vary="Accept-Encoding";let j=await eJ(J,$,Q);if(j){let V=Bun.file(j.path);return new Response(V.stream(),{headers:{...H,"Content-Encoding":j.encoding,"Content-Length":String(j.size),ETag:`${w(V.lastModified)}-${j.encoding}`}})}let Y=X.size;H.ETag=w(X.lastModified);let K=i(J.headers.get("Range"));if(K){let V=a(K,Y);if(!V)return r(Y);return new Response(X.slice(V.start,V.end+1).stream(),{status:206,headers:{...H,"Content-Range":t(V.start,V.end,Y),"Content-Length":String(V.length)}})}return new Response(X.stream(),{headers:{...H,"Content-Length":String(Y)}})}import{stat as W2}from"fs/promises";var B="app/client.tsx";function ZJ(J,$=M){let Z=J[B]?.file;if(!Z)return;return{module:L(Z,$),preload:A(J,B,$)}}function A(J,$,Z=M){let X=[],Q=new Set,H=(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??[])H(K)};return H($),X}function XJ(J,$){let Z=[],X=new Set,Q=new Set,H=(j)=>{if(Q.has(j))return;Q.add(j);let Y=J[j];if(!Y)return;for(let K of Y.imports??[])H(K);for(let K of Y.css??[])if(!X.has(K))X.add(K),Z.push(K)};return H($),Z}function QJ(J,$=M){let Z=new Map;return(X)=>{if(!Z.has(X)){let Q=`${X}${$J}`,H=J[Q]?.file;Z.set(X,H?{src:L(H,$),preload:A(J,Q,$)}:void 0)}return Z.get(X)}}function WJ(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 J2=new RegExp(`^${HJ}/.+\\.m?js$`);function $2(J){return J2.test(J)}function jJ(J){if($2(J))return new Response(WJ(J),{headers:{"Content-Type":"application/javascript","Cache-Control":"no-store"}});if(N(J))return new Response("Not found",{status:404});return}var Z2=`<!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 v(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(D($))return new Response(JSON.stringify({error:GJ("server_error","Internal Server Error",500)}),{status:500,headers:{"Content-Type":"application/json"}});return new Response(Z2,{status:500,headers:{"Content-Type":"text/html; charset=utf-8"}})}var X2={kind:"none"};function YJ(J){let $=(J??"").trim().toLowerCase();if($===""||$==="false"||$==="off"||$==="0")return X2;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 UJ(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),H=Q.length-Z.hops;X=H>=0?Q[H]:Q[0]??$}if(X)J.set("x-forwarded-for",X);else J.delete("x-forwarded-for")}var T=KJ(),H2=E(T,"app"),x=E(T,"dist"),C=E(x,"client");function j2(J){let $;try{$=decodeURIComponent(J)}catch{return null}let Z=xJ(C,"."+$.replace("/assets/assets","/assets"));return Z.startsWith(C+LJ)?Z:null}async function G2(J){try{return(await W2(J)).isFile()}catch{return!1}}async function H3(J,$){let Z=await import(`${x}/client/.vite/manifest.json`),X=await import(`${x}/server/.vite/manifest.json`),Q=await OJ(`${x}/client`);process.env.ROOT_DIR=T,process.env.APP_DIR=H2,process.env.DIST_DIR=x;let H={},j={},Y={},K={},V={},I=(W,G)=>`"${W}": () => import("${G}")`,y=[];for(let W of["404",...J.getFlatComponentTree.call(J)]){let G=X[`app/views/${W}.tsx`];if(!G?.file){console.log(`Server file not found for ${W}`),console.log(G);let z=Object.keys(X),P=`app/views/${W}.tsx`;console.log(`${P} not found in server manifest`),console.log(z)}let U=await import(`${process.env.DIST_DIR}/server/${G?.file}`);H[W]=U.default,j[W]=U.OpenGraph,Y[W]=U;let O=Z[`app/views/${W}.tsx`];if(O?.css&&O?.css.length>0)K[W]=O?.css;if(O)y.push(I(W,L(O?.file,Q))),V[W]=A(Z,`app/views/${W}.tsx`,Q)}let CJ=`{${y.join(",")}}`,g=ZJ(Z,Q);if(!g)console.error(`Client manifest has no "${B}" entry \u2014 dist/client is incomplete, so documents will render but never hydrate.`);let FJ=Z["app/client.tsx"]?.css??[],f=(await Promise.all(FJ.map((W)=>Bun.file(`${x}/client/${W}`).text()))).join(`
|
|
22
|
+
`),IJ=QJ(Z,Q),PJ=Q2("sha256").update(await Bun.file(`${x}/client/.vite/manifest.json`).text()).digest("base64url").slice(0,12),m=new Map,_J=(W)=>{let G=m.get(W);if(!G)G=Bun.file(`${x}/client/${W}`).text(),m.set(W,G);return G},BJ=async(W,G)=>{let U=new Set;for(let z of G?[G,...W]:W)for(let P of XJ(Z,`app/views/${z}.tsx`))U.add(P);let O=await Promise.all([...U].map(async(z)=>({id:z,content:await _J(z)})));return R(G?O:[{content:f},...O])},MJ=await e(C),u=new Map;for(let[W,G]of Object.entries((await n(C))?.files??{})){let U=xJ(C,W);if(U.startsWith(C+LJ))u.set(U,{immutable:!0,encodings:G})}async function AJ(W){let{pathname:G}=new URL(W.url);if(D(G))return await q(W,G);let U=j2(G);if(N(G)||G.startsWith("/.well-known")||U!==null&&MJ.has(U)){if(!U||!await G2(U))return jJ(G)??await q(W,G);try{return await JJ(W,U,u.get(U))}catch(z){return J.onException?.(z),new Response("Not found",{status:404})}}return await q(W,G)}async function q(W,G){let U=J.fetch.bind(J);try{let O=await U(W);if(O instanceof Response)return O;else{let z=[];return z.push({content:f}),await O({getStyles:async(S,c)=>{if(!S)return R([]);if(c?.static)return BJ(S,c.layout);for(let DJ of S){let RJ=Z[`app/views/${DJ}.tsx`];for(let p of RJ?.css??[]){let TJ=Bun.file(`${process.env.DIST_DIR}/client/${p}`);z.push({id:p,content:await TJ.text()})}}return R(z)},clientEntry:g,modulePreloadManifest:V,loaders:CJ,viewImportMap:H,viewModules:Y,ogMap:j,cssManifest:K,assetBase:Q,resolveIsland:IJ,buildId:PJ})}}catch(O){return v(O,G,J.onException)}}let NJ=(process.env.GEMI_COMPRESSION??"auto").toLowerCase()!=="off",h=YJ(process.env.GEMI_TRUST_PROXY),F=J.sockets();if(F&&h.kind==="none")console.warn("[gemi] Broadcast sockets: GEMI_TRUST_PROXY is not set, so a socket's address is its TCP peer. Behind a proxy or load balancer every client shares the proxy's address, and broadcast.maxConnectionsPerIp caps the whole app per process. Set GEMI_TRUST_PROXY (see forwardedFor) or raise that limit.");let b=Bun.serve({maxRequestBodySize:10737418240,fetch:async(W,G)=>{if(UJ(W.headers,G.requestIP(W)?.address??null,h),F?.matches(W))return F.upgrade(W,G);let U=await $(W,(O)=>J.withGlobalMiddleware(O,AJ,(z)=>v(z,new URL(O.url).pathname,J.onException)));return NJ?d(W,U):U},idleTimeout:zJ(),port:process.env.PORT||5173,websocket:F?.websocket});return await F?.start(b),VJ({port:b.port,rootDir:T}),b}export{H3 as httpProd};
|
|
23
|
+
|
|
24
|
+
//# debugId=46819E01035BB5E764756E2164756E21
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"import { stringEraRefusal } from \"../http/Error\";\nimport { isApiPath } from \"../services/router/apiPath\";\n\n// The production server's last resort: an error nothing on the way here turned\n// into a response. Request breakers (auth, 404s, 416s) are answered by the\n// dispatchers before this, so what arrives is a genuine failure — and its\n// message and stack are for the developer, not for whoever triggered it. They\n// can carry absolute paths, dependency versions, SQL fragments and column\n// names. The dev server renders them on purpose (`httpDev.ts`); this does not.\n\nconst GENERIC_500_HTML = `<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\n <title>Internal Server Error</title>\n <style>\n body { font-family: system-ui, sans-serif; margin: 0; min-height: 100vh; display: grid; place-items: center; }\n main { text-align: center; padding: 16px; }\n h1 { font-size: 1.5rem; margin: 0 0 0.5rem; }\n p { margin: 0; opacity: 0.7; }\n </style>\n </head>\n <body>\n <main>\n <h1>Something went wrong</h1>\n <p>Please try again later.</p>\n </main>\n </body>\n</html>`;\n\nexport function unhandledErrorResponse(\n err: unknown,\n pathname: string,\n onException?: (error: Error) => void,\n): Response {\n // `onException` is the report, and the default one `App` installs is a\n // `console.error`, so logging here as well printed every failure twice\n // (three times for `/api`, whose dispatcher logs before rethrowing). Only\n // without a reporter does this log itself.\n //\n // Reported for `/api` too: an app's error tracking should see an API failure\n // that got this far, not only a page one. `onRequestFail` is a different\n // hook (route config, called by the dispatchers), so this is not a second\n // report through the same channel.\n if (!onException) {\n console.error(err);\n } else {\n try {\n // The hook is typed to receive an `Error`; a thrown string or object is\n // wrapped so a reporter reading `.stack` or `.name` gets one.\n onException(err instanceof Error ? err : new Error(String(err), { cause: err }));\n } catch (reportError) {\n // A broken reporter must not turn a 500 into a leaked stack either.\n console.error(err);\n console.error(reportError);\n }\n }\n\n if (isApiPath(pathname)) {\n return new Response(\n JSON.stringify({ error: stringEraRefusal(\"server_error\", \"Internal Server Error\", 500) }),\n {\n status: 500,\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n }\n\n return new Response(GENERIC_500_HTML, {\n status: 500,\n headers: { \"Content-Type\": \"text/html; charset=utf-8\" },\n });\n}\n",
|
|
14
14
|
"/**\n * Which `X-Forwarded-For` entries the production server believes (#8).\n *\n * `X-Forwarded-For` is written by whoever sends the request. A client talking\n * to the app directly — or through a proxy that appends to the header rather\n * than replacing it — picks any address it likes, and `clientIp` (the rate\n * limiter's default key) used to read the left-most entry, which is exactly\n * the one the client wrote. So the server decides here, once, at the edge,\n * and hands the app a single address it can rely on:\n *\n * - `none` (the default): no proxy is trusted. The header is replaced with the\n * socket's peer address, and `X-Real-IP` is dropped.\n * - `hops` (`GEMI_TRUST_PROXY=<n>`): the `n` proxies nearest the app are\n * trusted. Each appends the address it was reached from, so the client is\n * the `n`-th entry from the right of `X-Forwarded-For`. Anything\n * further left was written by someone the app does not trust and is dropped.\n * - `all` (`GEMI_TRUST_PROXY=true`): the inbound header is passed through\n * unchanged, as before 0.88. Only sound behind a proxy that overwrites\n * `X-Forwarded-For` (and `X-Real-IP`) rather than appending to it.\n */\nexport type ForwardedTrust =\n | { kind: \"none\" }\n | { kind: \"all\" }\n | { kind: \"hops\"; hops: number };\n\nconst NONE: ForwardedTrust = { kind: \"none\" };\n\n/**\n * `GEMI_TRUST_PROXY` as a policy. Unset, empty, `false`, `off` and `0` trust\n * nothing; `true` trusts everything; a positive integer is a hop count.\n * Anything else throws, so a typo fails the boot instead of silently trusting\n * nothing (every client sharing the proxy's address) or everything.\n */\nexport function parseTrustProxy(value: string | undefined): ForwardedTrust {\n const raw = (value ?? \"\").trim().toLowerCase();\n if (raw === \"\" || raw === \"false\" || raw === \"off\" || raw === \"0\") {\n return NONE;\n }\n if (raw === \"true\") {\n return { kind: \"all\" };\n }\n if (/^[1-9]\\d*$/.test(raw)) {\n return { kind: \"hops\", hops: Number(raw) };\n }\n throw new Error(\n `GEMI_TRUST_PROXY must be \"false\", \"true\" or the number of proxies in front of the app (e.g. 1). Got ${JSON.stringify(value)}.`,\n );\n}\n\n/**\n * Rewrites `headers` so `X-Forwarded-For` holds what `trust` says the client\n * address is. `peer` is the socket's remote address — `null` for a unix\n * socket, where the immediate hop is still counted as one proxy.\n */\nexport function applyForwardedTrust(\n headers: Headers,\n peer: string | null,\n trust: ForwardedTrust,\n): void {\n if (trust.kind === \"all\") {\n if (!headers.get(\"x-forwarded-for\") && peer) {\n headers.set(\"x-forwarded-for\", peer);\n }\n return;\n }\n\n // Under any other policy `X-Real-IP` is as client-written as the rest; the\n // address the app should use is the one left in `X-Forwarded-For`.\n headers.delete(\"x-real-ip\");\n\n let client: string | null = peer;\n if (trust.kind === \"hops\") {\n const entries = (headers.get(\"x-forwarded-for\") ?? \"\")\n .split(\",\")\n .map((entry) => entry.trim())\n .filter(Boolean);\n // The chain is `entries` + `peer`; the client sits `hops` places left of\n // its end, i.e. `entries[entries.length - hops]`. A shorter chain than\n // expected means the request skipped a proxy, so its left-most hop is the\n // furthest thing seen — never anything further left than that.\n const index = entries.length - trust.hops;\n client = index >= 0 ? entries[index]! : (entries[0] ?? peer);\n }\n\n if (client) {\n headers.set(\"x-forwarded-for\", client);\n } else {\n headers.delete(\"x-forwarded-for\");\n }\n}\n"
|
|
15
15
|
],
|
|
16
|
-
"mappings": ";w/BAAA,eAAS,UAET,SAAS,OAAM,IAAS,QCgBxB,WAAS,UACT,cAAS,oBAAW,WAAsB,QAW1C,FAAM,HAAuC,LAAC,DAAM,AAAM,JAQpD,HAAyB,DAYzB,HAAiB,JACjB,HAAqB,HAGrB,GAAa,EAEnB,SAAS,EAAW,CAAC,EAAiC,CACpD,GAAI,IAAQ,OACV,MAAO,GAKT,GAAI,CAAC,oBAAoB,KAAK,EAAI,KAAK,CAAC,EACtC,MAAO,GAET,IAAM,EAAQ,OAAO,EAAI,KAAK,CAAC,EAC/B,OAAO,OAAO,SAAS,CAAK,EAAI,KAAK,IAAI,EAAO,CAAC,EAAI,EAahD,SAAS,EAAmB,CAAC,EAA+D,CACjG,GAAI,IAAW,MAAQ,IAAW,OAChC,OAAO,KAGT,IAAM,EAAW,IAAI,IACrB,QAAW,KAAQ,EAAO,MAAM,GAAG,EAAG,CACpC,IAAO,KAAc,GAAU,EAAK,MAAM,GAAG,EACvC,EAAS,EAAU,KAAK,EAAE,YAAY,EAC5C,GAAI,IAAW,GACb,SAGF,IAAI,EAAI,EACR,QAAW,KAAS,EAAQ,CAC1B,IAAM,EAAY,EAAM,QAAQ,GAAG,EACnC,GAAI,IAAc,GAChB,SAEF,GAAI,EAAM,MAAM,EAAG,CAAS,EAAE,KAAK,EAAE,YAAY,IAAM,IAAK,CAC1D,EAAI,GAAY,EAAM,MAAM,EAAY,CAAC,CAAC,EAC1C,OAIJ,EAAS,IAAI,EAAQ,CAAC,EAGxB,OAAO,EAUF,SAAS,CAAiB,CAC/B,EACA,EAA+B,GACP,CACxB,IAAM,EAAW,GAAoB,CAAM,EAC3C,GAAI,CAAC,EACH,OAAO,KAGT,IAAM,EAAW,EAAS,IAAI,GAAG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,EAAI,qBAAqB,EAAK,GAAgB,CAAC,IAC7C,EAAuB,EAAK,IAAI,IAAI,EAAI,GAAG,EAAE,SAAU,EAAI,WAAW,CACxE,CACF,EAKA,OAAO,GAAqB,EAAiB,EAAK,CAAG,EAAI,GAE3D,YAAa,GAAkB,EAC/B,KAAM,QAAQ,IAAI,MAAQ,KAC1B,UAAW,GAAS,SACtB,CAAC,EAKD,OAJA,MAAM,GAAS,MAAM,CAAM,EAE3B,GAAmB,CAAE,KAAM,EAAO,KAAM,SAAQ,CAAC,EAE1C",
|
|
17
|
+
"debugId": "46819E01035BB5E764756E2164756E21",
|
|
18
18
|
"names": []
|
|
19
19
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{Q as T}from"./chunk-
|
|
2
|
+
import{Q as T}from"./chunk-6vz75swk.js";import{_ as A}from"./chunk-knq4ack4.js";import"./chunk-m7pghdcy.js";import{aa as y}from"./chunk-7zj6bk9a.js";import{Dk as r}from"./chunk-hxn0s3zh.js";var u=r(A(),1);var i=r(y(),1),E=r(A(),1);import{exec as d}from"child_process";import{promisify as I}from"util";var x=r(T(),1),_=(c,n,e)=>{if(n.Version!==1)throw Error(`Profile ${c} credential_process did not return Version 1.`);if(n.AccessKeyId===void 0||n.SecretAccessKey===void 0)throw Error(`Profile ${c} credential_process returned invalid credentials.`);if(n.Expiration){let w=new Date;if(new Date(n.Expiration)<w)throw Error(`Profile ${c} credential_process returned expired credentials.`)}let s=n.AccountId;if(!s&&e?.[c]?.aws_account_id)s=e[c].aws_account_id;let t={accessKeyId:n.AccessKeyId,secretAccessKey:n.SecretAccessKey,...n.SessionToken&&{sessionToken:n.SessionToken},...n.Expiration&&{expiration:new Date(n.Expiration)},...n.CredentialScope&&{credentialScope:n.CredentialScope},...s&&{accountId:s}};return x.setCredentialFeature(t,"CREDENTIALS_PROCESS","w"),t};var K=async(c,n,e)=>{let s=n[c];if(n[c]){let t=s.credential_process;if(t!==void 0){let w=I(E.externalDataInterceptor?.getTokenRecord?.().exec??d);try{let{stdout:o}=await w(t),S;try{S=JSON.parse(o.trim())}catch{throw Error(`Profile ${c} credential_process returned invalid JSON.`)}return _(c,S,n)}catch(o){throw new i.CredentialsProviderError(o.message,{logger:e})}}else throw new i.CredentialsProviderError(`Profile ${c} did not contain credential_process.`,{logger:e})}else throw new i.CredentialsProviderError(`Profile ${c} could not be found in shared credentials file.`,{logger:e})};var R=(c={})=>async({callerClientConfig:n}={})=>{c.logger?.debug("@aws-sdk/credential-provider-process - fromProcess");let e=await u.parseKnownFiles(c);return K(u.getProfileName({profile:c.profile??n?.profile}),e,c.logger)};export{R as fromProcess};
|
|
3
3
|
|
|
4
|
-
//# debugId=
|
|
4
|
+
//# debugId=455A75C534CFBB8E64756E2164756E21
|
|
@@ -7,6 +7,6 @@
|
|
|
7
7
|
"import { setCredentialFeature } from \"@aws-sdk/core/client\";\nexport const getValidatedProcessCredentials = (profileName, data, profiles) => {\n if (data.Version !== 1) {\n throw Error(`Profile ${profileName} credential_process did not return Version 1.`);\n }\n if (data.AccessKeyId === undefined || data.SecretAccessKey === undefined) {\n throw Error(`Profile ${profileName} credential_process returned invalid credentials.`);\n }\n if (data.Expiration) {\n const currentTime = new Date();\n const expireTime = new Date(data.Expiration);\n if (expireTime < currentTime) {\n throw Error(`Profile ${profileName} credential_process returned expired credentials.`);\n }\n }\n let accountId = data.AccountId;\n if (!accountId && profiles?.[profileName]?.aws_account_id) {\n accountId = profiles[profileName].aws_account_id;\n }\n const credentials = {\n accessKeyId: data.AccessKeyId,\n secretAccessKey: data.SecretAccessKey,\n ...(data.SessionToken && { sessionToken: data.SessionToken }),\n ...(data.Expiration && { expiration: new Date(data.Expiration) }),\n ...(data.CredentialScope && { credentialScope: data.CredentialScope }),\n ...(accountId && { accountId }),\n };\n setCredentialFeature(credentials, \"CREDENTIALS_PROCESS\", \"w\");\n return credentials;\n};\n"
|
|
8
8
|
],
|
|
9
9
|
"mappings": ";sNAAA,SCAA,S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AAC,EAI/G,WAAM,IAAI,2BAAyB,WAAW,mDAA8D,CACxG,QACJ,CAAC,GD/BF,IAAM,EAAc,CAAC,EAAO,CAAC,IAAM,OAAS,sBAAuB,CAAC,IAAM,CAC7E,EAAK,QAAQ,MAAM,oDAAoD,EACvE,IAAM,EAAW,MAAM,kBAAgB,CAAI,EAC3C,OAAO,EAA0B,iBAAe,CAC5C,QAAS,EAAK,SAAW,GAAoB,OACjD,CAAC,EAAG,EAAU,EAAK,MAAM",
|
|
10
|
-
"debugId": "
|
|
10
|
+
"debugId": "455A75C534CFBB8E64756E2164756E21",
|
|
11
11
|
"names": []
|
|
12
12
|
}
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"/**\n * Shallow-merges an app config slice over the framework defaults, ignoring keys\n * whose value is `undefined`.\n *\n * A plain `{ ...defaults, ...config }` lets an explicit `undefined` win — a\n * `defineMailConfig({ headers: undefined })`, or any optional property the app\n * spread in from another object, would erase the default and hand the service a\n * missing dependency. Omitting a key and setting it to `undefined` mean the\n * same thing for a config slice, so both fall back to the default here.\n */\nexport function withDefaults<T extends object>(\n defaults: Required<T>,\n config: Partial<T> | undefined,\n): Required<T>;\nexport function withDefaults<D extends object, C extends object>(\n defaults: D,\n config: C | undefined,\n): D & C;\nexport function withDefaults(\n defaults: Record<string, any>,\n config: Record<string, any> | undefined,\n) {\n const merged: Record<string, any> = { ...defaults };\n if (!config) {\n return merged;\n }\n for (const key of Object.keys(config)) {\n if (config[key] !== undefined) {\n merged[key] = config[key];\n }\n }\n return merged;\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AAkBO,SAAS,CAAY,CAC1B,EACA,EACA,CACA,IAAM,EAA8B,IAAK,CAAS,EAClD,GAAI,CAAC,EACH,OAAO,EAET,QAAW,KAAO,OAAO,KAAK,CAAM,EAClC,GAAI,EAAO,KAAS,OAClB,EAAO,GAAO,EAAO,GAGzB,OAAO",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "7BEA0C1A9D64486864756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ld as G}from"./chunk-rmgkc3a2.js";import{Kg as F}from"./chunk-cwt8e782.js";import{dj as E}from"./chunk-sv125fqq.js";import{Jj as x,wj as B}from"./chunk-npbf06c1.js";class J extends G{register(){this.app.singleton(x,()=>{let j=new x(E(B(),this.app.config.get("database",{})));return K(j),j})}async shutdown(){if(!this.app.resolved(x))return;await this.app.make(x).close()}}function K(j){if(Bun.env.NODE_ENV!=="development")return;for(let z of j.connectionNames){let A=j.connection(z);if(F(A.dialect))continue;let H=z===j.name?"DATABASE_URL":`The "${z}" database connection`;console.warn(`[gemi] ${H} points at ${A.dialect}, which the gemi ORM `+"does not implement \u2014 only sqlite and postgres are. The connection "+`works, so raw SQL through DB.query / DB.sql and transactions are fine, but every model operation will raise UnsupportedDialectError.
|
|
3
3
|
(development only)`)}}
|
|
4
4
|
export{J as Ea};
|
|
5
5
|
|
|
6
|
-
//# debugId=
|
|
6
|
+
//# debugId=1B5885ECBF9D101E64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"import { ormSupports } from \"../orm/dialect\";\nimport { ServiceProvider } from \"../support/ServiceProvider\";\nimport { withDefaults } from \"../support/withDefaults\";\nimport { databaseConfigDefaults, type DatabaseConfig } from \"./config\";\nimport { DatabaseManager } from \"./DatabaseManager\";\n\nexport class DatabaseServiceProvider extends ServiceProvider {\n register() {\n this.app.singleton(\n DatabaseManager,\n () => {\n const database = new DatabaseManager(\n withDefaults(\n databaseConfigDefaults(),\n this.app.config.get<DatabaseConfig>(\"database\", {}),\n ),\n );\n\n warnIfOrmUnavailable(database);\n return database;\n },\n );\n }\n\n /**\n * Closes every connection's pool. Registered early, so it runs late: after\n * the queue and the scheduler have waited for their jobs, which still need\n * it. Bun's `close()` lets a query already sent finish.\n *\n * On the way out of a production server this only tidies up before the\n * exit. Under `gemi dev` it is the whole point: a `bun --hot` reload boots\n * a new application with a new pool, and the replaced one's is closed here\n * rather than left holding its connections for the life of the process\n * (#652).\n */\n async shutdown() {\n // Resolving the manager now would open a pool only to close it.\n if (!this.app.resolved(DatabaseManager)) return;\n await this.app.make(DatabaseManager).close();\n }\n}\n\n/**\n * Say it at boot, not on the first model query.\n *\n * `DatabaseManager` connects to MySQL and MariaDB without complaint — Bun's\n * client speaks them — and the ORM's compiler has no dialect for either. So a\n * deploy pointed at one starts, passes a health check, serves whatever does not\n * touch a model, and raises `UnsupportedDialectError` on the first `findMany`.\n * That is the latest and most expensive moment to learn it.\n *\n * A **warning rather than a throw**, deliberately: raw SQL through `DB.query`\n * and `DB.sql` genuinely works on those dialects, and so do transactions.\n * Refusing to construct the manager would break code that is correct today to\n * pre-empt an error the ORM already raises clearly. The supported set is a\n * property of the query compiler, not of the connection.\n *\n * Development only, for the same reason the slow-transaction warning is: it is\n * a diagnostic aimed at whoever is choosing the database, and it should not\n * add noise to a production log every time the container starts.\n */\nfunction warnIfOrmUnavailable(database: DatabaseManager): void {\n if (process.env.NODE_ENV !== \"development\") return;\n\n // Every connection, not only the default one. A named connection is a whole\n // pool an application will run model queries on — `Model.on(\"analytics\")` —\n // so it can be pointed at MySQL exactly as the default can, and warning about\n // only one of them would make the check pass while the query that raises is\n // on the other.\n for (const name of database.connectionNames) {\n const connection = database.connection(name);\n if (ormSupports(connection.dialect)) continue;\n\n const source =\n name === database.name\n ? \"DATABASE_URL\"\n : `The \"${name}\" database connection`;\n\n console.warn(\n `[gemi] ${source} points at ${connection.dialect}, which the gemi ORM ` +\n `does not implement — only sqlite and postgres are. The connection ` +\n `works, so raw SQL through DB.query / DB.sql and transactions are ` +\n `fine, but every model operation will raise ` +\n `UnsupportedDialectError.\\n(development only)`,\n );\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";8LAMO,AAAM,IAAgC,LAAgB,CAC3D,QAAQ,EAAG,CACT,KAAK,IAAI,UACP,EACA,IAAM,CACJ,IAAM,EAAW,IAAI,EACnB,EACE,EAAuB,EACvB,KAAK,IAAI,OAAO,IAAoB,WAAY,CAAC,CAAC,CACpD,CACF,EAGA,OADA,EAAqB,CAAQ,EACtB,EAEX,OAcI,SAAQ,EAAG,CAEf,GAAI,CAAC,KAAK,IAAI,SAAS,CAAe,EAAG,OACzC,MAAM,KAAK,IAAI,KAAK,CAAe,EAAE,MAAM,EAE/C,CAqBA,SAAS,CAAoB,CAAC,EAAiC,CAC7D,GAAI,mBAAyB,cAAe,OAO5C,QAAW,KAAQ,EAAS,gBAAiB,CAC3C,IAAM,EAAa,EAAS,WAAW,CAAI,EAC3C,GAAI,EAAY,EAAW,OAAO,EAAG,SAErC,IAAM,EACJ,IAAS,EAAS,KACd,eACA,QAAQ,yBAEd,QAAQ,KACN,UAAU,eAAoB,EAAW,+BACvC,0EACA;AAAA,mBAGJ",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "1B5885ECBF9D101E64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
class m{name;cron;withoutOverlapping=!1;onOneServer=!1;shouldRun(){return!0}callback(f){}onTick(){}onComplete(){}static exp(f){return f}}
|
|
3
|
-
export{m as
|
|
3
|
+
export{m as nd};
|
|
4
4
|
|
|
5
|
-
//# debugId=
|
|
5
|
+
//# debugId=C92A7CB6F6971D3B64756E2164756E21
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
"// A cron expression accepted by `Bun.cron`: a 5-field expression\n// (`minute hour day-of-month month day-of-week`, interpreted in UTC) or one of\n// the nicknames below. The `string & {}` member keeps arbitrary expressions\n// assignable while still surfacing the nicknames in editor autocomplete.\nexport type CronExpression =\n | \"@yearly\"\n | \"@annually\"\n | \"@monthly\"\n | \"@weekly\"\n | \"@daily\"\n | \"@midnight\"\n | \"@hourly\"\n | (string & {});\n\nimport type { HeldLock } from \"../lock/LockManager\";\n\nexport type WithoutOverlapping =\n | boolean\n | {\n /**\n * The lock's lease, in milliseconds: how long it outlives an instance\n * that died holding it. Renewed every third of this while the tick\n * runs, so it does not limit how long a tick may take. Default five\n * minutes.\n */\n expiresAfter?: number;\n };\n\nexport class CronJob {\n name: string;\n cron: CronExpression;\n\n /**\n * Skips a tick while an earlier tick of this job is still running, on this\n * instance or any other sharing the queue's storage. With the database\n * queue driver that is a lock row in `gemi_locks`; with the memory driver\n * it only covers this process.\n *\n * The lock is held across `onTick`, `callback` and `onComplete`, and handed\n * to `callback` as its argument. If its lease is lost while the tick runs\n * (the instance stalled past `expiresAfter`), `lock.lost` aborts and the\n * scheduler logs it. Writes that must not land after that go through\n * `lock.fence(...)`.\n *\n * It does not stop a second instance from running the same tick after the\n * first one finished; `onOneServer` does.\n */\n withoutOverlapping: WithoutOverlapping = false;\n\n /**\n * Runs each tick on one instance only, across every instance sharing the\n * queue's storage: the first to claim the tick's minute runs it, the others\n * skip it. Assumes the instances' clocks agree to well within a minute.\n */\n onOneServer = false;\n\n /**\n * Decides whether this tick happens at all. Evaluated once per tick, before\n * anything else; returning `false` skips `onTick`, `callback` and\n * `onComplete` alike.\n *\n * ### Why this is a member and not a line the job writes for itself\n *\n * A job that reports outward — mails a digest, opens a Sentry issue, pings a\n * channel — must not fire from a laptop, and the guard for that has to cover\n * the whole tick. There was nowhere to write it. gemi calls `onTick` and\n * `onComplete` *outside* `callback`, so a guard placed in a lifecycle hook\n * only stops the hook it lives in: an early `return` at the top of `callback`\n * leaves the job still announcing that it started and still announcing that\n * it finished, which for an outward-reporting job is most of the damage.\n *\n * The only construct that covered every hook was an abstract base class that\n * shadowed `callback` with the guard and renamed the real body to `run()` —\n * and that costs the app the framework's own vocabulary. A job then reads\n * `async run()` while every page of the documentation reads `async\n * callback()`, so the next person to follow the docs writes a `callback` the\n * base class never calls: no error, no output, a job that silently does\n * nothing. Forgetting *this* member fails the other way round — the job runs,\n * which is what it did before anyone asked for a gate.\n *\n * ### What it gates\n *\n * Work, not registration. A job whose gate returns `false` is still\n * scheduled, still holds its `Bun.cron` handle, and still appears in\n * `app(Scheduler).jobs` — \"is it scheduled\" and \"will it do anything\" are\n * different questions and the second one is answered per tick. That is also\n * why this is a method: a field would be read once, when the scheduler\n * constructs the job at boot, and would freeze whatever it saw then.\n *\n * A gate that throws is logged and treated as `false`. Cron work recurs, so\n * a skipped tick is recovered by the next one, while an email sent from the\n * wrong machine is not recovered at all.\n *\n * ### Composing with a base class\n *\n * Nothing here calls `super` for you. A subclass that overrides `shouldRun`\n * for its own reason silently replaces whatever its base was gating on, so\n * narrow rather than redefine:\n *\n * ```typescript\n * async shouldRun() {\n * return (await super.shouldRun()) && this.hasSubscribers();\n * }\n * ```\n *\n * A shared base should annotate its return type as written here rather than\n * let it be inferred: a base returning a plain `boolean` narrows the\n * signature its subclasses inherit, and the `await super` above then does not\n * typecheck against it.\n */\n shouldRun(): Promise<boolean> | boolean {\n return true;\n }\n\n /**\n * The tick's work. `lock` is the `withoutOverlapping` lock when the job\n * declares one.\n */\n callback(_lock?: HeldLock): Promise<void> | void {}\n onTick(): Promise<void> | void {}\n onComplete(): Promise<void> | void {}\n\n static exp(expression: CronExpression) {\n return expression;\n }\n}\n"
|
|
6
6
|
],
|
|
7
7
|
"mappings": ";AA4BO,MAAM,CAAQ,CACnB,KACA,KAiBA,mBAAyC,GAOzC,YAAc,GAwDd,SAAS,EAA+B,CACtC,MAAO,GAOT,QAAQ,CAAC,EAAwC,EACjD,MAAM,EAAyB,EAC/B,UAAU,EAAyB,QAE5B,IAAG,CAAC,EAA4B,CACrC,OAAO,EAEX",
|
|
8
|
-
"debugId": "
|
|
8
|
+
"debugId": "C92A7CB6F6971D3B64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function y(j){return Object.freeze({name:j})}class H extends Error{key;constructor(j){super(`Request state "${j.name}" is not set. Check that whatever sets it (a middleware, \`context()\`) ran for this request.`);this.key=j;this.name="MissingRequestStateError"}}class z{#j=new Map;get(j){return this.#j.get(j)}require(j){if(!this.#j.has(j))throw new H(j);return this.#j.get(j)}set(j,J){return this.#j.set(j,J),J}has(j){return this.#j.has(j)}delete(j){return this.#j.delete(j)}static carry(j,J){for(let[Q,Z]of j.#j)if(!J.#j.has(Q))J.#j.set(Q,Z)}}import{AsyncLocalStorage as R}from"async_hooks";var _=new Set(["woff2","woff","truetype","opentype","collection","embedded-opentype","svg"]),x={woff2:"woff2",woff:"woff",ttf:"truetype",otf:"opentype",ttc:"collection",eot:"embedded-opentype",svg:"svg"};var C=new Set(["auto","block","swap","fallback","optional"]),S=/^[a-zA-Z0-9.%+\- ]+$/,w=/^[uU]\+[0-9a-fA-F?]{1,6}(-[0-9a-fA-F]{1,6})?(\s*,\s*[uU]\+[0-9a-fA-F?]{1,6}(-[0-9a-fA-F]{1,6})?)*$/;function G(j){throw TypeError(`Meta.fonts: ${j}`)}function I(j){let J=(j.split(/[?#]/)[0]??"").split("/").pop()??"",Q=J.lastIndexOf(".");return Q===-1?null:x[J.slice(Q+1).toLowerCase()]??null}function B(j,J){if(J===void 0||J===null)return null;let Q=String(J).trim();if(!Q||!S.test(Q))G(`${j} ${JSON.stringify(J)} is not a valid font-${j} value`);return Q}function N(j){if(!Array.isArray(j))G("expected an array of fonts");return j.map((J)=>{if(typeof J?.family!=="string"||!J.family.trim())G("every font needs a family");let Q=typeof J.src==="string"?[{url:J.src}]:J.src;if(!Array.isArray(Q)||Q.length===0)G(`font "${J.family}" needs a src`);let Z=Q.map((V)=>{if(typeof V?.url!=="string"||!V.url.trim())G(`font "${J.family}" has a source without a url`);if(V.format!==void 0&&!_.has(V.format))G(`font "${J.family}" has an unknown format ${JSON.stringify(V.format)}`);return{url:V.url.trim(),format:V.format??I(V.url)}}),$=J.display??"swap";if(!C.has($))G(`display ${JSON.stringify($)} is not a valid font-display value`);let U=J.unicodeRange?.trim()||null;if(U&&!w.test(U))G(`unicodeRange ${JSON.stringify(J.unicodeRange)} is not a valid unicode-range`);return{family:J.family.trim(),src:Z,weight:B("weight",J.weight),style:B("style",J.style),stretch:B("stretch",J.stretch),display:$,unicodeRange:U,preload:J.preload===!0}})}class K{content={title:"Gemi App",description:null,openGraph:null,htmlAttributes:null,canonical:null,alternates:null,fonts: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,fonts:this.content.fonts}}htmlAttributes(j){this.touched=!0;let J=Object.fromEntries(Object.entries(j).filter(([,Q])=>Q!==void 0));this.content.htmlAttributes={...this.content.htmlAttributes,...J}}canonical(j){this.touched=!0,this.content.canonical=j}alternates(j){this.touched=!0,this.content.alternates=j}fonts(j){let J=N(j);this.touched=!0,this.content.fonts=[...this.content.fonts??[],...J]}title(j){this.touched=!0,this.content.title=j}description(j){this.touched=!0,this.content.description=j}openGraph({title:j,description:J,type:Q,url:Z,image:$,imageAlt:U,imageWidth:V,imageHeight:P,twitterImage:Y=$,twitterImageAlt:M=U,twitterImageWidth:E=V,twitterImageHeight:O=P}){this.touched=!0;let b=$,D=Y;if($&&!$.startsWith("http"))b=`${process.env.HOST_NAME}${$}`,D=`${process.env.HOST_NAME}${Y}`;this.content.openGraph=Object.fromEntries(Object.entries({title:j,description:J,type:Q,url:Z,image:b,imageAlt:U,imageWidth:V,imageHeight:P,twitterImage:D,twitterImageAlt:M,twitterImageWidth:E,twitterImageHeight:O}).filter(([q,A])=>A!==void 0))}}function T(j,J,Q={}){return[`${j}=${J}`,Q.maxAge?`Max-Age=${Q.maxAge}`:"",Q.httpOnly?"HttpOnly":"",Q.secure?"Secure":"",Q.sameSite?`SameSite=${Q.sameSite}`:"SameSite=Strict",Q.path?`Path=${Q.path}`:"Path=/",Q.domain?`Domain=${Q.domain}`:"",Q.expires?`Expires=${Q.expires.toUTCString()}`:"",Q.partitioned?"Partitioned":""].filter((Z)=>Z!=="").join("; ")}var X=new R;class W{req;cookies=new Set;headers=new Headers;serverQueries=null;user=null;csrfHmac=null;locale=null;metadata=new K;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 J=Promise.resolve(j).then(()=>{},()=>{});this.pendingWork.add(J),J.then(()=>this.pendingWork.delete(J))}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,J,Q={}){this.cookies.add(T(j,J,Q))}deleteCookie(j,J={}){this.cookies.add(T(j,"",{...J,maxAge:-1}))}setHeaders(j,J){this.headers.set(j,J)}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 F="session_id";function k(){let j=L.getStore();if(!j)return null;if(j.sessionId)return j.sessionId;let J=j.req?.cookies?.get(F);if(J)j.sessionId=J;return j.sessionId}function f(){let j=L.getStore();if(!j)return null;let J=k();if(J)return J;let Q=Bun.randomUUIDv7();return j.sessionId=Q,j.setCookie(F,Q,{httpOnly:!0,secure:Bun.env.NODE_ENV==="production",sameSite:"Lax",expires:new Date(Date.now()+31536000000)}),Q}class L{static getStore(){return X.getStore()}static setRequest(j){X.getStore().req=j}static run(j,J,Q){let Z=new W(j);if(Q){if(Z.user=Q.user,Q.state&&j.state)z.carry(Q.state,j.state)}return X.run(Z,J)}static runWith(j,J){return X.run(j,J)}static exit(j){return X.exit(j)}}
|
|
3
|
+
export{y as _h,H as $h,z as ai,k as bi,f as ci,L as di};
|
|
4
|
+
|
|
5
|
+
//# debugId=CBEECEB9A0F9A15264756E2164756E21
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../http/requestState.ts", "../http/requestContext.ts", "../client/fonts.ts", "../http/Metadata.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"/**\n * Typed values kept for the length of one request (#887): what a middleware\n * resolved, handed to the controller, or what an agent turn's `context()`\n * decided, handed to its `onMessage`.\n *\n * ```ts\n * export const pageScope = stateKey<PageScope>(\"pageScope\");\n *\n * // middleware\n * this.req.state.set(pageScope, await resolvePageScope(this.req.params.pageId));\n *\n * // controller\n * const scope = req.state.require(pageScope);\n * ```\n *\n * WHY KEYS, NOT A DECLARATION-MERGED INTERFACE. A key compares by identity, so\n * it stays private to the module that made it and two modules choosing the\n * same name cannot collide; and a read that must find a value (`require`)\n * comes back as `T`, where every field of an app-wide interface would have to\n * be optional. The name is for error messages only.\n *\n * WHY ON THE REQUEST, NOT THE CONTEXT STORE. Every `HttpRequest` built for a\n * request — the router's, a middleware's, `req = new HttpRequest()` in a\n * handler, a custom request class — shares one `RequestState`, so it reads the\n * same wherever it is reached from. Held by those objects rather than by the\n * store, it is still readable after the store is destroyed, by a hook that\n * runs as a streamed body ends.\n */\nexport interface StateKey<T> {\n readonly name: string;\n /** Type-only: carries `T`. Never set. */\n readonly __type?: T;\n}\n\nexport function stateKey<T>(name: string): StateKey<T> {\n return Object.freeze({ name });\n}\n\n/** `req.state.require(key)` found nothing: the code that sets it did not run. */\nexport class MissingRequestStateError extends Error {\n constructor(public readonly key: StateKey<unknown>) {\n super(\n `Request state \"${key.name}\" is not set. ` +\n \"Check that whatever sets it (a middleware, `context()`) ran for this request.\",\n );\n this.name = \"MissingRequestStateError\";\n }\n}\n\nexport class RequestState {\n #values = new Map<StateKey<unknown>, unknown>();\n\n /** The value, or `undefined` when nothing set it for this request. */\n get<T>(key: StateKey<T>): T | undefined {\n return this.#values.get(key) as T | undefined;\n }\n\n /** The value; throws `MissingRequestStateError` when nothing set it. */\n require<T>(key: StateKey<T>): T {\n if (!this.#values.has(key)) {\n throw new MissingRequestStateError(key);\n }\n return this.#values.get(key) as T;\n }\n\n /** Sets the value for the rest of this request and returns it. */\n set<T>(key: StateKey<T>, value: NoInfer<T>): T {\n this.#values.set(key, value);\n return value;\n }\n\n has(key: StateKey<any>): boolean {\n return this.#values.has(key);\n }\n\n delete(key: StateKey<any>): boolean {\n return this.#values.delete(key);\n }\n\n /**\n * Internal: copies what the global middleware list set into the route's\n * request (see `RequestContext.run`). A key the route already holds keeps\n * its own value.\n */\n static carry(from: RequestState, to: RequestState) {\n for (const [key, value] of from.#values) {\n if (!to.#values.has(key)) {\n to.#values.set(key, value);\n }\n }\n }\n}\n",
|
|
6
|
+
"import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type { HttpRequest } from \"./HttpRequest\";\nimport { Metadata } from \"./Metadata\";\nimport type { ByteRange } from \"./range\";\nimport { RequestState } from \"./requestState\";\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, and the request state the list set (#887).\n */\nexport interface CarriedContext {\n user: any;\n state?: RequestState;\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 if (carried.state && httpRequest.state) {\n RequestState.carry(carried.state, httpRequest.state);\n }\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",
|
|
7
|
+
"/**\n * `Meta.fonts`: the `@font-face` rules and font preloads of one response.\n * Pure, so the server (validation) and `<Head />` (rendering) share it.\n */\n\n/** A font file format, as `@font-face`'s `format()` names it. */\nexport type FontFormat =\n | \"woff2\"\n | \"woff\"\n | \"truetype\"\n | \"opentype\"\n | \"collection\"\n | \"embedded-opentype\"\n | \"svg\";\n\n/** One file of a font; list the preferred format first. */\nexport type FontSource = {\n url: string;\n /** Inferred from the url's extension when left out. */\n format?: FontFormat;\n};\n\n/** One `@font-face`, see `Meta.fonts`. */\nexport type MetaFont = {\n /** The `font-family` name that CSS refers to, e.g. `\"Acme Sans\"`. */\n family: string;\n /** A url, or several files with the preferred one first. */\n src: string | FontSource[];\n /** `font-weight`: `400`, `\"bold\"`, or a range for a variable font, `\"100 900\"`. */\n weight?: string | number;\n /** `font-style`: `\"normal\"`, `\"italic\"`, `\"oblique 10deg\"`. */\n style?: string;\n /** `font-stretch`: `\"condensed\"`, `\"75% 125%\"`. */\n stretch?: string;\n /** `font-display`. Defaults to `\"swap\"`. */\n display?: \"auto\" | \"block\" | \"swap\" | \"fallback\" | \"optional\";\n /** `unicode-range`, e.g. `\"U+0000-00FF, U+0131\"`. */\n unicodeRange?: string;\n /**\n * Preload the first file with `<link rel=\"preload\" as=\"font\" crossorigin>`.\n * Only for fonts the page renders above the fold: a preloaded font that is\n * never used is a wasted download (and a console warning).\n */\n preload?: boolean;\n};\n\n/** A font after `normalizeFonts`: validated, with every source's format resolved. */\nexport type NormalizedFont = {\n family: string;\n src: { url: string; format: FontFormat | null }[];\n weight: string | null;\n style: string | null;\n stretch: string | null;\n display: NonNullable<MetaFont[\"display\"]>;\n unicodeRange: string | null;\n preload: boolean;\n};\n\nexport type FontPreload = { href: string; type: string | null };\n\nconst FORMATS = new Set<FontFormat>([\n \"woff2\",\n \"woff\",\n \"truetype\",\n \"opentype\",\n \"collection\",\n \"embedded-opentype\",\n \"svg\",\n]);\n\nconst FORMAT_BY_EXTENSION: Record<string, FontFormat> = {\n woff2: \"woff2\",\n woff: \"woff\",\n ttf: \"truetype\",\n otf: \"opentype\",\n ttc: \"collection\",\n eot: \"embedded-opentype\",\n svg: \"svg\",\n};\n\nconst MIME_BY_FORMAT: Partial<Record<FontFormat, string>> = {\n woff2: \"font/woff2\",\n woff: \"font/woff\",\n truetype: \"font/ttf\",\n opentype: \"font/otf\",\n collection: \"font/collection\",\n};\n\nconst DISPLAYS = new Set([\"auto\", \"block\", \"swap\", \"fallback\", \"optional\"]);\n\n// Descriptors are written into the CSS as they are, so only keywords, numbers,\n// angles and percentages pass: nothing that can end the declaration or rule.\nconst DESCRIPTOR = /^[a-zA-Z0-9.%+\\- ]+$/;\nconst UNICODE_RANGE = /^[uU]\\+[0-9a-fA-F?]{1,6}(-[0-9a-fA-F]{1,6})?(\\s*,\\s*[uU]\\+[0-9a-fA-F?]{1,6}(-[0-9a-fA-F]{1,6})?)*$/;\n\nfunction invalid(message: string): never {\n throw new TypeError(`Meta.fonts: ${message}`);\n}\n\n/** The format a url's extension implies (`.woff2` → `\"woff2\"`), ignoring query and hash. */\nexport function fontFormatOf(url: string): FontFormat | null {\n const file = (url.split(/[?#]/)[0] ?? \"\").split(\"/\").pop() ?? \"\";\n const dot = file.lastIndexOf(\".\");\n return dot === -1 ? null : (FORMAT_BY_EXTENSION[file.slice(dot + 1).toLowerCase()] ?? null);\n}\n\nfunction descriptor(name: string, value: string | number | undefined): string | null {\n if (value === undefined || value === null) return null;\n const text = String(value).trim();\n if (!text || !DESCRIPTOR.test(text)) {\n invalid(`${name} ${JSON.stringify(value)} is not a valid font-${name} value`);\n }\n return text;\n}\n\n/** Validates what a handler passed; throws a `TypeError` naming the bad value. */\nexport function normalizeFonts(fonts: MetaFont[]): NormalizedFont[] {\n if (!Array.isArray(fonts)) invalid(\"expected an array of fonts\");\n return fonts.map((font) => {\n if (typeof font?.family !== \"string\" || !font.family.trim()) {\n invalid(\"every font needs a family\");\n }\n const sources = typeof font.src === \"string\" ? [{ url: font.src }] : font.src;\n if (!Array.isArray(sources) || sources.length === 0) {\n invalid(`font \"${font.family}\" needs a src`);\n }\n const src = sources.map((source) => {\n if (typeof source?.url !== \"string\" || !source.url.trim()) {\n invalid(`font \"${font.family}\" has a source without a url`);\n }\n if (source.format !== undefined && !FORMATS.has(source.format)) {\n invalid(`font \"${font.family}\" has an unknown format ${JSON.stringify(source.format)}`);\n }\n return { url: source.url.trim(), format: source.format ?? fontFormatOf(source.url) };\n });\n const display = font.display ?? \"swap\";\n if (!DISPLAYS.has(display)) {\n invalid(`display ${JSON.stringify(display)} is not a valid font-display value`);\n }\n const unicodeRange = font.unicodeRange?.trim() || null;\n if (unicodeRange && !UNICODE_RANGE.test(unicodeRange)) {\n invalid(`unicodeRange ${JSON.stringify(font.unicodeRange)} is not a valid unicode-range`);\n }\n return {\n family: font.family.trim(),\n src,\n weight: descriptor(\"weight\", font.weight),\n style: descriptor(\"style\", font.style),\n stretch: descriptor(\"stretch\", font.stretch),\n display,\n unicodeRange,\n preload: font.preload === true,\n };\n });\n}\n\n/**\n * A CSS string literal holding `value`. Quotes, backslashes, control\n * characters and `<` (so `</style>` can't close the element) are escaped.\n */\nexport function cssString(value: string): string {\n // oxlint-disable-next-line no-control-regex -- escaping them is the point\n const escaped = value.replace(/[\\\\\"<>\\u0000-\\u001f\\u007f]/g, (char) =>\n char === \"\\\\\" || char === '\"' ? `\\\\${char}` : `\\\\${char.charCodeAt(0).toString(16)} `,\n );\n return `\"${escaped}\"`;\n}\n\n/** One `@font-face` rule. */\nexport function fontFaceRule(font: NormalizedFont): string {\n const src = font.src\n .map(({ url, format }) => `url(${cssString(url)})${format ? ` format(${cssString(format)})` : \"\"}`)\n .join(\", \");\n const declarations = [\n `font-family: ${cssString(font.family)}`,\n `src: ${src}`,\n font.weight && `font-weight: ${font.weight}`,\n font.style && `font-style: ${font.style}`,\n font.stretch && `font-stretch: ${font.stretch}`,\n `font-display: ${font.display}`,\n font.unicodeRange && `unicode-range: ${font.unicodeRange}`,\n ].filter(Boolean);\n return `@font-face { ${declarations.join(\"; \")}; }`;\n}\n\n/** The `@font-face` rules for `fonts`, an identical font declared twice once. */\nexport function fontFaceRules(fonts: NormalizedFont[] | null | undefined): string[] {\n return [...new Set((fonts ?? []).map(fontFaceRule))];\n}\n\n/** The first file of every font marked `preload`, each url once. */\nexport function fontPreloads(fonts: NormalizedFont[] | null | undefined): FontPreload[] {\n const preloads = new Map<string, FontPreload>();\n for (const font of fonts ?? []) {\n const first = font.preload ? font.src[0] : undefined;\n if (first && !preloads.has(first.url)) {\n preloads.set(first.url, {\n href: first.url,\n type: (first.format && MIME_BY_FORMAT[first.format]) ?? null,\n });\n }\n }\n return [...preloads.values()];\n}\n",
|
|
8
|
+
"import { type MetaFont, type NormalizedFont, normalizeFonts } from \"../client/fonts\";\n\nexport type { MetaFont };\n\nexport 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 fonts: 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 fonts: this.content.fonts,\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 /** Added to what earlier calls declared, so a layout and its page can both declare fonts. */\n fonts(fonts: MetaFont[]) {\n const normalized: NormalizedFont[] = normalizeFonts(fonts);\n this.touched = true;\n this.content.fonts = [...(this.content.fonts ?? []), ...normalized];\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"
|
|
9
|
+
],
|
|
10
|
+
"mappings": ";AAkCO,SAAS,CAAW,CAAC,EAA2B,CACrD,OAAO,OAAO,OAAO,CAAE,MAAK,CAAC,EAIxB,MAAM,UAAiC,KAAM,CACtB,IAA5B,WAAW,CAAiB,EAAwB,CAClD,MACE,kBAAkB,EAAI,mGAExB,EAJ0B,WAK1B,KAAK,KAAO,2BAEhB,CAEO,MAAM,CAAa,CACxB,GAAU,IAAI,IAGd,GAAM,CAAC,EAAiC,CACtC,OAAO,KAAK,GAAQ,IAAI,CAAG,EAI7B,OAAU,CAAC,EAAqB,CAC9B,GAAI,CAAC,KAAK,GAAQ,IAAI,CAAG,EACvB,MAAM,IAAI,EAAyB,CAAG,EAExC,OAAO,KAAK,GAAQ,IAAI,CAAG,EAI7B,GAAM,CAAC,EAAkB,EAAsB,CAE7C,OADA,KAAK,GAAQ,IAAI,EAAK,CAAK,EACpB,EAGT,GAAG,CAAC,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AO,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,GAEF,GADA,EAAM,KAAO,EAAQ,KACjB,EAAQ,OAAS,EAAY,MAC/B,EAAa,MAAM,EAAQ,MAAO,EAAY,KAAK,EAGvD,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",
|
|
11
|
+
"debugId": "CBEECEB9A0F9A15264756E2164756E21",
|
|
12
|
+
"names": []
|
|
13
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{Ej as K,Hj as y,xj as Y}from"./chunk-npbf06c1.js";import{AsyncLocalStorage as U}from"async_hooks";var z=new U;function O(){return z.getStore()?.tx}function _(){return z.getStore()?.connection??K}function h(j,q){let v=z.getStore();if(_()===j)return q();return F(j),z.run({...v,depth:v?.depth??0,connection:j===K?void 0:j},q)}function F(j){let q=z.getStore();if(q?.tx===void 0)return;let v=q.connection??K;if(v===j)return;throw new y(v,j)}function A(j){let q=z.getStore();if(q?.tx===void 0||q.afterCommit===void 0)return!1;let v=Z.get(q.afterCommit);if(v==="committed")return!1;if(v==="rolled_back")return!0;return q.afterCommit.push(j),!0}var Z=new WeakMap;function k(j){if(A(j))return Promise.resolve();let q=(v)=>{console.error("An after-commit callback threw. No transaction was open, so it ran immediately.",v)};try{return Promise.resolve(j()).catch(q)}catch(v){return q(v),Promise.resolve()}}function N(j){let q=z.getStore();if(q?.tx===void 0||q.commitDependsOn===void 0)return!1;return q.commitDependsOn.push(j),!0}class I extends Error{constructor(j){super(`A statement this transaction depended on failed after being issued on it, so the transaction rolled back instead of committing: ${j instanceof Error?j.message:String(j)}`,{cause:j});this.name="TransactionDependencyError"}}async function W(j,q){if(j.length===q)return;let B=(await Promise.allSettled(j.slice(q))).find((J)=>J.status==="rejected");if(B)throw new I(B.reason)}function T(){let j=z.getStore();return j?.tx===void 0?null:j.depth}function x(){return z.getStore()?.system===!0}function p(j){let q=z.getStore();return z.run({...q,depth:q?.depth??0,system:!0},j)}function f(j){return z.getStore()?.trashed?.get(j)}function C(j,q,v){let B=z.getStore(),J=new Map(B?.trashed);return J.set(j,q),z.run({...B,depth:B?.depth??0,trashed:J},v)}function l(){return z.getStore()?.actor}function u(j,q){let v=z.getStore();return z.run({...v,depth:v?.depth??0,system:!1,actor:{user:j??null}},q)}function D(j){if(Bun.env.NODE_ENV!=="development")return null;if(j===!1)return null;if(j===void 0)return Y;if(!Number.isFinite(j)||j<=0)return Y;return j}function w(j){let q=D(j);if(q===null)return()=>{};let v=Error("transaction opened here"),B=setTimeout(()=>{let J=v.stack?.split(`
|
|
3
3
|
`).slice(1).join(`
|
|
4
4
|
`)??"";console.warn(`[gemi] A database transaction has not settled after ${q}ms. It `+"reserves a pooled connection until it does \u2014 check for network or "+`filesystem I/O inside the callback, and move it outside the transaction if you find any.
|
|
5
5
|
${J}
|
|
6
6
|
(development only; set database.slowTransactionThreshold to change the threshold, or false to switch this off)`)},q);return B.unref?.(),()=>clearTimeout(B)}async function L(j,q){if(j.length===0)return;await z.run({...q,tx:void 0,afterCommit:void 0,commitDependsOn:void 0,depth:q?.depth??0},async()=>{for(let v of j)try{await v()}catch(B){console.error("An after-commit callback threw. The transaction it was waiting on had already committed and stays committed, and the callbacks after it still ran.",B)}})}function m(j,q,v){let B=z.getStore(),J=v?.connection??K;if(F(J),B?.tx){let G=B.afterCommit,V=G?.length??0,P=B.commitDependsOn,H=P?.length??0;return B.tx.savepoint((X)=>{let R=X;return z.run({...B,tx:R,depth:B.depth+1},async()=>{let S=await q(R);if(P)await W(P,H);return S})}).catch((X)=>{if(G)G.length=V;if(P)P.length=H;throw X})}let $=w(v?.slowTransactionThreshold),Q=[],M=[];try{return j.begin((G)=>z.run({...B,tx:G,depth:0,connection:J===K?void 0:J,afterCommit:Q,commitDependsOn:M},async()=>{let V=await q(G);return await W(M,0),V})).finally($).then(async(G)=>{return Z.set(Q,"committed"),await L(Q,B),G},(G)=>{throw Z.set(Q,"rolled_back"),G})}catch(G){throw $(),G}}
|
|
7
|
-
export{z as
|
|
7
|
+
export{z as ej,O as fj,_ as gj,h as hj,F as ij,A as jj,k as kj,N as lj,I as mj,T as nj,x as oj,p as pj,f as qj,C as rj,l as sj,u as tj,m as uj};
|
|
8
8
|
|
|
9
|
-
//# debugId=
|
|
9
|
+
//# debugId=F7605D555AE36ACE64756E2164756E21
|