gemi 0.57.0 → 0.58.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (228) hide show
  1. package/dist/app/index.js +1 -1
  2. package/dist/broadcasting/index.js +1 -1
  3. package/dist/bun/plugin.js +1 -1
  4. package/dist/bun/preload.js +1 -1
  5. package/dist/{chunk-swe2b6rv.js → chunk-01e3gk86.js} +1 -1
  6. package/dist/{chunk-msyqr4y7.js → chunk-0a2xgcj3.js} +2 -2
  7. package/dist/{chunk-msyqr4y7.js.map → chunk-0a2xgcj3.js.map} +1 -1
  8. package/dist/{chunk-64bq12j3.js → chunk-3337e5g0.js} +2 -2
  9. package/dist/{chunk-64bq12j3.js.map → chunk-3337e5g0.js.map} +1 -1
  10. package/dist/{chunk-f233yzxf.js → chunk-3g5bjvdf.js} +2 -2
  11. package/dist/{chunk-f233yzxf.js.map → chunk-3g5bjvdf.js.map} +1 -1
  12. package/dist/{chunk-rc2asvyf.js → chunk-3xadx444.js} +2 -2
  13. package/dist/{chunk-rc2asvyf.js.map → chunk-3xadx444.js.map} +1 -1
  14. package/dist/{chunk-7pn0bnsc.js → chunk-3zxwscmf.js} +2 -2
  15. package/dist/{chunk-4f69ygc8.js.map → chunk-3zxwscmf.js.map} +1 -1
  16. package/dist/{chunk-jzatvtjd.js → chunk-437085pe.js} +2 -2
  17. package/dist/{chunk-jzatvtjd.js.map → chunk-437085pe.js.map} +1 -1
  18. package/dist/{chunk-5fmbsy4q.js → chunk-4sz6pwtn.js} +2 -2
  19. package/dist/{chunk-5fmbsy4q.js.map → chunk-4sz6pwtn.js.map} +1 -1
  20. package/dist/{chunk-17m5wxv0.js → chunk-4yt5x8s2.js} +2 -2
  21. package/dist/{chunk-17m5wxv0.js.map → chunk-4yt5x8s2.js.map} +1 -1
  22. package/dist/{chunk-dxxak51x.js → chunk-5athahgr.js} +2 -2
  23. package/dist/{chunk-dxxak51x.js.map → chunk-5athahgr.js.map} +1 -1
  24. package/dist/{chunk-dcwjwfjc.js → chunk-5n2rvfh3.js} +2 -2
  25. package/dist/{chunk-dcwjwfjc.js.map → chunk-5n2rvfh3.js.map} +1 -1
  26. package/dist/{chunk-r8637cqv.js → chunk-6235kb30.js} +3 -3
  27. package/dist/{chunk-r8637cqv.js.map → chunk-6235kb30.js.map} +1 -1
  28. package/dist/{chunk-67zyjx0c.js → chunk-7b0x860b.js} +2 -2
  29. package/dist/{chunk-67zyjx0c.js.map → chunk-7b0x860b.js.map} +1 -1
  30. package/dist/{chunk-q8k3gh8k.js → chunk-7ef5n8k2.js} +2 -2
  31. package/dist/{chunk-q8k3gh8k.js.map → chunk-7ef5n8k2.js.map} +1 -1
  32. package/dist/{chunk-n2zmg475.js → chunk-7j6wbv12.js} +2 -2
  33. package/dist/{chunk-n2zmg475.js.map → chunk-7j6wbv12.js.map} +1 -1
  34. package/dist/{chunk-g5pj95dz.js → chunk-86jebsm4.js} +3 -3
  35. package/dist/{chunk-g5pj95dz.js.map → chunk-86jebsm4.js.map} +1 -1
  36. package/dist/chunk-87qab82w.js +5 -0
  37. package/dist/{chunk-9j9wqrb2.js.map → chunk-87qab82w.js.map} +7 -3
  38. package/dist/{chunk-74aj8ms2.js → chunk-9m2tbf3n.js} +2 -2
  39. package/dist/{chunk-74aj8ms2.js.map → chunk-9m2tbf3n.js.map} +1 -1
  40. package/dist/{chunk-bw8kt7ps.js → chunk-a2sgjpvq.js} +2 -2
  41. package/dist/{chunk-bw8kt7ps.js.map → chunk-a2sgjpvq.js.map} +1 -1
  42. package/dist/chunk-b35e128b.js +5 -0
  43. package/dist/{chunk-r9as9htn.js.map → chunk-b35e128b.js.map} +1 -1
  44. package/dist/{chunk-1esnvq2z.js → chunk-cyaz97p5.js} +2 -2
  45. package/dist/{chunk-1esnvq2z.js.map → chunk-cyaz97p5.js.map} +1 -1
  46. package/dist/{chunk-mqwrmbh4.js → chunk-d125j8t0.js} +3 -3
  47. package/dist/{chunk-mqwrmbh4.js.map → chunk-d125j8t0.js.map} +1 -1
  48. package/dist/{chunk-yhzb9qpk.js → chunk-dgsgjg53.js} +2 -2
  49. package/dist/{chunk-yhzb9qpk.js.map → chunk-dgsgjg53.js.map} +1 -1
  50. package/dist/{chunk-6c14bexh.js → chunk-eejmhtnc.js} +2 -2
  51. package/dist/{chunk-6c14bexh.js.map → chunk-eejmhtnc.js.map} +1 -1
  52. package/dist/{chunk-vdzb29p5.js → chunk-fjm4y8bn.js} +2 -2
  53. package/dist/{chunk-vdzb29p5.js.map → chunk-fjm4y8bn.js.map} +1 -1
  54. package/dist/{chunk-ma5rj4st.js → chunk-grdahng8.js} +2 -2
  55. package/dist/{chunk-ma5rj4st.js.map → chunk-grdahng8.js.map} +1 -1
  56. package/dist/{chunk-5txddtaa.js → chunk-gw6agevz.js} +3 -3
  57. package/dist/{chunk-5txddtaa.js.map → chunk-gw6agevz.js.map} +1 -1
  58. package/dist/{chunk-ba0rkpk5.js → chunk-hppagzz4.js} +4 -4
  59. package/dist/{chunk-ba0rkpk5.js.map → chunk-hppagzz4.js.map} +1 -1
  60. package/dist/chunk-hwa5sqw5.js +19 -0
  61. package/dist/{chunk-r9h6aj7g.js.map → chunk-hwa5sqw5.js.map} +12 -6
  62. package/dist/chunk-hxf1re93.js +4 -0
  63. package/dist/{chunk-6fc909z5.js.map → chunk-hxf1re93.js.map} +6 -5
  64. package/dist/{chunk-d6kgxmp7.js → chunk-j0c6ytkj.js} +3 -3
  65. package/dist/{chunk-d6kgxmp7.js.map → chunk-j0c6ytkj.js.map} +1 -1
  66. package/dist/{chunk-4f69ygc8.js → chunk-jhkjz9jr.js} +2 -2
  67. package/dist/{chunk-7pn0bnsc.js.map → chunk-jhkjz9jr.js.map} +1 -1
  68. package/dist/{chunk-e9zz0zfv.js → chunk-k0fvsyeh.js} +1 -1
  69. package/dist/{chunk-j21tm6jf.js → chunk-keehyx51.js} +2 -2
  70. package/dist/{chunk-j21tm6jf.js.map → chunk-keehyx51.js.map} +1 -1
  71. package/dist/{chunk-a70s8pz4.js → chunk-m3xy5xyf.js} +2 -2
  72. package/dist/{chunk-a70s8pz4.js.map → chunk-m3xy5xyf.js.map} +1 -1
  73. package/dist/{chunk-qkrba9c2.js → chunk-mwpdp09e.js} +2 -2
  74. package/dist/{chunk-qkrba9c2.js.map → chunk-mwpdp09e.js.map} +1 -1
  75. package/dist/{chunk-tzsnadg1.js → chunk-pmhd6zfc.js} +3 -3
  76. package/dist/{chunk-tzsnadg1.js.map → chunk-pmhd6zfc.js.map} +1 -1
  77. package/dist/chunk-qb5mv6pj.js +5 -0
  78. package/dist/chunk-qb5mv6pj.js.map +12 -0
  79. package/dist/{chunk-nqk3cx97.js → chunk-qgxr0g36.js} +2 -2
  80. package/dist/{chunk-nqk3cx97.js.map → chunk-qgxr0g36.js.map} +1 -1
  81. package/dist/{chunk-btr9kyqh.js → chunk-sy7jbdeb.js} +2 -2
  82. package/dist/{chunk-btr9kyqh.js.map → chunk-sy7jbdeb.js.map} +1 -1
  83. package/dist/{chunk-5z5xskg1.js → chunk-szss069z.js} +2 -2
  84. package/dist/{chunk-5z5xskg1.js.map → chunk-szss069z.js.map} +1 -1
  85. package/dist/{chunk-rxsmwbxv.js → chunk-tss5svjr.js} +2 -2
  86. package/dist/{chunk-rxsmwbxv.js.map → chunk-tss5svjr.js.map} +1 -1
  87. package/dist/{chunk-dwz0wbhj.js → chunk-vj6f2bmb.js} +2 -2
  88. package/dist/{chunk-dwz0wbhj.js.map → chunk-vj6f2bmb.js.map} +1 -1
  89. package/dist/{chunk-32d510cd.js → chunk-vr90r27j.js} +2 -2
  90. package/dist/{chunk-32d510cd.js.map → chunk-vr90r27j.js.map} +1 -1
  91. package/dist/{chunk-jny4f23c.js → chunk-w62m5f0n.js} +3 -3
  92. package/dist/{chunk-jny4f23c.js.map → chunk-w62m5f0n.js.map} +1 -1
  93. package/dist/{chunk-k5bjfhz8.js → chunk-w7rf99w6.js} +2 -2
  94. package/dist/{chunk-k5bjfhz8.js.map → chunk-w7rf99w6.js.map} +1 -1
  95. package/dist/{chunk-fck5yw2s.js → chunk-wbrj0gya.js} +2 -2
  96. package/dist/{chunk-fck5yw2s.js.map → chunk-wbrj0gya.js.map} +1 -1
  97. package/dist/{chunk-11dkjm1r.js → chunk-xdv1b8mr.js} +2 -2
  98. package/dist/{chunk-11dkjm1r.js.map → chunk-xdv1b8mr.js.map} +1 -1
  99. package/dist/{chunk-katt90qz.js → chunk-xey9cbap.js} +2 -2
  100. package/dist/{chunk-katt90qz.js.map → chunk-xey9cbap.js.map} +1 -1
  101. package/dist/{chunk-ae6xz52s.js → chunk-xzk827r3.js} +2 -2
  102. package/dist/{chunk-ae6xz52s.js.map → chunk-xzk827r3.js.map} +1 -1
  103. package/dist/{chunk-8v81dvje.js → chunk-y6a8r2bn.js} +3 -3
  104. package/dist/{chunk-8v81dvje.js.map → chunk-y6a8r2bn.js.map} +1 -1
  105. package/dist/{chunk-nkbreczg.js → chunk-yed5whgs.js} +3 -3
  106. package/dist/{chunk-nkbreczg.js.map → chunk-yed5whgs.js.map} +1 -1
  107. package/dist/{chunk-cecq6q1b.js → chunk-yf7vz71n.js} +1 -1
  108. package/dist/{chunk-knvxwrwh.js → chunk-yjzs247s.js} +2 -2
  109. package/dist/{chunk-knvxwrwh.js.map → chunk-yjzs247s.js.map} +1 -1
  110. package/dist/{chunk-ka4tdhm8.js → chunk-yy0eb9wn.js} +2 -2
  111. package/dist/{chunk-ka4tdhm8.js.map → chunk-yy0eb9wn.js.map} +1 -1
  112. package/dist/{chunk-1nqdzmvm.js → chunk-zbxgbr12.js} +2 -2
  113. package/dist/{chunk-1nqdzmvm.js.map → chunk-zbxgbr12.js.map} +1 -1
  114. package/dist/{chunk-wrypq618.js → chunk-zh2egcyb.js} +2 -2
  115. package/dist/{chunk-wrypq618.js.map → chunk-zh2egcyb.js.map} +1 -1
  116. package/dist/chunks/{ThemeProvider-li1J_igh.js → ThemeProvider-ByU4BQdL.js} +68 -2
  117. package/dist/chunks/ThemeProvider-ByU4BQdL.js.map +1 -0
  118. package/dist/client/ClientRouter.d.ts.map +1 -1
  119. package/dist/client/ComponentContext.d.ts +46 -0
  120. package/dist/client/ComponentContext.d.ts.map +1 -1
  121. package/dist/client/ProgressManager.d.ts +1 -1
  122. package/dist/client/RouteStateContext.d.ts +9 -0
  123. package/dist/client/RouteStateContext.d.ts.map +1 -1
  124. package/dist/client/ServerDataProvider.d.ts +7 -0
  125. package/dist/client/ServerDataProvider.d.ts.map +1 -1
  126. package/dist/client/index.d.ts +2 -1
  127. package/dist/client/index.d.ts.map +1 -1
  128. package/dist/client/index.js +77 -12
  129. package/dist/client/index.js.map +1 -1
  130. package/dist/client/init.d.ts.map +1 -1
  131. package/dist/client/rpc.d.ts +42 -0
  132. package/dist/client/rpc.d.ts.map +1 -1
  133. package/dist/client/useFeature.d.ts +40 -0
  134. package/dist/client/useFeature.d.ts.map +1 -0
  135. package/dist/config/index.js +1 -1
  136. package/dist/console/run.js +2 -2
  137. package/dist/console/run.js.map +1 -1
  138. package/dist/container/index.js +2 -2
  139. package/dist/container/index.js.map +1 -1
  140. package/dist/database/index.js +2 -2
  141. package/dist/database/index.js.map +1 -1
  142. package/dist/email/index.js +2 -2
  143. package/dist/email/index.js.map +1 -1
  144. package/dist/facades/Features.d.ts +57 -0
  145. package/dist/facades/Features.d.ts.map +1 -0
  146. package/dist/facades/index.d.ts +1 -0
  147. package/dist/facades/index.d.ts.map +1 -1
  148. package/dist/facades/index.js +2 -2
  149. package/dist/facades/index.js.map +1 -1
  150. package/dist/foundation/index.js +2 -2
  151. package/dist/foundation/index.js.map +1 -1
  152. package/dist/gemi.d.ts +13 -5
  153. package/dist/http/ApiRouter.d.ts +3 -2
  154. package/dist/http/ApiRouter.d.ts.map +1 -1
  155. package/dist/http/HttpRequest.d.ts +4 -0
  156. package/dist/http/HttpRequest.d.ts.map +1 -1
  157. package/dist/http/ViewRouter.d.ts +127 -4
  158. package/dist/http/ViewRouter.d.ts.map +1 -1
  159. package/dist/http/index.d.ts +1 -0
  160. package/dist/http/index.d.ts.map +1 -1
  161. package/dist/http/index.js +2 -2
  162. package/dist/http/index.js.map +1 -1
  163. package/dist/http/middlewareList.d.ts +25 -0
  164. package/dist/http/middlewareList.d.ts.map +1 -0
  165. package/dist/http/requestContext.d.ts +57 -0
  166. package/dist/http/requestContext.d.ts.map +1 -1
  167. package/dist/i18n/dictionaryRuntime.js +2 -2
  168. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  169. package/dist/i18n/index.js +2 -2
  170. package/dist/i18n/index.js.map +1 -1
  171. package/dist/kernel/index.js +3 -3
  172. package/dist/kernel/index.js.map +3 -3
  173. package/dist/kernel/providers.d.ts +2 -2
  174. package/dist/kernel/providers.d.ts.map +1 -1
  175. package/dist/orm/index.js +2 -2
  176. package/dist/orm/index.js.map +1 -1
  177. package/dist/server/index.js +2 -2
  178. package/dist/server/index.js.map +1 -1
  179. package/dist/services/features/FeatureFlagStore.d.ts +60 -0
  180. package/dist/services/features/FeatureFlagStore.d.ts.map +1 -0
  181. package/dist/services/features/FeatureManager.d.ts +82 -0
  182. package/dist/services/features/FeatureManager.d.ts.map +1 -0
  183. package/dist/services/features/FeaturesServiceProvider.d.ts +6 -0
  184. package/dist/services/features/FeaturesServiceProvider.d.ts.map +1 -0
  185. package/dist/services/features/bucket.d.ts +57 -0
  186. package/dist/services/features/bucket.d.ts.map +1 -0
  187. package/dist/services/features/config.d.ts +57 -0
  188. package/dist/services/features/config.d.ts.map +1 -0
  189. package/dist/services/features/context.d.ts +31 -0
  190. package/dist/services/features/context.d.ts.map +1 -0
  191. package/dist/services/features/defineFeature.d.ts +145 -0
  192. package/dist/services/features/defineFeature.d.ts.map +1 -0
  193. package/dist/services/features/evaluate.d.ts +74 -0
  194. package/dist/services/features/evaluate.d.ts.map +1 -0
  195. package/dist/services/features/sources/DatabaseFeatureFlagSource.d.ts +19 -0
  196. package/dist/services/features/sources/DatabaseFeatureFlagSource.d.ts.map +1 -0
  197. package/dist/services/features/sources/FeatureFlagSource.d.ts +30 -0
  198. package/dist/services/features/sources/FeatureFlagSource.d.ts.map +1 -0
  199. package/dist/services/features/sources/StaticFeatureFlagSource.d.ts +24 -0
  200. package/dist/services/features/sources/StaticFeatureFlagSource.d.ts.map +1 -0
  201. package/dist/services/features/types.d.ts +63 -0
  202. package/dist/services/features/types.d.ts.map +1 -0
  203. package/dist/services/index.d.ts +12 -0
  204. package/dist/services/index.d.ts.map +1 -1
  205. package/dist/services/index.js +8 -8
  206. package/dist/services/index.js.map +6 -4
  207. package/dist/services/router/ViewRouteDispatcher.d.ts +8 -0
  208. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  209. package/dist/services/router/createFlatViewRoutes.d.ts +14 -0
  210. package/dist/services/router/createFlatViewRoutes.d.ts.map +1 -1
  211. package/dist/services/router/streamQueryInjection.d.ts.map +1 -1
  212. package/dist/support/index.js +2 -2
  213. package/dist/support/index.js.map +1 -1
  214. package/dist/testing/Page.d.ts +12 -0
  215. package/dist/testing/Page.d.ts.map +1 -1
  216. package/dist/testing/index.js +8 -4
  217. package/dist/testing/index.js.map +1 -1
  218. package/package.json +1 -1
  219. package/dist/chunk-6fc909z5.js +0 -4
  220. package/dist/chunk-9j9wqrb2.js +0 -5
  221. package/dist/chunk-qfzyym5h.js +0 -5
  222. package/dist/chunk-qfzyym5h.js.map +0 -12
  223. package/dist/chunk-r9as9htn.js +0 -5
  224. package/dist/chunk-r9h6aj7g.js +0 -19
  225. package/dist/chunks/ThemeProvider-li1J_igh.js.map +0 -1
  226. /package/dist/{chunk-swe2b6rv.js.map → chunk-01e3gk86.js.map} +0 -0
  227. /package/dist/{chunk-e9zz0zfv.js.map → chunk-k0fvsyeh.js.map} +0 -0
  228. /package/dist/{chunk-cecq6q1b.js.map → chunk-yf7vz71n.js.map} +0 -0
