gemi 0.91.1 → 0.92.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai/index.js.map +1 -1
  3. package/dist/app/index.js +1 -1
  4. package/dist/bun/plugin.js +1 -1
  5. package/dist/bun/preload.js +1 -1
  6. package/dist/chunk-00cwycyq.js +5 -0
  7. package/dist/{chunk-ddbbxg9m.js.map → chunk-00cwycyq.js.map} +1 -1
  8. package/dist/{chunk-k5j65f2c.js → chunk-165mrqab.js} +2 -2
  9. package/dist/{chunk-k5j65f2c.js.map → chunk-165mrqab.js.map} +1 -1
  10. package/dist/{chunk-gzfat1x1.js → chunk-2caeg5jf.js} +2 -2
  11. package/dist/{chunk-gzfat1x1.js.map → chunk-2caeg5jf.js.map} +1 -1
  12. package/dist/{chunk-6y62ccam.js → chunk-30k7198s.js} +3 -3
  13. package/dist/{chunk-6y62ccam.js.map → chunk-30k7198s.js.map} +1 -1
  14. package/dist/{chunk-kmebynhc.js → chunk-4cjfngfk.js} +2 -2
  15. package/dist/{chunk-kmebynhc.js.map → chunk-4cjfngfk.js.map} +1 -1
  16. package/dist/{chunk-j2402q2z.js → chunk-4cqt4y7f.js} +2 -2
  17. package/dist/{chunk-j2402q2z.js.map → chunk-4cqt4y7f.js.map} +1 -1
  18. package/dist/{chunk-9kfnd4bf.js → chunk-52bk916h.js} +1 -1
  19. package/dist/{chunk-49v5xq8q.js → chunk-677yj1rx.js} +2 -2
  20. package/dist/{chunk-49v5xq8q.js.map → chunk-677yj1rx.js.map} +1 -1
  21. package/dist/{chunk-6tt3ynm7.js → chunk-6jw956j2.js} +2 -2
  22. package/dist/{chunk-6tt3ynm7.js.map → chunk-6jw956j2.js.map} +1 -1
  23. package/dist/{chunk-3z8fkczm.js → chunk-73drae3k.js} +2 -2
  24. package/dist/{chunk-3z8fkczm.js.map → chunk-73drae3k.js.map} +1 -1
  25. package/dist/{chunk-b1wjymn0.js → chunk-7dp5fv1e.js} +2 -2
  26. package/dist/{chunk-b1wjymn0.js.map → chunk-7dp5fv1e.js.map} +1 -1
  27. package/dist/{chunk-fj7yk6a7.js → chunk-7hvnms5x.js} +3 -3
  28. package/dist/{chunk-fj7yk6a7.js.map → chunk-7hvnms5x.js.map} +1 -1
  29. package/dist/{chunk-01n76z2m.js → chunk-7v9919g5.js} +2 -2
  30. package/dist/{chunk-01n76z2m.js.map → chunk-7v9919g5.js.map} +1 -1
  31. package/dist/{chunk-7k7dfy74.js → chunk-93c5cx5a.js} +2 -2
  32. package/dist/{chunk-7k7dfy74.js.map → chunk-93c5cx5a.js.map} +1 -1
  33. package/dist/{chunk-a9a3tbyr.js → chunk-98jbvwpf.js} +2 -2
  34. package/dist/{chunk-a9a3tbyr.js.map → chunk-98jbvwpf.js.map} +1 -1
  35. package/dist/{chunk-7ct4y1zh.js → chunk-9de5kyz3.js} +3 -3
  36. package/dist/{chunk-7ct4y1zh.js.map → chunk-9de5kyz3.js.map} +1 -1
  37. package/dist/{chunk-ngrr6wvw.js → chunk-9k9znvhp.js} +2 -2
  38. package/dist/{chunk-ngrr6wvw.js.map → chunk-9k9znvhp.js.map} +1 -1
  39. package/dist/{chunk-kdpc26j2.js → chunk-bsgjnb30.js} +1 -1
  40. package/dist/{chunk-dedazpms.js → chunk-cm9am4b8.js} +1 -1
  41. package/dist/{chunk-66g9yytx.js → chunk-cnd7s0vv.js} +3 -3
  42. package/dist/{chunk-66g9yytx.js.map → chunk-cnd7s0vv.js.map} +1 -1
  43. package/dist/{chunk-vqhcztw0.js → chunk-d5nx54s0.js} +2 -2
  44. package/dist/{chunk-vqhcztw0.js.map → chunk-d5nx54s0.js.map} +1 -1
  45. package/dist/{chunk-kk5x6grc.js → chunk-df0105td.js} +2 -2
  46. package/dist/{chunk-kk5x6grc.js.map → chunk-df0105td.js.map} +1 -1
  47. package/dist/{chunk-3470jpmr.js → chunk-dpak844f.js} +2 -2
  48. package/dist/{chunk-3470jpmr.js.map → chunk-dpak844f.js.map} +1 -1
  49. package/dist/{chunk-8acf5bf3.js → chunk-dt38t11e.js} +2 -2
  50. package/dist/{chunk-8acf5bf3.js.map → chunk-dt38t11e.js.map} +1 -1
  51. package/dist/{chunk-dyq9gcwa.js → chunk-dxcg3vg7.js} +2 -2
  52. package/dist/{chunk-dyq9gcwa.js.map → chunk-dxcg3vg7.js.map} +1 -1
  53. package/dist/{chunk-mn5xnk02.js → chunk-ejebep30.js} +2 -2
  54. package/dist/{chunk-mn5xnk02.js.map → chunk-ejebep30.js.map} +1 -1
  55. package/dist/{chunk-n4mfv24c.js → chunk-ev5nyhp4.js} +2 -2
  56. package/dist/{chunk-n4mfv24c.js.map → chunk-ev5nyhp4.js.map} +1 -1
  57. package/dist/{chunk-f2vjbxh6.js → chunk-ev6j9291.js} +2 -2
  58. package/dist/{chunk-f2vjbxh6.js.map → chunk-ev6j9291.js.map} +1 -1
  59. package/dist/{chunk-d476f9f6.js → chunk-f3fb0x49.js} +2 -2
  60. package/dist/{chunk-d476f9f6.js.map → chunk-f3fb0x49.js.map} +1 -1
  61. package/dist/{chunk-bj6gsxkv.js → chunk-fwrefjt0.js} +2 -2
  62. package/dist/{chunk-bj6gsxkv.js.map → chunk-fwrefjt0.js.map} +1 -1
  63. package/dist/{chunk-3nh3h2df.js → chunk-g582bb47.js} +2 -2
  64. package/dist/{chunk-3nh3h2df.js.map → chunk-g582bb47.js.map} +1 -1
  65. package/dist/{chunk-ez0c0mpt.js → chunk-geg85jwj.js} +2 -2
  66. package/dist/{chunk-ez0c0mpt.js.map → chunk-geg85jwj.js.map} +1 -1
  67. package/dist/chunk-hg51829v.js +17 -0
  68. package/dist/{chunk-087r45fw.js.map → chunk-hg51829v.js.map} +4 -4
  69. package/dist/{chunk-e70ggm2m.js → chunk-hj4wjv7v.js} +2 -2
  70. package/dist/{chunk-e70ggm2m.js.map → chunk-hj4wjv7v.js.map} +1 -1
  71. package/dist/{chunk-5rpeez39.js → chunk-hzd58xtv.js} +3 -3
  72. package/dist/{chunk-5rpeez39.js.map → chunk-hzd58xtv.js.map} +1 -1
  73. package/dist/{chunk-w9j1kxmc.js → chunk-jrpn4k18.js} +2 -2
  74. package/dist/{chunk-fc28h7g2.js.map → chunk-jrpn4k18.js.map} +1 -1
  75. package/dist/{chunk-r6jytsz3.js → chunk-jth8zxxk.js} +2 -2
  76. package/dist/{chunk-r6jytsz3.js.map → chunk-jth8zxxk.js.map} +1 -1
  77. package/dist/{chunk-t6hma13w.js → chunk-k13q1tvj.js} +3 -3
  78. package/dist/{chunk-t6hma13w.js.map → chunk-k13q1tvj.js.map} +1 -1
  79. package/dist/{chunk-sh1cfx9j.js → chunk-mfncnxva.js} +3 -3
  80. package/dist/{chunk-sh1cfx9j.js.map → chunk-mfncnxva.js.map} +1 -1
  81. package/dist/{chunk-ttckhvew.js → chunk-mqa6b0sx.js} +2 -2
  82. package/dist/{chunk-ttckhvew.js.map → chunk-mqa6b0sx.js.map} +1 -1
  83. package/dist/{chunk-6ffpdkjw.js → chunk-nhnv4nrs.js} +3 -3
  84. package/dist/{chunk-6ffpdkjw.js.map → chunk-nhnv4nrs.js.map} +1 -1
  85. package/dist/{chunk-d33qcg5b.js → chunk-nxwfjn97.js} +2 -2
  86. package/dist/{chunk-d33qcg5b.js.map → chunk-nxwfjn97.js.map} +1 -1
  87. package/dist/{chunk-2mrgrjy6.js → chunk-pd6qazcx.js} +2 -2
  88. package/dist/{chunk-2mrgrjy6.js.map → chunk-pd6qazcx.js.map} +1 -1
  89. package/dist/{chunk-q7gkfkbz.js → chunk-pnf2vn6y.js} +2 -2
  90. package/dist/{chunk-q7gkfkbz.js.map → chunk-pnf2vn6y.js.map} +1 -1
  91. package/dist/{chunk-17nh5gfm.js → chunk-pwchwgkc.js} +2 -2
  92. package/dist/{chunk-17nh5gfm.js.map → chunk-pwchwgkc.js.map} +1 -1
  93. package/dist/{chunk-ed346kf4.js → chunk-ra0ct4ad.js} +2 -2
  94. package/dist/{chunk-ed346kf4.js.map → chunk-ra0ct4ad.js.map} +1 -1
  95. package/dist/{chunk-p3n8jjjf.js → chunk-rzh6nq2x.js} +3 -3
  96. package/dist/{chunk-p3n8jjjf.js.map → chunk-rzh6nq2x.js.map} +1 -1
  97. package/dist/{chunk-cv2sargd.js → chunk-s74kx019.js} +2 -2
  98. package/dist/{chunk-cv2sargd.js.map → chunk-s74kx019.js.map} +1 -1
  99. package/dist/{chunk-araqww9d.js → chunk-sa79bwd3.js} +2 -2
  100. package/dist/{chunk-araqww9d.js.map → chunk-sa79bwd3.js.map} +1 -1
  101. package/dist/{chunk-n2rq7wp8.js → chunk-t8xxsah1.js} +2 -2
  102. package/dist/{chunk-n2rq7wp8.js.map → chunk-t8xxsah1.js.map} +1 -1
  103. package/dist/{chunk-6p62z1h3.js → chunk-t91h0yek.js} +2 -2
  104. package/dist/{chunk-6p62z1h3.js.map → chunk-t91h0yek.js.map} +1 -1
  105. package/dist/{chunk-4czqjqs7.js → chunk-tj684a37.js} +2 -2
  106. package/dist/{chunk-4czqjqs7.js.map → chunk-tj684a37.js.map} +1 -1
  107. package/dist/{chunk-2dfar4d1.js → chunk-tx7hd2ec.js} +2 -2
  108. package/dist/{chunk-2dfar4d1.js.map → chunk-tx7hd2ec.js.map} +1 -1
  109. package/dist/{chunk-j0qwgrp6.js → chunk-v6kef2b8.js} +4 -4
  110. package/dist/{chunk-j0qwgrp6.js.map → chunk-v6kef2b8.js.map} +1 -1
  111. package/dist/{chunk-xqyx8kzr.js → chunk-v6vsjdp7.js} +2 -2
  112. package/dist/{chunk-xqyx8kzr.js.map → chunk-v6vsjdp7.js.map} +1 -1
  113. package/dist/{chunk-q18fb0cr.js → chunk-w46dtkdh.js} +2 -2
  114. package/dist/{chunk-q18fb0cr.js.map → chunk-w46dtkdh.js.map} +1 -1
  115. package/dist/{chunk-6mdw41s5.js → chunk-x6vkmjb8.js} +2 -2
  116. package/dist/{chunk-6mdw41s5.js.map → chunk-x6vkmjb8.js.map} +1 -1
  117. package/dist/{chunk-5c7nyk5k.js → chunk-y1z1bq77.js} +2 -2
  118. package/dist/{chunk-5c7nyk5k.js.map → chunk-y1z1bq77.js.map} +1 -1
  119. package/dist/{chunk-hc1mcgs9.js → chunk-ykxvpzzr.js} +2 -2
  120. package/dist/{chunk-hc1mcgs9.js.map → chunk-ykxvpzzr.js.map} +1 -1
  121. package/dist/{chunk-x97zectc.js → chunk-ynjtm50m.js} +2 -2
  122. package/dist/{chunk-x97zectc.js.map → chunk-ynjtm50m.js.map} +1 -1
  123. package/dist/{chunk-w4qek53d.js → chunk-z3y1pa0y.js} +2 -2
  124. package/dist/{chunk-w4qek53d.js.map → chunk-z3y1pa0y.js.map} +1 -1
  125. package/dist/{chunk-fc28h7g2.js → chunk-z77p625q.js} +2 -2
  126. package/dist/{chunk-w9j1kxmc.js.map → chunk-z77p625q.js.map} +1 -1
  127. package/dist/{chunk-hx1jg944.js → chunk-z89v7fm0.js} +2 -2
  128. package/dist/{chunk-hx1jg944.js.map → chunk-z89v7fm0.js.map} +1 -1
  129. package/dist/client/Mutation.d.ts +12 -3
  130. package/dist/client/Mutation.d.ts.map +1 -1
  131. package/dist/client/MutationError.d.ts +32 -2
  132. package/dist/client/MutationError.d.ts.map +1 -1
  133. package/dist/client/auth/useForgotPassword.d.ts +1 -1
  134. package/dist/client/auth/useResetPassword.d.ts +1 -1
  135. package/dist/client/auth/useSignIn.d.ts +1 -1
  136. package/dist/client/auth/useSignOut.d.ts +1 -1
  137. package/dist/client/auth/useSignUp.d.ts +1 -1
  138. package/dist/client/index.d.ts +2 -2
  139. package/dist/client/index.d.ts.map +1 -1
  140. package/dist/client/index.js +19 -1
  141. package/dist/client/index.js.map +1 -1
  142. package/dist/client/useMutation.d.ts +38 -26
  143. package/dist/client/useMutation.d.ts.map +1 -1
  144. package/dist/config/index.js +1 -1
  145. package/dist/console/run.js +2 -2
  146. package/dist/console/run.js.map +1 -1
  147. package/dist/container/index.js +2 -2
  148. package/dist/container/index.js.map +1 -1
  149. package/dist/database/index.js +2 -2
  150. package/dist/database/index.js.map +1 -1
  151. package/dist/email/index.js +2 -2
  152. package/dist/email/index.js.map +1 -1
  153. package/dist/facades/index.js +2 -2
  154. package/dist/facades/index.js.map +1 -1
  155. package/dist/foundation/index.js +2 -2
  156. package/dist/foundation/index.js.map +1 -1
  157. package/dist/http/ApiRouter.d.ts +10 -4
  158. package/dist/http/ApiRouter.d.ts.map +1 -1
  159. package/dist/http/HttpResponse.d.ts +85 -10
  160. package/dist/http/HttpResponse.d.ts.map +1 -1
  161. package/dist/http/index.d.ts +1 -1
  162. package/dist/http/index.d.ts.map +1 -1
  163. package/dist/http/index.js +2 -2
  164. package/dist/http/index.js.map +1 -1
  165. package/dist/i18n/dictionaryRuntime.js +2 -2
  166. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  167. package/dist/i18n/index.js +2 -2
  168. package/dist/i18n/index.js.map +1 -1
  169. package/dist/kernel/index.js +2 -2
  170. package/dist/kernel/index.js.map +1 -1
  171. package/dist/orm/index.js +2 -2
  172. package/dist/orm/index.js.map +1 -1
  173. package/dist/server/index.js +2 -2
  174. package/dist/server/index.js.map +1 -1
  175. package/dist/services/index.js +2 -2
  176. package/dist/services/index.js.map +1 -1
  177. package/dist/services/queue/work.js +2 -2
  178. package/dist/services/queue/work.js.map +1 -1
  179. package/dist/support/index.js +2 -2
  180. package/dist/support/index.js.map +1 -1
  181. package/package.json +1 -1
  182. package/skills/gemi-react-best-practices/rules/controller-throw-framework-errors.md +9 -0
  183. package/dist/chunk-087r45fw.js +0 -17
  184. package/dist/chunk-ddbbxg9m.js +0 -5
  185. /package/dist/{chunk-9kfnd4bf.js.map → chunk-52bk916h.js.map} +0 -0
  186. /package/dist/{chunk-kdpc26j2.js.map → chunk-bsgjnb30.js.map} +0 -0
  187. /package/dist/{chunk-dedazpms.js.map → chunk-cm9am4b8.js.map} +0 -0