@@ -2,6 +2,8 @@ import type { RemoveGroupPrefix } from "../client/types";
2
2
  import type { KeyAndValue, KeyAndValueToObject } from "../internal/type-utils";
3
3
  import type { Controller } from "./Controller";
4
4
  import type { HttpRequest } from "./HttpRequest";
5
+ import type { FeatureKey } from "../client/rpc";
6
+ import { type MiddlewareInput } from "./middlewareList";
5
7
  type ControllerMethods<T extends new () => Controller> = {
6
8
  [K in keyof InstanceType<T>]: InstanceType<T>[K] extends Function ? K : never;
7
9
  }[keyof InstanceType<T>];
@@ -20,10 +22,40 @@ export declare class RedirectRoute<Input, Output, Params> {
20
22
  kind: "redirect";
21
23
  viewPath: string;
22
24
  middlewares: string[];
25
+ featureGates: string[];
23
26
  private handler;
24
27
  constructor(handler?: CallbackHandler<Input, RedirectOutput, Params> | [new () => Controller, ControllerMethods<any>]);
25
28
  run(req: HttpRequest<Input, Params>, path: string): Promise<{}>;
26
- middleware(middlewares: string[]): this;
29
+ middleware(middlewares: MiddlewareInput): this;
30
+ /**
31
+ * Hides this route behind a feature flag.
32
+ *
33
+ * When the flag is off the route behaves as though it does not exist — the
34
+ * application's own `404` view, with a 404 status — rather than returning an
35
+ * error page that confirms something is there.
36
+ *
37
+ * Returns `this`, so the route's type is unchanged and the path keeps its
38
+ * entry in `ViewPaths`: `<Link>` and `Redirect.to` stay typed. That also means
39
+ * the path is still in the route manifest the browser receives, so this gates
40
+ * the *response*, not the route's existence. Declare the feature
41
+ * `defineFeature({ serverOnly: true })` and keep unreleased routes out of the
42
+ * client tree if the name itself is the secret.
43
+ *
44
+ * ## A `rollout` is not access control
45
+ *
46
+ * Gate on `active` — a feature nobody has switched on is unreachable, which is
47
+ * the case this is for — or on a `when` that reads something the visitor
48
+ * cannot choose, like the signed-in user.
49
+ *
50
+ * A `rollout` is neither, for an anonymous visitor. The subject is their
51
+ * `session_id` cookie, which they supply; bucketing is a published pure
52
+ * function of it, so they can compute one that lands inside any percentage and
53
+ * send it. Signing the cookie would not fix this — they can equally well
54
+ * discard it and ask for a fresh one until a signed id happens to land inside,
55
+ * which for a 5% rollout is a couple of dozen requests. Nothing that hands out
56
+ * identities on demand can restrict anything to a fraction of them.
57
+ */
58
+ feature(key: FeatureKey): this;
27
59
  }