@@ -1,3 +1,4 @@
1
+ import type { Refusal } from "./refusal";
1
2
  /**
2
3
  * Marks an `HttpResponse` at runtime. A registered symbol rather than
3
4
  * `instanceof`, so a route built against one copy of gemi is still recognised by
@@ -5,9 +6,9 @@
5
6
  * reason `RequestBreakerError` is recognised by its `kind` too.
6
7
  */
7
8
  declare const HTTP_RESPONSE: unique symbol;
8
- export type HttpResponseOptions = {
9
+ export type HttpResponseOptions<S extends number = number> = {
9
10
  /** The status code. `200` when omitted. */
10
- status?: number;
11
+ status?: S;
11
12
  /**
12
13
  * Set on top of everything the request already put on the response. Each
13
14
  * header named here replaces the one the context holds; a `Set-Cookie` is
@@ -40,10 +41,10 @@ type HttpResponseKind = "json";
40
41
  * For api routes. A view's handler returns its props; returning one there
41
42
  * throws.
42
43
  */
43
- export declare class HttpResponse<T = unknown> {
44
+ export declare class HttpResponse<T = unknown, S extends number = number> {
44
45
  readonly kind: HttpResponseKind;
45
46
  readonly body: T;
46
- readonly status: number;
47
+ readonly status: S;
47
48
  readonly headers: Headers;
48
49
  readonly [HTTP_RESPONSE] = true;
49
50
  private constructor();
@@ -56,7 +57,27 @@ export declare class HttpResponse<T = unknown> {
56
57
  * behind `cache` would otherwise let a shared cache replay one client's 404
57
58
  * to everyone.
58
59
  */
59
- static json<T>(data: T, options?: HttpResponseOptions): HttpResponse<T>;
60
+ static json<T, S extends number = 200>(data: T, options?: HttpResponseOptions<S>): HttpResponse<T, S>;
61
+ /**
62
+ * A typed error: `{ "error": body }` with a status from 400 to 599, the
63
+ * envelope gemi's own errors answer.
64
+ *
65
+ * ```ts
66
+ * if (expired(link)) {
67
+ * return HttpResponse.error(410, { kind: "gone", message: "Link has expired" });
68
+ * }
69
+ * return { catalogId };
70
+ * ```
71
+ *
72
+ * The route's client type leaves it out of the data and adds `body` to the
73
+ * error type instead: `onError` and `error` on `useMutation`, `usePost`,
74
+ * `useUpload` and `<Form>` are `MutationError | typeof body` (with `status`
75
+ * added), so `if (!(e instanceof Error) && e.kind === "gone")` narrows.
76
+ * `httpError(status, body)` is the same function.
77
+ */
78
+ static error<const E, S extends number>(status: S, body: E, options?: Omit<HttpResponseOptions, "status">): HttpResponse<{
79
+ error: E;
80
+ }, S>;
60
81
  /** Whether the status is 2xx, as `Response.ok`. */
61
82
  get ok(): boolean;
62
83
  /**
@@ -72,12 +93,66 @@ export declare class HttpResponse<T = unknown> {
72
93
  private serialize;
73
94
  }
74
95
  export declare function isHttpResponse(value: unknown): value is HttpResponse<unknown>;
75
- type UnwrapHttpResponse<T> = T extends HttpResponse<infer Data> ? Data : T;
76
96
  /**
77
- * What a handler returning `Output` answers the client with: `Output` itself,
78
- * with every `HttpResponse<T>` in it — under a `Promise` or not, alone or in a
79
- * union with plain returns — replaced by its `T`. `any` stays `any`.
97
+ * `HttpResponse.error(status, body)`: a typed error response. See
98
+ * `HttpResponse.error`.
99
+ */
100
+ export declare function httpError<const E, S extends number>(status: S, body: E, options?: Omit<HttpResponseOptions, "status">): HttpResponse<{
101
+ error: E;
102
+ }, S>;
103
+ type Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
104
+ /**
105
+ * Whether `S` is known to be 400 or more: a literal status, or a union of
106
+ * them, every one of which is. `number`, and a union with a 2xx in it, are
107
+ * not, so a status picked at run time stays in the data as it always was.
108
+ */
109
+ type IsErrorStatus<S> = [S] extends [never] ? false : [`${S & number}`] extends [`4${Digit}${Digit}` | `5${Digit}${Digit}`] ? true : false;
110
+ type SuccessMember<T> = T extends HttpResponse<infer Data, infer S> ? IsErrorStatus<S> extends true ? never : Data : T;
111
+ /**
112
+ * A raw `Response` in a union with typed returns is dropped: the client never
113
+ * receives a `Response` object, and it was the success type `if (r instanceof
114
+ * Response)` had to be written against. A route that only ever returns one (a
115
+ * file, a stream) keeps it, as before.
116
+ */
117
+ type SuccessData<T> = [Exclude<SuccessMember<T>, Response>] extends [never] ? SuccessMember<T> : Exclude<SuccessMember<T>, Response>;
118
+ /**
119
+ * What a handler returning `Output` answers the client with on success:
120
+ * `Output` itself, with every `HttpResponse<T>` in it — under a `Promise` or
121
+ * not, alone or in a union with plain returns — replaced by its `T`.
122
+ *
123
+ * Left out: an `HttpResponse` whose status is a literal 400 or more
124
+ * (`HttpResponse.error`, `httpError`, `HttpResponse.json(x, { status: 409 })`),
125
+ * which `ResponseError` collects instead, and a raw `Response` in a union with
126
+ * anything else. `any` stays `any`.
127
+ */
128
+ export type ResponseData<Output> = 0 extends 1 & Output ? Output : [
129
+ Output
130
+ ] extends [Promise<infer Resolved>] ? Promise<SuccessData<Resolved>> : [Extract<Output, Promise<any>>] extends [never] ? SuccessData<Output> : Output extends Promise<infer Resolved> ? Promise<SuccessData<Resolved>> : SuccessData<Output>;
131
+ /**
132
+ * The value the client's `onError` receives for an error body `E` answered
133
+ * with status `S`, as `mutationErrorFromBody` builds it: `status` is added
134
+ * unless `E` has one, an object with a `message` and no `kind` is given the
135
+ * kind its status stands for, and a string (or nothing) becomes a refusal.
136
+ */
137
+ export type ClientHttpError<E, S extends number = number> = E extends string | null | undefined ? Refusal : E extends object ? E extends {
138
+ kind: string;
139
+ } ? WithStatus<E, S> : E extends {
140
+ message: string;
141
+ } ? WithStatus<E, S> & {
142
+ kind: Refusal["kind"];
143
+ } : WithStatus<E, S> : E;
144
+ type WithStatus<E, S extends number> = "status" extends keyof E ? E : E & {
145
+ status: S;
146
+ };
147
+ type ErrorMember<T> = T extends HttpResponse<infer Data, infer S> ? IsErrorStatus<S> extends true ? Data extends {
148
+ error: infer E;
149
+ } ? ClientHttpError<E, S> : ClientHttpError<Data, S> : never : never;
150
+ /**
151
+ * The typed errors a handler returning `Output` can answer: every
152
+ * `HttpResponse` in it whose status is a literal 400 or more, as the client's
153
+ * `onError` receives it (see `ClientHttpError`). `never` when there are none,
154
+ * and for `any`.
80
155
  */
81
- export type ResponseData<Output> = 0 extends 1 & Output ? Output : Output extends Promise<infer Resolved> ? Promise<UnwrapHttpResponse<Resolved>> : UnwrapHttpResponse<Output>;
156
+ export type ResponseError<Output> = 0 extends 1 & Output ? never : ErrorMember<Awaited<Output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,EAAE,OAAO,CAAC,MAAM,CAAC,CAAA;CAAE,GAC5C,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GACpB,CAAC,CAAC;AAER,KAAK,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,QAAQ,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC;AAIxF,KAAK,WAAW,CAAC,CAAC,IAChB,CAAC,SAAS,YAAY,CAAC,MAAM,IAAI,EAAE,MAAM,CAAC,CAAC,GACvC,aAAa,CAAC,CAAC,CAAC,SAAS,IAAI,GAC3B,IAAI,SAAS;IAAE,KAAK,EAAE,MAAM,CAAC,CAAA;CAAE,GAC7B,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,GACrB,eAAe,CAAC,IAAI,EAAE,CAAC,CAAC,GAC1B,KAAK,GACP,KAAK,CAAC;AAEZ;;;;;GAKG;AACH,MAAM,MAAM,aAAa,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,GAAG,MAAM,GAAG,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC"}
@@ -12,7 +12,7 @@ export { Middleware } from "./Middleware";
12
12
  export { getCookies } from "./getCookies";
13
13
  export { RequestBreakerError, type RequestBreakerOptions } from "./Error";
14
14
  export type { Refusal, RefusalKind } from "./refusal";
15
- export { HttpResponse, type HttpResponseOptions } from "./HttpResponse";
15
+ export { HttpResponse, httpError, type HttpResponseOptions, type ClientHttpError, } from "./HttpResponse";
16
16
  export { defineMiddlewareConfig, middlewareConfigDefaults, type MiddlewareConfig, } from "./middleware-config";
17
17
  export { AuthenticationMiddleware } from "./AuthenticationMiddlware";
18
18
  export { CacheMiddleware } from "./CacheMiddleware";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../http/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,kBAAkB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"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{Bd as H,Cd as I,Dd as J,Ed as K,Fd as L,Gd as M,ec as n,fc as o,gc as p,hc as v,ic as w,jc as x,lc as y,mc as z,nc as A,oc as B,pc as C,qc as D,vc as E,wc as F,xc as G}from"../chunk-087r45fw.js";import"../chunk-66g9yytx.js";import"../chunk-k5j65f2c.js";import{Ie as a,Je as b,Ke as d,Oe as e,Pe as f,Qe as g,Re as h,Se as i,Te as j,Ye as k,Ze as l,bf as m,cf as q,df as r,ef as s,ff as t,gf as u}from"../chunk-7ct4y1zh.js";import{vf as c}from"../chunk-xqyx8kzr.js";import"../chunk-17nh5gfm.js";import"../chunk-6y62ccam.js";import"../chunk-gzfat1x1.js";import"../chunk-49v5xq8q.js";import"../chunk-ttckhvew.js";import"../chunk-cv2sargd.js";import"../chunk-sh1cfx9j.js";import"../chunk-dyq9gcwa.js";import"../chunk-ed346kf4.js";import"../chunk-kmebynhc.js";import"../chunk-q7gkfkbz.js";import"../chunk-fc28h7g2.js";export{g as toRangeHeaderValue,n as toMiddlewareList,f as resolveRange,e as parseRangeHeader,h as parseContentRange,D as middlewareConfigDefaults,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,C as defineMiddlewareConfig,o as createUnsatisfiableResponse,p as createStreamResponse,z as createFileResponse,G as clientIp,A as ViewRouter,k as ValidationError,b as ResourceController,c as RequestBreakerError,F as RateLimitMiddleware,E as RateLimitExceededError,s as RangeNotSatisfiableError,L as PoliciesServiceProvider,M as Policies,B as Middleware,x as McpRouter,w as McpRouteDeclaration,l as InvalidValidationRuleError,r as InsufficientPermissionsError,y as HttpResponse,m as HttpRequest,t as FileNotFoundError,J as CorsMiddleware,a as Controller,I as CacheMiddleware,K as CSRFMiddleware,q as AuthorizationError,H as AuthenticationMiddleware,u as AuthenticationError,v as ApiRouter};
2
+ import{Cd as I,Dd as J,Ed as K,Fd as L,Gd as M,Hd as N,ec as n,fc as o,gc as p,hc as v,ic as w,jc as x,lc as y,mc as z,nc as A,oc as B,pc as C,qc as D,rc as E,wc as F,xc as G,yc as H}from"../chunk-hg51829v.js";import"../chunk-cnd7s0vv.js";import"../chunk-165mrqab.js";import{Je as a,Ke as b,Le as d,Pe as e,Qe as f,Re as g,Se as h,Te as i,Ue as j,Ze as k,_e as l,cf as m,df as q,ef as r,ff as s,gf as t,hf as u}from"../chunk-9de5kyz3.js";import{wf as c}from"../chunk-v6vsjdp7.js";import"../chunk-pwchwgkc.js";import"../chunk-30k7198s.js";import"../chunk-2caeg5jf.js";import"../chunk-677yj1rx.js";import"../chunk-mqa6b0sx.js";import"../chunk-s74kx019.js";import"../chunk-mfncnxva.js";import"../chunk-dxcg3vg7.js";import"../chunk-ra0ct4ad.js";import"../chunk-4cjfngfk.js";import"../chunk-pnf2vn6y.js";import"../chunk-z77p625q.js";export{g as toRangeHeaderValue,n as toMiddlewareList,f as resolveRange,e as parseRangeHeader,h as parseContentRange,E as middlewareConfigDefaults,z as httpError,d as getCookies,j as formatUnsatisfiedContentRange,i as formatContentRange,D as defineMiddlewareConfig,o as createUnsatisfiableResponse,p as createStreamResponse,A as createFileResponse,H as clientIp,B as ViewRouter,k as ValidationError,b as ResourceController,c as RequestBreakerError,G as RateLimitMiddleware,F as RateLimitExceededError,s as RangeNotSatisfiableError,M as PoliciesServiceProvider,N as Policies,C as Middleware,x as McpRouter,w as McpRouteDeclaration,l as InvalidValidationRuleError,r as InsufficientPermissionsError,y as HttpResponse,m as HttpRequest,t as FileNotFoundError,K as CorsMiddleware,a as Controller,J as CacheMiddleware,L as CSRFMiddleware,q as AuthorizationError,I as AuthenticationMiddleware,u as AuthenticationError,v as ApiRouter};
3
3
 
4
- //# debugId=F435297EC08BD69664756E2164756E21
4
+ //# debugId=33E8B53A64218C5364756E2164756E21
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "F435297EC08BD69664756E2164756E21",
7
+ "debugId": "33E8B53A64218C5364756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{aa as y,ba as p}from"../chunk-6tt3ynm7.js";import{qa as c,ra as d,ta as l}from"../chunk-9a8qz3s7.js";import{dg as e,eg as i,gg as t,hg as r,ig as o,jg as n,kg as a,lg as s}from"../chunk-49v5xq8q.js";import"../chunk-fc28h7g2.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-6jw956j2.js";import{qa as c,ra as d,ta as l}from"../chunk-9a8qz3s7.js";import{eg as e,fg as i,hg as t,ig as r,jg as o,kg as n,lg as a,mg as s}from"../chunk-677yj1rx.js";import"../chunk-z77p625q.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=5227EE9FFE551E9D64756E2164756E21
4
+ //# debugId=8F6CEF32902BD4E864756E2164756E21
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "5227EE9FFE551E9D64756E2164756E21",
7
+ "debugId": "8F6CEF32902BD4E864756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{aa as R}from"../chunk-6tt3ynm7.js";import"../chunk-9a8qz3s7.js";import{Wa as L}from"../chunk-ddbbxg9m.js";import{bc as E,cc as V}from"../chunk-7bmctvep.js";import"../chunk-p0px3ym0.js";import{Jc as j}from"../chunk-087r45fw.js";import"../chunk-66g9yytx.js";import"../chunk-k5j65f2c.js";import"../chunk-7ct4y1zh.js";import"../chunk-xqyx8kzr.js";import"../chunk-17nh5gfm.js";import"../chunk-6y62ccam.js";import"../chunk-gzfat1x1.js";import"../chunk-49v5xq8q.js";import"../chunk-ttckhvew.js";import{ug as X}from"../chunk-cv2sargd.js";import"../chunk-sh1cfx9j.js";import"../chunk-dyq9gcwa.js";import"../chunk-ed346kf4.js";import"../chunk-kmebynhc.js";import"../chunk-q7gkfkbz.js";import"../chunk-fc28h7g2.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-6jw956j2.js";import"../chunk-9a8qz3s7.js";import{Wa as L}from"../chunk-00cwycyq.js";import{bc as E,cc as V}from"../chunk-7bmctvep.js";import"../chunk-p0px3ym0.js";import{Kc as j}from"../chunk-hg51829v.js";import"../chunk-cnd7s0vv.js";import"../chunk-165mrqab.js";import"../chunk-9de5kyz3.js";import"../chunk-v6vsjdp7.js";import"../chunk-pwchwgkc.js";import"../chunk-30k7198s.js";import"../chunk-2caeg5jf.js";import"../chunk-677yj1rx.js";import"../chunk-mqa6b0sx.js";import{vg as X}from"../chunk-s74kx019.js";import"../chunk-mfncnxva.js";import"../chunk-dxcg3vg7.js";import"../chunk-ra0ct4ad.js";import"../chunk-4cjfngfk.js";import"../chunk-pnf2vn6y.js";import"../chunk-z77p625q.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=E850D743959B93B864756E2164756E21
4
+ //# debugId=1CF52BDD0BE77B1A64756E2164756E21
@@ -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": ";gzBAAA,mBAAS,SAAe,eAAU,SAO3B,IAAS,JAAgB,JAAC,HAAkB,HAAwB,JAEzE,DAAM,HAAS,EAAO,EAAO,JAAM,HAAE,AACnC,JAAC,DACC,EAAO,DAAU,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,gC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";import{Va as i}from"../chunk-q18fb0cr.js";import{Wa as g}from"../chunk-ddbbxg9m.js";import{$a as e,Za as T,_a as D,ab as A,bb as w,fb as P,gb as S,ib as h,jb as R,kb as u,lb as l,ob as v,pb as d,sb as c,vb as p,yb as n}from"../chunk-vqhcztw0.js";import"../chunk-wc46df4w.js";import"../chunk-6mdw41s5.js";import{Yb as r}from"../chunk-2dfar4d1.js";import"../chunk-7bmctvep.js";import"../chunk-p0px3ym0.js";import{Cc as Zj,Dc as $j,Gc as Gj,Hc as Hj,jd as x,od as I,pd as E,sd as K,td as M,ud as s,vd as C,wd as m,xd as Q,yd as t,zd as o}from"../chunk-087r45fw.js";import{Kd as a}from"../chunk-66g9yytx.js";import{Xd as V,ae as f}from"../chunk-k5j65f2c.js";import{bf as F}from"../chunk-7ct4y1zh.js";import{uf as B}from"../chunk-xqyx8kzr.js";import{Af as L}from"../chunk-17nh5gfm.js";import"../chunk-6y62ccam.js";import"../chunk-gzfat1x1.js";import"../chunk-49v5xq8q.js";import"../chunk-ttckhvew.js";import"../chunk-t6hma13w.js";import"../chunk-cv2sargd.js";import{wg as N,xg as b}from"../chunk-sh1cfx9j.js";import{yg as _}from"../chunk-dyq9gcwa.js";import"../chunk-ed346kf4.js";import"../chunk-kk5x6grc.js";import"../chunk-kmebynhc.js";import{Lg as q}from"../chunk-q7gkfkbz.js";import"../chunk-fc28h7g2.js";function Jj(j){let X=j.headers.get("Cache-Control")?.toLowerCase()??"";return/(^|[\s,])(public|s-maxage)\b/.test(X)}var Wj=new Set,Xj={refusal:null,apply:(j)=>j,carried:null};async function k(j){let X=b(x);if(X.config.global.length===0)return Xj;let{pathname:Z}=new URL(j.url),W=q(Z),z=new F(j,{},W?"api":"view","");return await L.run(z,async()=>{let $=L.getStore(),{headers:H,cookies:zj}=$,Y=(J)=>{if(!Jj(J))return Q(J,H,zj);let G=new Headers(H);return G.delete("Set-Cookie"),Q(J,G,Wj)};try{return await X.runGlobalMiddleware(),{refusal:null,apply:Y,carried:{user:$.user}}}catch(J){let G=!W&&Z.endsWith(".json");if(J?.kind===B){let O=W?m(J.payload.api):G?M(J.payload.viewData??J.payload.api):K(J.payload.view);return{refusal:Y(O),apply:Y,carried:null}}if(V(J)&&(W||G))return{refusal:Y(C()),apply:Y,carried:null};if(f(J)){console.error(J);let O=W||G?I():K(E());return{refusal:Y(O),apply:Y,carried:null}}throw J}finally{$.destroy()}})}var U=[l,d,y,P,n,A,S,v,R,D,h,p,u,g,c,w];class jj{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new N;boot(){if(this.models.length>0)i(...this.models);else Yj();this.app.config.merge(this.config),N.setInstance(this.app),this.app.registerMany([...U,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let Z of this.services){let W=typeof Z==="function"?new Z:Z,z=W.constructor;if(!z.token)throw Error(`Service [${z.name}] is listed in \`services\` but does not declare a \`static token\`.`);let $=X.get(z.token);if($)throw Error(`Services [${$}] and [${z.name}] both declare the token "${z.token}". Tokens are the container's keys, so they must be unique.`);X.set(z.token,z.name);let H=z;if(!j.has(z.token)&&this.app.bound(H))throw Error(`Service [${z.name}] declares the token "${z.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(H,W),this.serviceInstances.push(W),this.serviceTokens.add(z.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),e(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return _.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(t)}viewRoutes(){return this.app.make(s)}domains(){return this.app.make(o)}queue(){return this.app.make(r)}globalMiddleware(j){return k(j)}destroy(){if(this.app.resolved(T))this.app.make(T).stop();if(this.app.flush(),N.getInstance()===this.app)N.setInstance(void 0);_.disable()}}function Yj(){if(Bun.env.NODE_ENV==="production")return;let j=a();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.length===1?" is":"s are"} registered, but Kernel.models is empty.
2
+ import{ya as y}from"../chunk-tj684a37.js";import{Va as i}from"../chunk-w46dtkdh.js";import{Wa as g}from"../chunk-00cwycyq.js";import{$a as e,Za as T,_a as D,ab as A,bb as w,fb as P,gb as S,ib as h,jb as R,kb as u,lb as l,ob as v,pb as d,sb as c,vb as p,yb as n}from"../chunk-d5nx54s0.js";import"../chunk-wc46df4w.js";import"../chunk-x6vkmjb8.js";import{Yb as r}from"../chunk-tx7hd2ec.js";import"../chunk-7bmctvep.js";import"../chunk-p0px3ym0.js";import{Ad as o,Dc as Zj,Ec as $j,Hc as Gj,Ic as Hj,kd as x,pd as I,qd as E,td as K,ud as M,vd as s,wd as C,xd as m,yd as Q,zd as t}from"../chunk-hg51829v.js";import{Ld as a}from"../chunk-cnd7s0vv.js";import{Yd as V,be as f}from"../chunk-165mrqab.js";import{cf as F}from"../chunk-9de5kyz3.js";import{vf as B}from"../chunk-v6vsjdp7.js";import{Bf as L}from"../chunk-pwchwgkc.js";import"../chunk-30k7198s.js";import"../chunk-2caeg5jf.js";import"../chunk-677yj1rx.js";import"../chunk-mqa6b0sx.js";import"../chunk-k13q1tvj.js";import"../chunk-s74kx019.js";import{xg as N,yg as b}from"../chunk-mfncnxva.js";import{zg as _}from"../chunk-dxcg3vg7.js";import"../chunk-ra0ct4ad.js";import"../chunk-df0105td.js";import"../chunk-4cjfngfk.js";import{Mg as q}from"../chunk-pnf2vn6y.js";import"../chunk-z77p625q.js";function Jj(j){let X=j.headers.get("Cache-Control")?.toLowerCase()??"";return/(^|[\s,])(public|s-maxage)\b/.test(X)}var Wj=new Set,Xj={refusal:null,apply:(j)=>j,carried:null};async function k(j){let X=b(x);if(X.config.global.length===0)return Xj;let{pathname:Z}=new URL(j.url),W=q(Z),z=new F(j,{},W?"api":"view","");return await L.run(z,async()=>{let $=L.getStore(),{headers:H,cookies:zj}=$,Y=(J)=>{if(!Jj(J))return Q(J,H,zj);let G=new Headers(H);return G.delete("Set-Cookie"),Q(J,G,Wj)};try{return await X.runGlobalMiddleware(),{refusal:null,apply:Y,carried:{user:$.user}}}catch(J){let G=!W&&Z.endsWith(".json");if(J?.kind===B){let O=W?m(J.payload.api):G?M(J.payload.viewData??J.payload.api):K(J.payload.view);return{refusal:Y(O),apply:Y,carried:null}}if(V(J)&&(W||G))return{refusal:Y(C()),apply:Y,carried:null};if(f(J)){console.error(J);let O=W||G?I():K(E());return{refusal:Y(O),apply:Y,carried:null}}throw J}finally{$.destroy()}})}var U=[l,d,y,P,n,A,S,v,R,D,h,p,u,g,c,w];class jj{config={};providers=[];services=[];serviceInstances=[];serviceTokens=new Set;servicesBooted=!1;models=[];app=new N;boot(){if(this.models.length>0)i(...this.models);else Yj();this.app.config.merge(this.config),N.setInstance(this.app),this.app.registerMany([...U,...this.providers]),this.registerServices()}registerServices(){let j=this.serviceTokens;this.serviceInstances=[],this.serviceTokens=new Set,this.servicesBooted=!1;let X=new Map;for(let Z of this.services){let W=typeof Z==="function"?new Z:Z,z=W.constructor;if(!z.token)throw Error(`Service [${z.name}] is listed in \`services\` but does not declare a \`static token\`.`);let $=X.get(z.token);if($)throw Error(`Services [${$}] and [${z.name}] both declare the token "${z.token}". Tokens are the container's keys, so they must be unique.`);X.set(z.token,z.name);let H=z;if(!j.has(z.token)&&this.app.bound(H))throw Error(`Service [${z.name}] declares the token "${z.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(H,W),this.serviceInstances.push(W),this.serviceTokens.add(z.token)}}async waitForBoot(){await this.app.boot(),await this.bootServices(),e(this.app)}async bootServices(){if(this.servicesBooted)return;for(let j of this.serviceInstances)await j.boot();this.servicesBooted=!0}shutdown(j){return this.run(()=>this.app.shutdown(j))}run(j){return _.run(this.app,j)}resolve(j){return this.app.make(j)}apiRoutes(){return this.app.make(t)}viewRoutes(){return this.app.make(s)}domains(){return this.app.make(o)}queue(){return this.app.make(r)}globalMiddleware(j){return k(j)}destroy(){if(this.app.resolved(T))this.app.make(T).stop();if(this.app.flush(),N.getInstance()===this.app)N.setInstance(void 0);_.disable()}}function Yj(){if(Bun.env.NODE_ENV==="production")return;let j=a();if(j.length===0)return;console.warn(`[gemi] ${j.length} model${j.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:
@@ -13,4 +13,4 @@ import{ya as y}from"../chunk-4czqjqs7.js";import{Va as i}from"../chunk-q18fb0cr.
13
13
 
14
14
  See docs/orm.md#your-model-class. Development only; this never prints in production.`)}export{$j as oneTimeSecretMatches,Zj as hashOneTimeSecret,U as frameworkProviders,Hj as UserProvider,Gj as SESSION_SELECT,jj as Kernel};
15
15
 
16
- //# debugId=BDFBA0F783C6D69C64756E2164756E21
16
+ //# debugId=49A040EE93E759A864756E2164756E21
@@ -7,6 +7,6 @@
7
7
  "import { Application } from \"../foundation/Application\";\nimport type { ServiceProviderConstructor, ShutdownReport } 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 { QueueManager } from \"../services/queue/QueueManager\";\nimport { startClaimingIfServing } from \"../services/queue/QueueServiceProvider\";\nimport { ApiRouteDispatcher } from \"../services/router/ApiRouteDispatcher\";\nimport { ViewRouteDispatcher } from \"../services/router/ViewRouteDispatcher\";\nimport { DomainRouter } from \"../services/router/DomainRouter\";\nimport { runGlobalMiddleware } from \"../services/router/globalMiddleware\";\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 // Last, once every job — queued listeners included — is registered.\n startClaimingIfServing(this.app);\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 /**\n * Every provider's `shutdown()`, in reverse registration order, inside the\n * application context — so a hook may use the facades, as a cron tick or a\n * request would. See `Application.shutdown` for the deadline and the\n * report. Idempotent.\n */\n shutdown(options?: { timeoutMs?: number }): Promise<ShutdownReport> {\n return this.run(() => this.app.shutdown(options));\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 domains(): DomainRouter {\n return this.app.make(DomainRouter);\n }\n\n queue(): QueueManager {\n return this.app.make(QueueManager);\n }\n\n /** The `global` middleware list for one request. Call it inside `run`. */\n globalMiddleware(req: Request) {\n return runGlobalMiddleware(req);\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 {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