28
60
  export type FileBody = Blob | ReadableStream | ArrayBuffer | ArrayBufferView | string;
29
61
  export type FileOutput = Blob | Response | {
@@ -42,16 +74,47 @@ export declare class FileRoute<Input, Params> {
42
74
  kind: "file";
43
75
  viewPath: string;
44
76
  middlewares: string[];
77
+ featureGates: string[];
45
78
  private handler;
46
79
  constructor(handler?: CallbackHandler<Input, FileOutput, Params> | [new () => Controller, ControllerMethods<any>]);
47
80
  run(req: HttpRequest<Input, Params>, path: string): Promise<{
48
81
  FILE: FileOutput;
49
82
  }>;
50
- middleware(middlewares: string[]): this;
83
+ middleware(middlewares: MiddlewareInput): this;
84
+ /**
85
+ * Hides this route behind a feature flag.
86
+ *
87
+ * When the flag is off the route behaves as though it does not exist — the
88
+ * application's own `404` view, with a 404 status — rather than returning an
89
+ * error page that confirms something is there.
90
+ *
91
+ * Returns `this`, so the route's type is unchanged and the path keeps its
92
+ * entry in `ViewPaths`: `<Link>` and `Redirect.to` stay typed. That also means
93
+ * the path is still in the route manifest the browser receives, so this gates
94
+ * the *response*, not the route's existence. Declare the feature
95
+ * `defineFeature({ serverOnly: true })` and keep unreleased routes out of the
96
+ * client tree if the name itself is the secret.
97
+ *
98
+ * ## A `rollout` is not access control
99
+ *
100
+ * Gate on `active` — a feature nobody has switched on is unreachable, which is
101
+ * the case this is for — or on a `when` that reads something the visitor
102
+ * cannot choose, like the signed-in user.
103
+ *
104
+ * A `rollout` is neither, for an anonymous visitor. The subject is their
105
+ * `session_id` cookie, which they supply; bucketing is a published pure
106
+ * function of it, so they can compute one that lands inside any percentage and
107
+ * send it. Signing the cookie would not fix this — they can equally well
108
+ * discard it and ask for a fresh one until a signed id happens to land inside,
109
+ * which for a 5% rollout is a couple of dozen requests. Nothing that hands out
110
+ * identities on demand can restrict anything to a fraction of them.
111
+ */
112
+ feature(key: FeatureKey): this;
51
113
  }
52
114
  export declare class ViewRoute<Input, Output, Params> {
53
115
  viewPath: string;
54
116
  middlewares: string[];
117
+ featureGates: string[];
55
118
  private handler;
56
119
  constructor(viewPath: string, handler?: CallbackHandler<Input, Output, Params> | [new () => Controller, ControllerMethods<any>]);
57
120
  run(req: HttpRequest<Input, Params>, path: string): Promise<{
@@ -62,12 +125,42 @@ export declare class ViewRoute<Input, Output, Params> {
62
125
  };
63
126
  };
64
127
  }>;
65
- middleware(middlewares: string[]): this;
128
+ middleware(middlewares: MiddlewareInput): this;
129
+ /**
130
+ * Hides this route behind a feature flag.
131
+ *
132
+ * When the flag is off the route behaves as though it does not exist — the
133
+ * application's own `404` view, with a 404 status — rather than returning an
134
+ * error page that confirms something is there.
135
+ *
136
+ * Returns `this`, so the route's type is unchanged and the path keeps its
137
+ * entry in `ViewPaths`: `<Link>` and `Redirect.to` stay typed. That also means
138
+ * the path is still in the route manifest the browser receives, so this gates
139
+ * the *response*, not the route's existence. Declare the feature
140
+ * `defineFeature({ serverOnly: true })` and keep unreleased routes out of the
141
+ * client tree if the name itself is the secret.
142
+ *
143
+ * ## A `rollout` is not access control
144
+ *
145
+ * Gate on `active` — a feature nobody has switched on is unreachable, which is
146
+ * the case this is for — or on a `when` that reads something the visitor
147
+ * cannot choose, like the signed-in user.
148
+ *
149
+ * A `rollout` is neither, for an anonymous visitor. The subject is their
150
+ * `session_id` cookie, which they supply; bucketing is a published pure
151
+ * function of it, so they can compute one that lands inside any percentage and
152
+ * send it. Signing the cookie would not fix this — they can equally well
153
+ * discard it and ask for a fresh one until a signed id happens to land inside,
154
+ * which for a 5% rollout is a couple of dozen requests. Nothing that hands out
155
+ * identities on demand can restrict anything to a fraction of them.
156
+ */
157
+ feature(key: FeatureKey): this;
66
158
  }
67
159
  export declare class LayoutRoute<T extends ViewRoutes, Input, Output, Params> {
68
160
  viewPath: string;
69
161
  children: new () => ViewRouter;
70
162
  middlewares: string[];
163
+ featureGates: string[];
71
164
  /** @internal Set by `alwaysRun()`. */
72
165
  alwaysRuns: boolean;
73
166
  private handler;
@@ -90,10 +183,40 @@ export declare class LayoutRoute<T extends ViewRoutes, Input, Output, Params> {
90
183
  * on every request regardless.
91
184
  */
92
185
  alwaysRun(): this;
93
- middleware(middlewares: string[]): this;
186
+ middleware(middlewares: MiddlewareInput): this;
187
+ /**
188
+ * Hides this route behind a feature flag.
189
+ *
190
+ * When the flag is off the route behaves as though it does not exist — the
191
+ * application's own `404` view, with a 404 status — rather than returning an
192
+ * error page that confirms something is there.
193
+ *
194
+ * Returns `this`, so the route's type is unchanged and the path keeps its
195
+ * entry in `ViewPaths`: `<Link>` and `Redirect.to` stay typed. That also means
196
+ * the path is still in the route manifest the browser receives, so this gates
197
+ * the *response*, not the route's existence. Declare the feature
198
+ * `defineFeature({ serverOnly: true })` and keep unreleased routes out of the
199
+ * client tree if the name itself is the secret.
200
+ *
201
+ * ## A `rollout` is not access control
202
+ *
203
+ * Gate on `active` — a feature nobody has switched on is unreachable, which is
204
+ * the case this is for — or on a `when` that reads something the visitor
205
+ * cannot choose, like the signed-in user.
206
+ *
207
+ * A `rollout` is neither, for an anonymous visitor. The subject is their
208
+ * `session_id` cookie, which they supply; bucketing is a published pure
209
+ * function of it, so they can compute one that lands inside any percentage and
210
+ * send it. Signing the cookie would not fix this — they can equally well
211
+ * discard it and ask for a fresh one until a signed id happens to land inside,
212
+ * which for a 5% rollout is a couple of dozen requests. Nothing that hands out
213
+ * identities on demand can restrict anything to a fraction of them.
214
+ */
215
+ feature(key: FeatureKey): this;
94
216
  }
95
217
  export declare class ViewRouter {
96
218
  middlewares: string[];
219
+ featureGates: string[];
97
220
  routes: ViewRoutes;
98
221
  view<C extends new () => Controller, M extends ControllerMethods<C>>(viewPath: string, handler?: [C, M]): ParseViewControllerHandler<C, M>;
99
222
  view<Input, Output, Params>(viewPath: string, handler?: ViewHandler<Input, Output, Params>): ViewRoute<Input, Output, Params>;
@@ -1 +1 @@
1
- {"version":3,"file":"ViewRouter.d.ts","sourceRoot":"","sources":["../../http/ViewRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iB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ceController } from "./Controller";
2
2
  export { ApiRouter, type CreateRPC } from "./ApiRouter";
3
3
  export { createFileResponse, ViewRouter, type CreateViewRPC, type FileOutput, type ViewHandler, } from "./ViewRouter";
4
+ export { toMiddlewareList, type MiddlewareInput } from "./middlewareList";
4
5
  export { createStreamResponse, createUnsatisfiableResponse, type StreamOutput, type StreamDescriptor, } from "./createStreamResponse";
5
6
  export { formatContentRange, formatUnsatisfiedContentRange, parseContentRange, parseRangeHeader, resolveRange, toRangeHeaderValue, type ByteRange, type ContentRange, type ResolvedRange, } from "./range";
6
7
  export { ValidationError } from "./Router";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACL,kBAAkB,EAClB,UAAU,EACV,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,WAAW,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,oBAAoB,EACpB,2BAA2B,EAC3B,KAAK,YAAY,EACjB,KAAK,gBAAgB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,6BAA6B,EAC7B,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,kBAAkB,EAClB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO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,GACnB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,EACL,sBAAsB,EACtB,wBAAwB,EACxB,KAAK,gBAAgB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,EACR,KAAK,yBAAyB,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,EACjB,4BAA4B,EAC5B,wBAAwB,GACzB,MAAM,UAAU,CAAC"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{$d as r,Id as a,Jd as b,Ld as c,Md as d,Nd as e,Od as f,Pd as g,Qd as h,Sd as i,Td as j,Ud as k,Vd as l,Wd as m,Xd as n,Yd as o,Zd as p,_d as q,ae as s,de as t,ee as u,fe as v,ge as w,he as x,ie as y,oe as z,pe as A,qe as B,se as C,te as D,ue as E,ve as F,we as G,xe as H}from"../chunk-6fc909z5.js";import"../chunk-qfzyym5h.js";import"../chunk-f233yzxf.js";import"../chunk-btr9kyqh.js";import"../chunk-mqwrmbh4.js";import"../chunk-yhzb9qpk.js";import"../chunk-4f69ygc8.js";export{e as toRangeHeaderValue,d as resolveRange,c as parseRangeHeader,f as parseContentRange,y as middlewareConfigDefaults,w as getCookies,h as formatUnsatisfiedContentRange,g as formatContentRange,x as defineMiddlewareConfig,l as createUnsatisfiableResponse,m as createStreamResponse,t as createFileResponse,E as clientIp,u as ViewRouter,j as ValidationError,b as ResourceController,i as RequestBreakerError,D as RateLimitMiddleware,C as RateLimitExceededError,p as RangeNotSatisfiableError,G as PoliciesServiceProvider,H as Policies,v as Middleware,o as InsufficientPermissionsError,k as HttpRequest,q as FileNotFoundError,B as CorsMiddleware,a as Controller,A as CacheMiddleware,F as CSRFMiddleware,n as AuthorizationError,z as AuthenticationMiddleware,r as AuthenticationError,s as ApiRouter};
2
+ import{$d as d,Ee as A,Fe as B,Ge as C,Ie as D,Je as E,Ke as F,Le as G,Me as H,Ne as I,Xd as a,Yd as b,_d as c,ae as e,be as f,ce as g,de as h,fe as i,ge as j,he as k,ie as l,je as m,ke as n,le as o,me as p,ne as q,oe as r,pe as s,qe as t,te as u,ue as v,ve as w,we as x,xe as y,ye as z}from"../chunk-hxf1re93.js";import"../chunk-qb5mv6pj.js";import"../chunk-3g5bjvdf.js";import"../chunk-sy7jbdeb.js";import"../chunk-d125j8t0.js";import"../chunk-dgsgjg53.js";import"../chunk-jhkjz9jr.js";export{e as toRangeHeaderValue,l as toMiddlewareList,d as resolveRange,c as parseRangeHeader,f as parseContentRange,z as middlewareConfigDefaults,x as getCookies,h as formatUnsatisfiedContentRange,g as formatContentRange,y as defineMiddlewareConfig,m as createUnsatisfiableResponse,n as createStreamResponse,u as createFileResponse,F as clientIp,v as ViewRouter,j as ValidationError,b as ResourceController,i as RequestBreakerError,E as RateLimitMiddleware,D as RateLimitExceededError,q as RangeNotSatisfiableError,H as PoliciesServiceProvider,I as Policies,w as Middleware,p as InsufficientPermissionsError,k as HttpRequest,r as FileNotFoundError,C as CorsMiddleware,a as Controller,B as CacheMiddleware,G as CSRFMiddleware,o as AuthorizationError,A as AuthenticationMiddleware,s as AuthenticationError,t as ApiRouter};
3
3
 
4
- //# debugId=9062FBDA93EB4D3D64756E2164756E21
4
+ //# debugId=C628C1CDCF93D8C264756E2164756E21
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "9062FBDA93EB4D3D64756E2164756E21",
7
+ "debugId": "C628C1CDCF93D8C264756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * What a route's `.middleware()` accepts.
3
+ *
4
+ * A bare string is allowed because it is what people write — `"auth"` reads
5
+ * better than `["auth"]` for the overwhelmingly common single-middleware case,
6
+ * and the array form was accepted silently wrong for long enough that the
7
+ * starter template itself does it (`.middleware("cache:private")`).
8
+ */
9
+ export type MiddlewareInput = string | string[];
10
+ /**
11
+ * Normalizes `.middleware()`'s argument to the array the registry expects.
12
+ *
13
+ * Without this, a bare string was assigned straight to `middlewares`, and
14
+ * `transformMiddleware` iterates its input — so a string was iterated one
15
+ * **character** at a time. Each character became an alias lookup that resolved
16
+ * to nothing and was dropped by the trailing `.filter(Boolean)`, which means the
17
+ * middleware did not run and nothing anywhere said so. A route that looked
18
+ * authenticated was public.
19
+ *
20
+ * The type said `string[]`, so this was a type error at every call site — but
21
+ * only for a project whose `tsc` is clean, and the failure at runtime is silent
22
+ * either way. Accepting both shapes removes the trap rather than documenting it.
23
+ */
24
+ export declare function toMiddlewareList(input: MiddlewareInput): string[];
25
+ //# sourceMappingURL=middlewareList.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"middlewareList.d.ts","sourceRoot":"","sources":["../../http/middlewareList.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,MAAM,EAAE,CAAC;AAEhD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,EAAE,CAEjE"}
@@ -37,6 +37,30 @@ declare class Store {
37
37
  * silently returning partial bytes.
38
38
  */
39
39
  rangeRequest: ByteRange | null;
40
+ /**
41
+ * This request's `session_id`, once read or minted.
42
+ *
43
+ * The cookie itself cannot answer for it. `setCookie` appends a *serialized*
44
+ * `Set-Cookie` string to `cookies`, so a value written during this request is
45
+ * not readable back out of it, and `req.cookies` still holds only what the
46
+ * browser sent. Anything needing the id in the same request that mints it —
47
+ * feature-flag bucketing, most obviously — has to read it from here.
48
+ */
49
+ sessionId: string | null;
50
+ /**
51
+ * This request's feature-flag evaluations, computed once.
52
+ *
53
+ * One map per request is what keeps a handler and the SSR payload from
54
+ * disagreeing: a percentage rollout evaluated twice would be consistent
55
+ * anyway — the bucketing is deterministic — but an attribute hook reading a
56
+ * clock, or a `now`-based rule, would not be. Anything the page renders and
57
+ * anything the server branched on have to be the same answer.
58
+ */
59
+ featureEvaluations: Map<string, unknown> | null;
60
+ /** The context those evaluations were made against, built at most once. */
61
+ featureContext: unknown;
62
+ /** Bucket memo, shared across every flag evaluated for this request. */
63
+ featureBuckets: Map<string, number> | null;
40
64
  constructor(req: HttpRequest);
41
65
  setLocale(locale: string): void;
42
66
  renderMeta(): {
@@ -52,6 +76,39 @@ declare class Store {
52
76
  setRequest(req: HttpRequest<any, any>): void;
53
77
  destroy(): void;
54
78
  }
79
+ export declare const SESSION_ID_COOKIE = "session_id";
80
+ /**
81
+ * The `session_id` the browser sent, or the one minted earlier in this request.
82
+ * Never mints one, so it is safe on an api request, where a `Set-Cookie` nobody
83
+ * asked for would be a surprise.
84
+ *
85
+ * `null` outside a request, and for an anonymous visitor whose first request is
86
+ * not a view — both meaning "no stable subject", which callers must handle
87
+ * rather than paper over with a random value. A per-call random id would give
88
+ * every request its own bucket, which is worse than no bucketing at all: a
89
+ * percentage rollout would reshuffle on every page load.
90
+ *
91
+ * ## It is client-supplied, and unauthenticated
92
+ *
93
+ * Whatever the browser sent, unvalidated. It is a bucketing subject, not a
94
+ * credential — never authenticate or authorize on it. A visitor can pick a value
95
+ * that lands them in any percentage rollout, and signing it would not change
96
+ * that: they can discard the cookie and collect fresh ones until one does. Load
97
+ * bearing enough to state, because `.feature()` route gating is built on top of
98
+ * evaluation — see its documentation for what may safely gate a route.
99
+ */
100
+ export declare function sessionId(): string | null;
101
+ /**
102
+ * The same, but mints and sets the cookie when the browser sent none.
103
+ *
104
+ * Call this once per **view** request, early enough that everything downstream —
105
+ * flag evaluation included — sees the same id the browser is about to be given.
106
+ * It used to live inline in `ViewRouteDispatcher.onRequestEnd`, which ran only
107
+ * on the document path and only after the response was decided, so a client-side
108
+ * navigation minted nothing and a first-ever visitor had no id at the point
109
+ * flags were evaluated.
110
+ */
111
+ export declare function ensureSessionId(): string | null;
55
112
  export declare class RequestContext {
56
113
  static getStore(): Store;
57
114
  static setRequest(req: HttpRequest<any, any>): void;
@@ -1 +1 @@
1
- {"version":3,"file":"requestContext.d.ts","sourceRoot":"","sources":["../../http/requestContext.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAGzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,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la as d,na as l}from"../chunk-5ad8era8.js";import{Ad as i,Cd as t,Dd as r,Ed as o,Fd as n,Gd as a,Hd as s,zd as e}from"../chunk-n2zmg475.js";import"../chunk-4f69ygc8.js";export{o as setActiveLocale,r as seedDictionaries,t as preloadDictionaries,d as localeStrings,i as loadDictionary,n as getActiveLocale,e as dictionaryRegistrationMark,c as dictionaryLocales,l as dictionaryId,y as defineDictionary,s as createDictionarySink,a as __resetDictionaryRegistry,p as __gemi_dict__};
2
+ import{aa as y,ba as p}from"../chunk-xzk827r3.js";import{ka as c,la as d,na as l}from"../chunk-5ad8era8.js";import{Od as e,Pd as i,Rd as t,Sd as r,Td as o,Ud as n,Vd as a,Wd as s}from"../chunk-7j6wbv12.js";import"../chunk-jhkjz9jr.js";export{o as setActiveLocale,r as seedDictionaries,t as preloadDictionaries,d as localeStrings,i as loadDictionary,n as getActiveLocale,e as dictionaryRegistrationMark,c as dictionaryLocales,l as dictionaryId,y as defineDictionary,s as createDictionarySink,a as __resetDictionaryRegistry,p as __gemi_dict__};
3
3
 
4
- //# debugId=5982853CCB8B14A164756E2164756E21
4
+ //# debugId=26339FF3A7438E2764756E2164756E21
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "5982853CCB8B14A164756E2164756E21",
7
+ "debugId": "26339FF3A7438E2764756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{aa as R}from"../chunk-ae6xz52s.js";import"../chunk-5ad8era8.js";import{Qa as L}from"../chunk-r9as9htn.js";import{Qb as E,Rb as V}from"../chunk-jzatvtjd.js";import"../chunk-17m5wxv0.js";import{Xb as j}from"../chunk-r9h6aj7g.js";import"../chunk-g5pj95dz.js";import"../chunk-8v81dvje.js";import"../chunk-n2zmg475.js";import"../chunk-6fc909z5.js";import"../chunk-qfzyym5h.js";import"../chunk-f233yzxf.js";import"../chunk-btr9kyqh.js";import{ef as X}from"../chunk-1esnvq2z.js";import"../chunk-mqwrmbh4.js";import"../chunk-yhzb9qpk.js";import"../chunk-4f69ygc8.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{V as translationConfigDefaults,N as translate,E as defineTranslationConfig,R as defineDictionary,X as Translator,L as TranslationServiceProvider,P as Dictionary};
2
+ import{aa as R}from"../chunk-xzk827r3.js";import"../chunk-5ad8era8.js";import{Qa as L}from"../chunk-b35e128b.js";import{Wb as E,Xb as V}from"../chunk-437085pe.js";import"../chunk-4yt5x8s2.js";import{bc as j}from"../chunk-hwa5sqw5.js";import"../chunk-86jebsm4.js";import"../chunk-y6a8r2bn.js";import"../chunk-7j6wbv12.js";import"../chunk-hxf1re93.js";import"../chunk-qb5mv6pj.js";import"../chunk-3g5bjvdf.js";import"../chunk-sy7jbdeb.js";import{wf as X}from"../chunk-cyaz97p5.js";import"../chunk-d125j8t0.js";import"../chunk-dgsgjg53.js";import"../chunk-jhkjz9jr.js";import{createElement as J,Fragment as M,isValidElement as U}from"react";function $(q,B){let G=Object.values(B).some((z)=>typeof z==="function"&&U(z(""))),Q=/{{([^{}]+?)(?::([^{}\[\]]+?))?(?:\[(.*?)\])?}}/g;if(!G)return q.replace(Q,(W,O,_,Z)=>{let C=O.includes(":")?O.split(":")[0]:O,H=B[C];if(H===void 0)return W;if(typeof H==="function"){let K=H(Z!==void 0?Z:"");if(U(K))throw Error("JSX returned in string context");return String(K)}if(_)switch(_.toLowerCase()){case"number":return Number(H).toString();case"string":return String(H);case"boolean":return Boolean(H).toString();default:return String(H)}return String(H)});else{let z=[],W=0,O=null;while((O=Q.exec(q))!==null){let[_,Z,C,H]=O,F=O.index,K=Z.includes(":")?Z.split(":")[0]:Z;if(F>W)z.push(q.substring(W,F));let Y=B[K];if(Y===void 0)z.push(_);else if(typeof Y==="function"){let A=Y(H!==void 0?H:"");z.push(A)}else if(C)switch(C.toLowerCase()){case"number":z.push(Number(Y).toString());break;case"string":z.push(String(Y));break;case"boolean":z.push(Boolean(Y).toString());break;default:z.push(String(Y))}else z.push(String(Y));W=F+_.length}if(W<q.length)z.push(q.substring(W));return J(M,{},...z)}}class P{name;dictionary;constructor(q,B){this.name=q;this.dictionary=B}reference(q){if(typeof window<"u")throw Error("Cannot use reference in the browser");if(!this.dictionary?.[q])throw Error(`Translation not found for ${String(q)}`);return this.dictionary[q]}render(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B[0]};if(typeof window<"u")throw Error("Cannot use render in the browser");if(!this.dictionary?.[q]?.[G])throw Error(`Translation not found for ${String(q)} in ${String(G)}`);return $(this.dictionary[q][G],Q??{})}static create(q,B){return new P(q,B)}static text(q,...B){let{locale:G=j.locale(),params:Q}={params:{},...B?.[0]};if(!q?.[G])throw Error(`Translation not found for ${String(G)}`);return $(q[G],Q??{})}}async function N(q,B,...G){let{locale:Q=j.locale(),params:z}={params:{},...G[0]},O=(await q.load(String(Q)))[B];if(typeof O!=="string")throw Error(`Translation not found for "${B}" in "${String(Q)}" (dictionary ${q.id})`);return $(O,z??{})}export{V as translationConfigDefaults,N as translate,E as defineTranslationConfig,R as defineDictionary,X as Translator,L as TranslationServiceProvider,P as Dictionary};
3
3
 
4
- //# debugId=AF96F4BAE835C30264756E2164756E21
4
+ //# debugId=162E452EFA9ACE8564756E2164756E21
@@ -7,6 +7,6 @@
7
7
  "import { Lang } from \"../facades\";\nimport { parseTranslation } from \"../utils/parseTranslation\";\nimport type { ParseTranslationParamsServer, Prettify } from \"../utils/type\";\nimport type { DictionaryHandle } from \"./defineDictionary\";\nimport type { DictionaryTranslations } from \"./dictionaryShape\";\n\n/**\n * Read one string from a `defineDictionary` dictionary outside React — a\n * controller, a job, an email template.\n *\n * Async because a bundled dictionary loads its locale on demand. Server code\n * does not go through the bundler, so in practice this resolves without ever\n * yielding; the `await` is what makes the same call work either way.\n *\n * Kept out of `defineDictionary.ts` on purpose: that module is imported by\n * components and has to stay free of the server facades this one needs.\n */\nexport async function translate<\n T extends DictionaryTranslations,\n K extends keyof T & string,\n U extends keyof T[K],\n R = Prettify<ParseTranslationParamsServer<T[K][U] & string>>,\n>(\n dictionary: DictionaryHandle<T>,\n key: K,\n ...args: R extends Record<string, never>\n ? [args?: { locale?: U | (string & {}) }]\n : [args: { locale?: U | (string & {}); params: R }]\n): Promise<string> {\n const { locale = Lang.locale(), params } = { params: {}, ...args[0] };\n const strings = await dictionary.load(String(locale));\n const template = strings[key];\n\n if (typeof template !== \"string\") {\n throw new Error(\n `Translation not found for \"${key}\" in \"${String(locale)}\" (dictionary ${dictionary.id})`,\n );\n }\n\n return parseTranslation(template, (params ?? {}) as any) as string;\n}\n"
8
8
  ],
9
9
  "mappings": ";soBAAA,mBAAS,SAAe,eAAU,SAO3B,IAAS,JAAgB,JAAC,HAAkB,HAAwB,JAEzE,DAAM,HAAS,EAAO,EAAO,JAAM,HAAE,KACnC,CAAC,IACC,OAAO,IAAU,YACjB,EAAgB,EAAkC,EAAE,CAAC,CACzD,EAMM,EAAQ,kDAEd,GAAI,CAAC,EAqCH,OAnCe,EAAS,QAAQ,EAAO,CAAC,EAAO,EAAM,EAAM,IAAY,CAErE,IAAM,EAAY,EAAK,SAAS,GAAG,EAAI,EAAK,MAAM,GAAG,EAAE,GAAK,EAEtD,EAAQ,EAAO,GACrB,GAAI,IAAU,OACZ,OAAO,EAGT,GAAI,OAAO,IAAU,WAAY,CAG/B,IAAM,EAAiB,EADD,IAAY,OAAY,EAAU,EACd,EAE1C,GAAI,EAAe,CAAc,EAC/B,MAAU,MAAM,gCAAgC,EAElD,OAAO,OAAO,CAAc,EAI9B,GAAI,EACF,OAAQ,EAAK,YAAY,OAClB,SACH,OAAO,OAAO,CAAK,EAAE,SAAS,MAC3B,SACH,OAAO,OAAO,CAAK,MAChB,UACH,OAAO,QAAQ,CAAK,EAAE,SAAS,UAE/B,OAAO,OAAO,CAAK,EAGzB,OAAO,OAAO,CAAK,EACpB,EAEI,KAEL,IAAM,EAAqC,CAAC,EACxC,EAAY,EACZ,EAAgC,KAEpC,OAAQ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CAAC,KAAK,aAAa,KAAO,GAC5B,MAAU,MACR,6BAA6B,OAAO,CAAG,QAAQ,OAAO,CAAM,GAC9D,EAEF,OAAO,EAAiB,KAAK,WAAW,GAAK,GAAS,GAAU,CAAC,CAAC,QAU7D,OAAoC,CAAC,EAAc,EAAiB,CACzE,OAAO,IAAI,EAAc,EAAM,CAAY,QAGtC,KAA+D,CACpE,KACG,EAWK,CACR,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CAAE,OAAQ,CAAC,KAAM,IAAO,EAAG,EAEtE,GAAI,CAAC,IAAU,GACb,MAAU,MAAM,6BAA6B,OAAO,CAAM,GAAG,EAG/D,OAAO,EAAiB,EAAQ,GAAS,GAAU,CAAC,CAAC,EAEzD,CC7EA,eAAsB,CAKrB,CACC,EACA,KACG,EAGc,CACjB,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CAAE,OAAQ,CAAC,KAAM,EAAK,EAAG,EAE9D,GADU,MAAM,EAAW,KAAK,OAAO,CAAM,CAAC,GAC3B,GAEzB,GAAI,OAAO,IAAa,SACtB,MAAU,MACR,8BAA8B,UAAY,OAAO,CAAM,kBAAkB,EAAW,KACtF,EAGF,OAAO,EAAiB,EAAW,GAAU,CAAC,CAAS",
10
- "debugId": "AF96F4BAE835C30264756E2164756E21",
10
+ "debugId": "162E452EFA9ACE8564756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{sa as Y}from"../chunk-11dkjm1r.js";import{Pa as k}from"../chunk-a70s8pz4.js";import{Qa as Z}from"../chunk-r9as9htn.js";import{$a as V,Ta as J,Ua as X,Va as _,Wa as $,Ya as E,Za as F,_a as T,cb as y,db as K,gb as L,hb as Q,ob as U,rb as B,sb as D}from"../chunk-9j9wqrb2.js";import{vb as M}from"../chunk-tzsnadg1.js";import"../chunk-vdzb29p5.js";import"../chunk-jzatvtjd.js";import"../chunk-17m5wxv0.js";import{Ub as b,qc as f,rc as m}from"../chunk-r9h6aj7g.js";import"../chunk-g5pj95dz.js";import"../chunk-8v81dvje.js";import"../chunk-n2zmg475.js";import{me as A}from"../chunk-6fc909z5.js";import{Ce as I}from"../chunk-qfzyym5h.js";import"../chunk-f233yzxf.js";import"../chunk-btr9kyqh.js";import"../chunk-jny4f23c.js";import"../chunk-1esnvq2z.js";import{ff as H,hf as x}from"../chunk-mqwrmbh4.js";import"../chunk-yhzb9qpk.js";import"../chunk-4f69ygc8.js";var G=[V,K,Y,D,X,$,y,F,Q,E,B,L,T,Z,U,_];class R{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new x;boot(){if(this.models.length>0)k(...this.models);else w();this.app.config.merge(this.config),x.setInstance(this.app),this.app.registerMany([...G,...this.providers]),this.registerServices()}registerServices(){let q=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let N=new Map;for(let z of this.services){let C=typeof z==="function"?new z:z,j=C.constructor;if(!j.token)throw Error(`Service [${j.name}] is listed in \`services\` but does not declare a \`static token\`.`);let O=N.get(j.token);if(O)throw Error(`Services [${O}] and [${j.name}] both declare the token "${j.token}". Tokens are the container's keys, so they must be unique.`);N.set(j.token,j.name);let W=j;if(!q.has(j.token)&&this.app.bound(W))throw Error(`Service [${j.name}] declares the token "${j.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(W,C),this.serviceInstances.push(C),this.serviceTokens.add(j.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices()}async bootServices(){if(this.servicesBooted)return;for(let q of this.serviceInstances)await q.boot();this.servicesBooted=!0}run(q){return H.run(this.app,q)}resolve(q){return this.app.make(q)}apiRoutes(){return this.app.make(m)}viewRoutes(){return this.app.make(f)}broadcast(){return this.app.make(b)}queue(){return this.app.make(M)}destroy(){if(this.app.resolved(J))this.app.make(J).stop();if(this.app.flush(),x.getInstance()===this.app)x.setInstance(void 0);H.disable()}}function w(){if(Bun.env.NODE_ENV==="production")return;let q=I();if(q.length===0)return;console.warn(`[gemi] ${q.length} model${q.length===1?" is":"s are"} registered, but Kernel.models is empty.
2
+ import{sa as Y}from"../chunk-xdv1b8mr.js";import{Pa as M}from"../chunk-m3xy5xyf.js";import{Qa as Z}from"../chunk-b35e128b.js";import{$a as $,Ta as J,Ua as X,Va as _,ab as E,cb as T,db as V,eb as y,fb as F,ib as K,jb as L,mb as Q,nb as U,ub as B,xb as D,yb as I}from"../chunk-87qab82w.js";import{Bb as R}from"../chunk-pmhd6zfc.js";import"../chunk-fjm4y8bn.js";import"../chunk-437085pe.js";import"../chunk-4yt5x8s2.js";import{Ec as m,Fc as k,_b as f}from"../chunk-hwa5sqw5.js";import"../chunk-86jebsm4.js";import"../chunk-y6a8r2bn.js";import"../chunk-7j6wbv12.js";import{Ce as h}from"../chunk-hxf1re93.js";import{Ue as b}from"../chunk-qb5mv6pj.js";import"../chunk-3g5bjvdf.js";import"../chunk-sy7jbdeb.js";import"../chunk-w62m5f0n.js";import"../chunk-cyaz97p5.js";import{xf as H,zf as x}from"../chunk-d125j8t0.js";import"../chunk-dgsgjg53.js";import"../chunk-jhkjz9jr.js";var G=[F,L,Y,$,I,X,E,K,V,U,T,D,Q,y,Z,B,_];class w{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new x;boot(){if(this.models.length>0)M(...this.models);else A();this.app.config.merge(this.config),x.setInstance(this.app),this.app.registerMany([...G,...this.providers]),this.registerServices()}registerServices(){let q=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let N=new Map;for(let z of this.services){let C=typeof z==="function"?new z:z,j=C.constructor;if(!j.token)throw Error(`Service [${j.name}] is listed in \`services\` but does not declare a \`static token\`.`);let O=N.get(j.token);if(O)throw Error(`Services [${O}] and [${j.name}] both declare the token "${j.token}". Tokens are the container's keys, so they must be unique.`);N.set(j.token,j.name);let W=j;if(!q.has(j.token)&&this.app.bound(W))throw Error(`Service [${j.name}] declares the token "${j.token}", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`);this.app.instance(W,C),this.serviceInstances.push(C),this.serviceTokens.add(j.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices()}async bootServices(){if(this.servicesBooted)return;for(let q of this.serviceInstances)await q.boot();this.servicesBooted=!0}run(q){return H.run(this.app,q)}resolve(q){return this.app.make(q)}apiRoutes(){return this.app.make(k)}viewRoutes(){return this.app.make(m)}broadcast(){return this.app.make(f)}queue(){return this.app.make(R)}destroy(){if(this.app.resolved(J))this.app.make(J).stop();if(this.app.flush(),x.getInstance()===this.app)x.setInstance(void 0);H.disable()}}function A(){if(Bun.env.NODE_ENV==="production")return;let q=b();if(q.length===0)return;console.warn(`[gemi] ${q.length} model${q.length===1?" is":"s are"} registered, but Kernel.models is empty.
3
3
  Nested relation reads resolve a model by name, so a policy on a subclass that does not own its
4
4
  `+" name is skipped inside every include \u2014 scoped at the root, "+`unscoped in an include, with nothing
5
5
  to notice it. Declaring the modules registers each class under its own name and audits the set:
@@ -11,6 +11,6 @@ import{sa as Y}from"../chunk-11dkjm1r.js";import{Pa as k}from"../chunk-a70s8pz4.
11
11
  models = [generated, models]
12
12
  }
13
13
 
14
- See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{G as frameworkProviders,A as UserProvider,R as Kernel};
14
+ See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{G as frameworkProviders,h as UserProvider,w as Kernel};
15
15
 
16
- //# debugId=4B4EC27902448D1664756E2164756E21
16
+ //# debugId=45648151B30677FB64756E2164756E21
@@ -2,10 +2,10 @@
2
2
  "version": 3,
3
3
  "sources": ["../kernel/providers.ts", "../kernel/Kernel.ts"],
4
4
  "sourcesContent": [
5
- "import type { ServiceProviderConstructor } from \"../foundation/Application\";\nimport { AuthServiceProvider } from \"../auth/AuthServiceProvider\";\nimport { DatabaseServiceProvider } from \"../database/DatabaseServiceProvider\";\nimport { TranslationServiceProvider } from \"../i18n/TranslationServiceProvider\";\nimport { ScheduleServiceProvider } from \"../services/cron/ScheduleServiceProvider\";\nimport { MailServiceProvider } from \"../services/email/MailServiceProvider\";\nimport { EventServiceProvider } from \"../services/events/EventServiceProvider\";\nimport { FilesystemServiceProvider } from \"../services/file-storage/FilesystemServiceProvider\";\nimport { ImageServiceProvider } from \"../services/image-optimization/ImageServiceProvider\";\nimport { KernelIdServiceProvider } from \"../services/kernel-id/KernelIdServiceProvider\";\nimport { LogServiceProvider } from \"../services/logging/LogServiceProvider\";\nimport { MiddlewareServiceProvider } from \"../services/middleware/MiddlewareServiceProvider\";\nimport { BroadcastServiceProvider } from \"../services/pubsub/BroadcastServiceProvider\";\nimport { QueueServiceProvider } from \"../services/queue/QueueServiceProvider\";\nimport { RateLimiterServiceProvider } from \"../services/rate-limiter/RateLimiterServiceProvider\";\nimport { RedisServiceProvider } from \"../services/redis/RedisServiceProvider\";\nimport { RouteServiceProvider } from \"../services/router/RouteServiceProvider\";\n\n/**\n * The providers every gemi app boots with, in registration order. Sixteen\n * providers for seventeen services — `RouteServiceProvider` owns both the api\n * and the view dispatcher, the way Laravel's does.\n *\n * Order only matters for `boot()`; `register()` binds factories and resolves\n * nothing, so no provider here depends on an earlier one having run — with one\n * exception, which is the reason to read this before reordering anything.\n *\n * **`EventServiceProvider` must stay after `QueueServiceProvider`.** A queued\n * listener is registered with the queue as a synthetic job, and\n * `EventServiceProvider.boot()` is what hands those over. `QueueManager.useJobs`\n * — which `QueueServiceProvider.boot()` calls with whatever it discovered under\n * `app/jobs` — *replaces* the registry (`this.jobs = {}`). Move the events\n * provider up and the two boots run in the order that discards: every\n * `listener:*` entry is registered and then thrown away. Nothing errors, boot\n * succeeds, and each queued dispatch afterwards lands on `next()`'s \"Dropped a\n * queued job: nothing is registered under the name listener:SendWelcomeEmail\",\n * long after `dispatch` returned to a caller that cannot hear it.\n */\nexport const frameworkProviders: ServiceProviderConstructor[] = [\n KernelIdServiceProvider,\n MiddlewareServiceProvider,\n DatabaseServiceProvider,\n RouteServiceProvider,\n AuthServiceProvider,\n MailServiceProvider,\n LogServiceProvider,\n FilesystemServiceProvider,\n QueueServiceProvider,\n EventServiceProvider,\n RedisServiceProvider,\n BroadcastServiceProvider,\n ImageServiceProvider,\n TranslationServiceProvider,\n RateLimiterServiceProvider,\n ScheduleServiceProvider,\n];\n",
5
+ "import type { ServiceProviderConstructor } from \"../foundation/Application\";\nimport { AuthServiceProvider } from \"../auth/AuthServiceProvider\";\nimport { DatabaseServiceProvider } from \"../database/DatabaseServiceProvider\";\nimport { TranslationServiceProvider } from \"../i18n/TranslationServiceProvider\";\nimport { ScheduleServiceProvider } from \"../services/cron/ScheduleServiceProvider\";\nimport { FeaturesServiceProvider } from \"../services/features/FeaturesServiceProvider\";\nimport { MailServiceProvider } from \"../services/email/MailServiceProvider\";\nimport { EventServiceProvider } from \"../services/events/EventServiceProvider\";\nimport { FilesystemServiceProvider } from \"../services/file-storage/FilesystemServiceProvider\";\nimport { ImageServiceProvider } from \"../services/image-optimization/ImageServiceProvider\";\nimport { KernelIdServiceProvider } from \"../services/kernel-id/KernelIdServiceProvider\";\nimport { LogServiceProvider } from \"../services/logging/LogServiceProvider\";\nimport { MiddlewareServiceProvider } from \"../services/middleware/MiddlewareServiceProvider\";\nimport { BroadcastServiceProvider } from \"../services/pubsub/BroadcastServiceProvider\";\nimport { QueueServiceProvider } from \"../services/queue/QueueServiceProvider\";\nimport { RateLimiterServiceProvider } from \"../services/rate-limiter/RateLimiterServiceProvider\";\nimport { RedisServiceProvider } from \"../services/redis/RedisServiceProvider\";\nimport { RouteServiceProvider } from \"../services/router/RouteServiceProvider\";\n\n/**\n * The providers every gemi app boots with, in registration order. Seventeen\n * providers for eighteen services — `RouteServiceProvider` owns both the api\n * and the view dispatcher, the way Laravel's does.\n *\n * Order only matters for `boot()`; `register()` binds factories and resolves\n * nothing, so no provider here depends on an earlier one having run — with one\n * exception, which is the reason to read this before reordering anything.\n *\n * **`EventServiceProvider` must stay after `QueueServiceProvider`.** A queued\n * listener is registered with the queue as a synthetic job, and\n * `EventServiceProvider.boot()` is what hands those over. `QueueManager.useJobs`\n * — which `QueueServiceProvider.boot()` calls with whatever it discovered under\n * `app/jobs` — *replaces* the registry (`this.jobs = {}`). Move the events\n * provider up and the two boots run in the order that discards: every\n * `listener:*` entry is registered and then thrown away. Nothing errors, boot\n * succeeds, and each queued dispatch afterwards lands on `next()`'s \"Dropped a\n * queued job: nothing is registered under the name listener:SendWelcomeEmail\",\n * long after `dispatch` returned to a caller that cannot hear it.\n */\nexport const frameworkProviders: ServiceProviderConstructor[] = [\n KernelIdServiceProvider,\n MiddlewareServiceProvider,\n DatabaseServiceProvider,\n // After the database, whose `boot()` its cache warm-up depends on, and before\n // the route dispatchers, which evaluate flags on every view request.\n FeaturesServiceProvider,\n RouteServiceProvider,\n AuthServiceProvider,\n MailServiceProvider,\n LogServiceProvider,\n FilesystemServiceProvider,\n QueueServiceProvider,\n EventServiceProvider,\n RedisServiceProvider,\n BroadcastServiceProvider,\n ImageServiceProvider,\n TranslationServiceProvider,\n RateLimiterServiceProvider,\n ScheduleServiceProvider,\n];\n",
6
6
  "import { Application } from \"../foundation/Application\";\nimport type { ServiceProviderConstructor } from \"../foundation/Application\";\nimport type { ServiceToken } from \"../container/Container\";\nimport type { ConfigItems } from \"../support/Repository\";\nimport type { Service, ServiceConstructor } from \"../support/Service\";\nimport { registerModels } from \"../orm/registration\";\nimport { registeredNames } from \"../orm/registry\";\nimport { Scheduler } from \"../services/cron/Scheduler\";\nimport { BroadcastManager } from \"../services/pubsub/BroadcastManager\";\nimport { QueueManager } from \"../services/queue/QueueManager\";\nimport { ApiRouteDispatcher } from \"../services/router/ApiRouteDispatcher\";\nimport { ViewRouteDispatcher } from \"../services/router/ViewRouteDispatcher\";\nimport { kernelContext } from \"./context\";\nimport { frameworkProviders } from \"./providers\";\n\n/**\n * The app's entry point into the framework. A Kernel subclass declares what the\n * app adds — its `config` slices and any extra `providers` — and everything\n * else lives in the Application container it owns.\n */\nexport class Kernel {\n /**\n * App-level config, merged over the framework defaults. Each key is a config\n * slice: `{ mail: { ... }, route: { ... } }`, normally the modules under\n * `app/config`.\n */\n protected config: ConfigItems = {};\n\n /**\n * App-level providers, registered after the framework's own so they can\n * rebind anything the framework bound.\n */\n protected providers: ServiceProviderConstructor[] = [];\n\n /**\n * The app's own singleton services. Each is constructed during the\n * synchronous boot phase and its `boot()` awaited during the asynchronous\n * one, in the order listed — so a service whose `boot()` depends on another\n * goes after it.\n *\n * An entry is either the class itself or a configured instance from\n * `Service.with({ ... })`. Listing is explicit rather than discovered because\n * the order is load-bearing here, and because a service is always imported by\n * whatever injects it — there is no file the import graph would miss.\n */\n protected services: Array<ServiceConstructor | Service> = [];\n\n private serviceInstances: Service[] = [];\n private serviceTokens = new Set<string>();\n private servicesBooted = false;\n\n /**\n * The modules holding the app's model classes — normally\n * `[generated, models]`, the generated namespace and the barrel of subclasses\n * written over it. Every model class they export is registered under the name\n * its schema carries, later modules winning, and the whole set is audited\n * before anything else boots.\n *\n * ### Why this is a Kernel field and not a line in a file somewhere\n *\n * Registration used to be `register(\"User\", User)` next to each subclass, and\n * the failure mode of forgetting it is an authorization hole that nothing\n * reports: a relation read resolves its target by name, so an unregistered\n * policied subclass leaves the generated base owning the name and every\n * nested `include` of that model comes back unscoped. No error at the root\n * either, because `$exec`'s divergence guard begins `registered !== this` and\n * the base it is running on *is* the registered one. A model only ever read\n * through an include — a membership, a pivot, the kind that carries a tenant\n * scope — never trips anything.\n *\n * Listing the modules here says it once, in the same place the app already\n * declares its config slices and providers, and turns the mistake into a\n * failure to boot rather than a quiet cross-tenant read.\n *\n * It sees the modules it is given, so a model class in a file that no barrel\n * re-exports is still invisible. That is the residual, and it is a smaller\n * one: a barrel is a place to notice an omission, and thirteen `register`\n * lines scattered across thirteen files is not.\n */\n protected models: Array<Record<string, unknown>> = [];\n\n readonly app = new Application();\n\n /**\n * Phase one, synchronous: every provider is constructed and its `register()`\n * runs. Only bindings are recorded here — no service is instantiated, so this\n * is safe to call from a synchronous constructor (`new App({ kernel })`).\n * Phase two is `waitForBoot()`.\n */\n boot() {\n // Before the container, deliberately. This throws on a model whose policies\n // would be skipped, and the useful moment for that is the one where nothing\n // has been constructed and no request can be in flight.\n if (this.models.length > 0) registerModels(...this.models);\n else warnIfModelsAreRegisteredButUndeclared();\n\n this.app.config.merge(this.config);\n Application.setInstance(this.app);\n this.app.registerMany([...frameworkProviders, ...this.providers]);\n this.registerServices();\n }\n\n /**\n * Constructs every listed service and binds it into the container. Runs after\n * the providers have registered, so a provider's `boot()` can `inject()` one;\n * a `Service` constructor does no I/O, so doing this synchronously costs\n * nothing beyond the field initializers.\n */\n private registerServices() {\n // What a previous pass bound, so re-running this on the same kernel is not\n // mistaken for a collision with something else.\n const ours = this.serviceTokens;\n\n this.serviceInstances = [];\n this.serviceTokens = new Set();\n this.servicesBooted = false;\n\n const owners = new Map<string, string>();\n\n for (const declaration of this.services) {\n const instance =\n typeof declaration === \"function\" ? new declaration() : declaration;\n const ctor = instance.constructor as ServiceConstructor;\n\n if (!ctor.token) {\n throw new Error(\n `Service [${ctor.name}] is listed in \\`services\\` but does not declare a \\`static token\\`.`,\n );\n }\n\n // Two services under one token is the failure this refuses to have\n // silently: the second would replace the first in the container, and\n // every `inject()` written against either would hand back whichever was\n // listed last.\n const owner = owners.get(ctor.token);\n if (owner) {\n throw new Error(\n `Services [${owner}] and [${ctor.name}] both declare the token \"${ctor.token}\". Tokens are the container's keys, so they must be unique.`,\n );\n }\n owners.set(ctor.token, ctor.name);\n\n // The same failure one level out. `Container.instance()` writes into\n // `instances`, which `make()` consults before `bindings`, so a token that\n // is already spoken for is not shared with its owner — it replaces it, for\n // every `app()` and `inject()` in the process. An app service that named\n // itself \"mail\" would leave `Mail.send()` resolving to an object with no\n // `send`, and the boot that caused it would report nothing. Providers have\n // all registered by now, so anything bound here belongs to somebody else.\n const token = ctor as unknown as ServiceToken<Service>;\n if (!ours.has(ctor.token) && this.app.bound(token)) {\n throw new Error(\n `Service [${ctor.name}] declares the token \"${ctor.token}\", which is already bound in the container by the framework or a provider. Binding it would replace that service everywhere, so pick a token nothing else owns.`,\n );\n }\n\n this.app.instance(token, instance);\n this.serviceInstances.push(instance);\n this.serviceTokens.add(ctor.token);\n }\n }\n\n /**\n * Phase two, asynchronous: every provider's `boot()` runs, in registration\n * order, after all of them have registered. Idempotent.\n */\n async waitForBoot() {\n await this.app.boot();\n await this.bootServices();\n }\n\n /**\n * Phase two for services, after every provider's `boot()` — so a service may\n * use the facades and anything else a provider owns. Idempotent, like the\n * provider phase it follows.\n */\n private async bootServices() {\n if (this.servicesBooted) {\n return;\n }\n for (const service of this.serviceInstances) {\n await service.boot();\n }\n this.servicesBooted = true;\n }\n\n run<T>(cb: () => T) {\n return kernelContext.run(this.app, cb);\n }\n\n /**\n * Resolve a service by token. Callers outside this module should prefer the\n * named accessors below or `app()`; this exists for tooling that holds a\n * Kernel but no ambient context.\n */\n resolve<T>(token: ServiceToken<T>): T {\n return this.app.make(token);\n }\n\n // Named accessors. `app/App.ts` goes through these rather than importing the\n // service classes itself — see the note in that file about the two copies of\n // gemi that coexist at build time.\n apiRoutes(): ApiRouteDispatcher {\n return this.app.make(ApiRouteDispatcher);\n }\n\n viewRoutes(): ViewRouteDispatcher {\n return this.app.make(ViewRouteDispatcher);\n }\n\n broadcast(): BroadcastManager {\n return this.app.make(BroadcastManager);\n }\n\n queue(): QueueManager {\n return this.app.make(QueueManager);\n }\n\n destroy() {\n // Only touch services that were actually resolved — resolving one here\n // would construct it purely to tear it down.\n if (this.app.resolved(Scheduler)) {\n this.app.make(Scheduler).stop();\n }\n\n this.app.flush();\n\n if (Application.getInstance() === this.app) {\n Application.setInstance(undefined);\n }\n\n kernelContext.disable();\n }\n}\n\n/**\n * Says something to an application that has models and has not declared them.\n *\n * Without this the fix for #316 defaults to off. `models` is `[]`, `boot()`\n * no-ops, and an app upgrading from 0.48 is in exactly the state the issue\n * describes until somebody edits their Kernel by hand — while the only place\n * that says to is the **Setup** section of `docs/orm.md`, which an existing app\n * read once and will not read again. #316 was filed by an app mid-migration\n * with a 79-model schema, which is precisely the reader who never sees it.\n *\n * The condition is what makes this worth printing. A populated registry with an\n * empty `models` means the generated `index.ts` was imported and its bases are\n * what every nested read resolves to — so if any policy lives on a subclass, it\n * is being skipped inside includes right now. A Kernel with no ORM at all has\n * an empty registry and hears nothing.\n *\n * Development only, and a warning rather than a throw: an app in this state is\n * running today, and turning a working deploy into a failure to start over an\n * arrangement that *might* be fine is not a patch-level thing to do. The\n * failure it points at is silent, so the fix for it has to be noisy somewhere,\n * and the terminal an author is already looking at is the cheapest somewhere\n * there is.\n */\nfunction warnIfModelsAreRegisteredButUndeclared(): void {\n if (process.env.NODE_ENV === \"production\") return;\n\n const registered = registeredNames();\n if (registered.length === 0) return;\n\n console.warn(\n `[gemi] ${registered.length} model${registered.length === 1 ? \" is\" : \"s are\"} ` +\n `registered, but Kernel.models is empty.\\n` +\n ` Nested relation reads resolve a model by name, so a policy on a ` +\n `subclass that does not own its\\n` +\n ` name is skipped inside every include — scoped at the root, ` +\n `unscoped in an include, with nothing\\n` +\n ` to notice it. Declaring the modules registers each class under ` +\n `its own name and audits the set:\\n\\n` +\n ` import * as generated from \"../models/generated\"\\n` +\n ` import * as models from \"../models\"\\n\\n` +\n ` export default class extends Kernel {\\n` +\n ` models = [generated, models]\\n` +\n ` }\\n\\n` +\n ` See docs/orm.md#your-model-class. Development only; this never ` +\n `prints in production.`,\n );\n}\n"
7
7
  ],
8
- "mappings": ";k8BAsCO,DAAM,HAAmD,JAC9D,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,HACA,JACF,HCnCO,MAAM,CAAO,CAMR,OAAsB,CAAC,EAMvB,UAA0C,CAAC,EAa3C,SAAgD,CAAC,EAEnD,iBAA8B,CAAC,EAC/B,cAAgB,IAAI,IACpB,eAAiB,GA8Bf,OAAyC,CAAC,EAE3C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OAAO,KAAK,IAAI,KAAK,CAAmB,EAG1C,SAAS,EAAqB,CAC5B,OAAO,KAAK,IAAI,KAAK,CAAgB,EAGvC,KAAK,EAAiB,CACpB,OAAO,KAAK,IAAI,KAAK,CAAY,EAGnC,OAAO,EAAG,CAGR,GAAI,KAAK,IAAI,SAAS,CAAS,EAC7B,KAAK,IAAI,KAAK,CAAS,EAAE,KAAK,EAKhC,GAFA,KAAK,IAAI,MAAM,EAEX,EAAY,YAAY,IAAM,KAAK,IACrC,EAAY,YAAY,MAAS,EAGnC,EAAc,QAAQ,EAE1B,CAyBA,SAAS,CAAsC,EAAS,CACtD,GAAI,mBAAyB,aAAc,OAE3C,IAAM,EAAa,EAAgB,EACnC,GAAI,EAAW,SAAW,EAAG,OAE7B,QAAQ,KACN,UAAU,EAAW,eAAe,EAAW,SAAW,EAAI,MAAQ;AAAA;AAAA,EAIpE,2EACA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6FAUJ",
9
+ "debugId": "45648151B30677FB64756E2164756E21",
10
10
  "names": []
11
11
  }
@@ -1,7 +1,7 @@
1
1
  import type { ServiceProviderConstructor } from "../foundation/Application";
2
2
  /**
3
- * The providers every gemi app boots with, in registration order. Sixteen
4
- * providers for seventeen services — `RouteServiceProvider` owns both the api
3
+ * The providers every gemi app boots with, in registration order. Seventeen
4
+ * providers for eighteen services — `RouteServiceProvider` owns both the api
5
5
  * and the view dispatcher, the way Laravel's does.
6
6
  *
7
7
  * Order only matters for `boot()`; `register()` binds factories and resolves
@@ -1 +1 @@
1
- {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../kernel/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAkB5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kBAAkB,EAAE,0BAA0B,EAiB1D,CAAC"}
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../kernel/providers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AAmB5E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,kBAAkB,EAAE,0BAA0B,EAoB1D,CAAC"}