gemi 0.106.0 → 0.108.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 (246) hide show
  1. package/dist/ai/Agent.d.ts +88 -10
  2. package/dist/ai/Agent.d.ts.map +1 -1
  3. package/dist/ai/AgentController.d.ts +29 -1
  4. package/dist/ai/AgentController.d.ts.map +1 -1
  5. package/dist/ai/Schema.d.ts +26 -3
  6. package/dist/ai/Schema.d.ts.map +1 -1
  7. package/dist/ai/client/index.js +86 -25
  8. package/dist/ai/client/index.js.map +1 -1
  9. package/dist/ai/client/reducer.d.ts.map +1 -1
  10. package/dist/ai/contextWindow.d.ts +122 -0
  11. package/dist/ai/contextWindow.d.ts.map +1 -0
  12. package/dist/ai/index.d.ts +3 -1
  13. package/dist/ai/index.d.ts.map +1 -1
  14. package/dist/ai/index.js +14 -14
  15. package/dist/ai/index.js.map +7 -6
  16. package/dist/ai/types.d.ts +9 -0
  17. package/dist/ai/types.d.ts.map +1 -1
  18. package/dist/ai/useChat.d.ts +47 -1
  19. package/dist/ai/useChat.d.ts.map +1 -1
  20. package/dist/app/index.js +2 -2
  21. package/dist/app/index.js.map +1 -1
  22. package/dist/bin/gemi.js +171 -20
  23. package/dist/bin/gemi.js.map +8 -7
  24. package/dist/bun/customRequestParser.d.ts +9 -0
  25. package/dist/bun/customRequestParser.d.ts.map +1 -0
  26. package/dist/bun/plugin.js +2 -2
  27. package/dist/bun/plugin.js.map +1 -1
  28. package/dist/bun/preload.js +2 -2
  29. package/dist/bun/preload.js.map +2 -2
  30. package/dist/{chunk-rjcmbwcc.js → chunk-00y49jcf.js} +2 -2
  31. package/dist/{chunk-rjcmbwcc.js.map → chunk-00y49jcf.js.map} +1 -1
  32. package/dist/{chunk-22k4b395.js → chunk-1npdp1w2.js} +2 -2
  33. package/dist/{chunk-22k4b395.js.map → chunk-1npdp1w2.js.map} +1 -1
  34. package/dist/{chunk-j6e99sra.js → chunk-1rs13253.js} +75 -75
  35. package/dist/{chunk-j6e99sra.js.map → chunk-1rs13253.js.map} +4 -5
  36. package/dist/{chunk-0fney17e.js → chunk-2gmgd05c.js} +2 -2
  37. package/dist/{chunk-0fney17e.js.map → chunk-2gmgd05c.js.map} +1 -1
  38. package/dist/{chunk-k6rd1nd4.js → chunk-2mhx4e4g.js} +3 -3
  39. package/dist/{chunk-k6rd1nd4.js.map → chunk-2mhx4e4g.js.map} +1 -1
  40. package/dist/{chunk-4f7n1r02.js → chunk-2q7m8a16.js} +2 -2
  41. package/dist/{chunk-4f7n1r02.js.map → chunk-2q7m8a16.js.map} +1 -1
  42. package/dist/{chunk-cbywzv21.js → chunk-2xqrh6d0.js} +1 -1
  43. package/dist/{chunk-gyareq03.js → chunk-331s9wqr.js} +3 -3
  44. package/dist/{chunk-gyareq03.js.map → chunk-331s9wqr.js.map} +1 -1
  45. package/dist/{chunk-1xzdexbq.js → chunk-3s3awh38.js} +2 -2
  46. package/dist/{chunk-1xzdexbq.js.map → chunk-3s3awh38.js.map} +1 -1
  47. package/dist/{chunk-v4exgqbp.js → chunk-47rgq59q.js} +2 -2
  48. package/dist/{chunk-v4exgqbp.js.map → chunk-47rgq59q.js.map} +1 -1
  49. package/dist/{chunk-fcsq613t.js → chunk-4rr9wmh8.js} +2 -2
  50. package/dist/{chunk-fcsq613t.js.map → chunk-4rr9wmh8.js.map} +1 -1
  51. package/dist/{chunk-9a8qz3s7.js → chunk-564zfdd1.js} +2 -2
  52. package/dist/{chunk-9a8qz3s7.js.map → chunk-564zfdd1.js.map} +1 -1
  53. package/dist/{chunk-st0d3ndv.js → chunk-5wt25tyd.js} +2 -2
  54. package/dist/{chunk-st0d3ndv.js.map → chunk-5wt25tyd.js.map} +1 -1
  55. package/dist/{chunk-gy6d6jeg.js → chunk-661wezaf.js} +2 -2
  56. package/dist/{chunk-gy6d6jeg.js.map → chunk-661wezaf.js.map} +1 -1
  57. package/dist/{chunk-yxh4xs3k.js → chunk-6rz8kyqb.js} +2 -2
  58. package/dist/{chunk-yxh4xs3k.js.map → chunk-6rz8kyqb.js.map} +1 -1
  59. package/dist/{chunk-18aqqrev.js → chunk-6wrhc9bq.js} +3 -3
  60. package/dist/{chunk-18aqqrev.js.map → chunk-6wrhc9bq.js.map} +1 -1
  61. package/dist/{chunk-3m93v7bt.js → chunk-82hpq0bq.js} +2 -2
  62. package/dist/{chunk-3m93v7bt.js.map → chunk-82hpq0bq.js.map} +1 -1
  63. package/dist/{chunk-ee92kx8s.js → chunk-8pynv9rw.js} +2 -2
  64. package/dist/{chunk-ee92kx8s.js.map → chunk-8pynv9rw.js.map} +1 -1
  65. package/dist/{chunk-7kedxtbp.js → chunk-9hbwvcxn.js} +2 -2
  66. package/dist/{chunk-7kedxtbp.js.map → chunk-9hbwvcxn.js.map} +1 -1
  67. package/dist/{chunk-47dqttnk.js → chunk-9jz4rggd.js} +2 -2
  68. package/dist/{chunk-47dqttnk.js.map → chunk-9jz4rggd.js.map} +1 -1
  69. package/dist/{chunk-xnggfm0s.js → chunk-9mqqr05d.js} +3 -3
  70. package/dist/{chunk-xnggfm0s.js.map → chunk-9mqqr05d.js.map} +1 -1
  71. package/dist/{chunk-gvkydx8r.js → chunk-9r3znmqq.js} +2 -2
  72. package/dist/{chunk-gvkydx8r.js.map → chunk-9r3znmqq.js.map} +1 -1
  73. package/dist/{chunk-zq5m4scz.js → chunk-a1g0bahx.js} +2 -2
  74. package/dist/{chunk-zq5m4scz.js.map → chunk-a1g0bahx.js.map} +1 -1
  75. package/dist/{chunk-5ngv175h.js → chunk-anp4kv3w.js} +1 -1
  76. package/dist/{chunk-tnp1sc4j.js → chunk-b9av1sgb.js} +2 -2
  77. package/dist/{chunk-tnp1sc4j.js.map → chunk-b9av1sgb.js.map} +1 -1
  78. package/dist/chunk-cewyag0d.js +6 -0
  79. package/dist/{chunk-qxg2dnnr.js.map → chunk-cewyag0d.js.map} +2 -2
  80. package/dist/{chunk-214av8am.js → chunk-cfsscms3.js} +4 -4
  81. package/dist/{chunk-214av8am.js.map → chunk-cfsscms3.js.map} +1 -1
  82. package/dist/{chunk-q8r9mvzx.js → chunk-eytdyahy.js} +2 -2
  83. package/dist/{chunk-q8r9mvzx.js.map → chunk-eytdyahy.js.map} +1 -1
  84. package/dist/{chunk-j041a7ej.js → chunk-ffagkj3x.js} +2 -2
  85. package/dist/{chunk-j041a7ej.js.map → chunk-ffagkj3x.js.map} +1 -1
  86. package/dist/{chunk-gvv2trvz.js → chunk-fq3sb3xt.js} +3 -3
  87. package/dist/{chunk-gvv2trvz.js.map → chunk-fq3sb3xt.js.map} +1 -1
  88. package/dist/{chunk-b1dqx3b9.js → chunk-ftgd68se.js} +3 -3
  89. package/dist/{chunk-b1dqx3b9.js.map → chunk-ftgd68se.js.map} +1 -1
  90. package/dist/{chunk-j9deswmn.js → chunk-fwympxqk.js} +2 -2
  91. package/dist/{chunk-j9deswmn.js.map → chunk-fwympxqk.js.map} +1 -1
  92. package/dist/{chunk-5dwtmkk8.js → chunk-gqpge54c.js} +2 -2
  93. package/dist/{chunk-5dwtmkk8.js.map → chunk-gqpge54c.js.map} +1 -1
  94. package/dist/chunk-h2hdpm70.js +24 -0
  95. package/dist/{chunk-70e5fypb.js.map → chunk-h2hdpm70.js.map} +6 -5
  96. package/dist/{chunk-r5pnz4nn.js → chunk-h3t4n0bn.js} +2 -2
  97. package/dist/{chunk-r5pnz4nn.js.map → chunk-h3t4n0bn.js.map} +1 -1
  98. package/dist/{chunk-zm00crsx.js → chunk-h4x7cba0.js} +3 -3
  99. package/dist/{chunk-zm00crsx.js.map → chunk-h4x7cba0.js.map} +1 -1
  100. package/dist/{chunk-b0jpvp5t.js → chunk-h7pafjej.js} +3 -3
  101. package/dist/{chunk-b0jpvp5t.js.map → chunk-h7pafjej.js.map} +1 -1
  102. package/dist/{chunk-63hvh35x.js → chunk-hdhahvd4.js} +2 -2
  103. package/dist/{chunk-63hvh35x.js.map → chunk-hdhahvd4.js.map} +1 -1
  104. package/dist/{chunk-zytmxty5.js → chunk-hyfzw1fk.js} +2 -2
  105. package/dist/{chunk-zytmxty5.js.map → chunk-hyfzw1fk.js.map} +1 -1
  106. package/dist/{chunk-zmag8k0z.js → chunk-jnw73s8c.js} +2 -2
  107. package/dist/{chunk-zmag8k0z.js.map → chunk-jnw73s8c.js.map} +1 -1
  108. package/dist/{chunk-bsq80942.js → chunk-k17prwhx.js} +3 -3
  109. package/dist/{chunk-bsq80942.js.map → chunk-k17prwhx.js.map} +1 -1
  110. package/dist/{chunk-xxkk60aw.js → chunk-k9qmr2wa.js} +3 -3
  111. package/dist/{chunk-xxkk60aw.js.map → chunk-k9qmr2wa.js.map} +1 -1
  112. package/dist/chunk-kda25fn4.js +5 -0
  113. package/dist/chunk-kda25fn4.js.map +10 -0
  114. package/dist/{chunk-cw7qfcvt.js → chunk-kh273hj0.js} +2 -2
  115. package/dist/{chunk-cw7qfcvt.js.map → chunk-kh273hj0.js.map} +1 -1
  116. package/dist/{chunk-kwkbzswm.js → chunk-kqff894s.js} +2 -2
  117. package/dist/{chunk-kwkbzswm.js.map → chunk-kqff894s.js.map} +1 -1
  118. package/dist/{chunk-ma5rmcbe.js → chunk-kqz8jp6v.js} +2 -2
  119. package/dist/{chunk-ma5rmcbe.js.map → chunk-kqz8jp6v.js.map} +1 -1
  120. package/dist/{chunk-dtybftkq.js → chunk-kstvyvr0.js} +2 -2
  121. package/dist/{chunk-dtybftkq.js.map → chunk-kstvyvr0.js.map} +1 -1
  122. package/dist/{chunk-h945tg0r.js → chunk-m31pfz1s.js} +2 -2
  123. package/dist/{chunk-h945tg0r.js.map → chunk-m31pfz1s.js.map} +1 -1
  124. package/dist/{chunk-4p752vk2.js → chunk-mhq2bd9c.js} +3 -3
  125. package/dist/{chunk-4p752vk2.js.map → chunk-mhq2bd9c.js.map} +1 -1
  126. package/dist/chunk-mrvcaakf.js +5 -0
  127. package/dist/{chunk-f2n21fef.js.map → chunk-mrvcaakf.js.map} +1 -1
  128. package/dist/chunk-ncfxmtd5.js +17 -0
  129. package/dist/{chunk-48wh5mbp.js.map → chunk-ncfxmtd5.js.map} +13 -8
  130. package/dist/{chunk-ayss2f8c.js → chunk-njkk498k.js} +2 -2
  131. package/dist/{chunk-ayss2f8c.js.map → chunk-njkk498k.js.map} +1 -1
  132. package/dist/{chunk-hwc8gt4n.js → chunk-pj2e1p07.js} +2 -2
  133. package/dist/{chunk-hwc8gt4n.js.map → chunk-pj2e1p07.js.map} +1 -1
  134. package/dist/{chunk-5k3rm4b6.js → chunk-q2fyp44f.js} +2 -2
  135. package/dist/{chunk-5k3rm4b6.js.map → chunk-q2fyp44f.js.map} +1 -1
  136. package/dist/{chunk-53we503k.js → chunk-q7y9v2v5.js} +3 -3
  137. package/dist/{chunk-53we503k.js.map → chunk-q7y9v2v5.js.map} +1 -1
  138. package/dist/chunk-rh9j8cwv.js +9 -0
  139. package/dist/chunk-rh9j8cwv.js.map +31 -0
  140. package/dist/{chunk-sedwjgvf.js → chunk-rjernda5.js} +2 -2
  141. package/dist/{chunk-sedwjgvf.js.map → chunk-rjernda5.js.map} +1 -1
  142. package/dist/{chunk-2baxmae9.js → chunk-rn2kgbg4.js} +2 -2
  143. package/dist/{chunk-2baxmae9.js.map → chunk-rn2kgbg4.js.map} +1 -1
  144. package/dist/{chunk-8nkdvgd9.js → chunk-sbyqs03h.js} +2 -2
  145. package/dist/{chunk-8nkdvgd9.js.map → chunk-sbyqs03h.js.map} +1 -1
  146. package/dist/{chunk-wc46df4w.js → chunk-t26n9vzw.js} +2 -2
  147. package/dist/{chunk-wc46df4w.js.map → chunk-t26n9vzw.js.map} +1 -1
  148. package/dist/{chunk-8z37k28d.js → chunk-tvy2fqza.js} +2 -2
  149. package/dist/{chunk-8z37k28d.js.map → chunk-tvy2fqza.js.map} +1 -1
  150. package/dist/{chunk-zhk3z9zk.js → chunk-tyhrrnp5.js} +3 -3
  151. package/dist/{chunk-zhk3z9zk.js.map → chunk-tyhrrnp5.js.map} +1 -1
  152. package/dist/{chunk-vh1hxm9y.js → chunk-v52dyw0q.js} +3 -3
  153. package/dist/{chunk-vh1hxm9y.js.map → chunk-v52dyw0q.js.map} +1 -1
  154. package/dist/{chunk-p2jn4bnx.js → chunk-vj2t77x1.js} +2 -2
  155. package/dist/{chunk-p2jn4bnx.js.map → chunk-vj2t77x1.js.map} +1 -1
  156. package/dist/{chunk-mnctdd8r.js → chunk-we2sj339.js} +2 -2
  157. package/dist/{chunk-mnctdd8r.js.map → chunk-we2sj339.js.map} +1 -1
  158. package/dist/{chunk-szrgwggb.js → chunk-wedwkqe7.js} +3 -3
  159. package/dist/{chunk-szrgwggb.js.map → chunk-wedwkqe7.js.map} +1 -1
  160. package/dist/{chunk-pfjr510h.js → chunk-wsftnxzs.js} +2 -2
  161. package/dist/{chunk-pfjr510h.js.map → chunk-wsftnxzs.js.map} +1 -1
  162. package/dist/{chunk-62cv9vjt.js → chunk-wzqkdmjd.js} +2 -2
  163. package/dist/{chunk-62cv9vjt.js.map → chunk-wzqkdmjd.js.map} +1 -1
  164. package/dist/{chunk-rkre6bqc.js → chunk-xg9vye7c.js} +1 -1
  165. package/dist/{chunk-vqvdptx4.js → chunk-xpyhmg45.js} +2 -2
  166. package/dist/{chunk-vqvdptx4.js.map → chunk-xpyhmg45.js.map} +1 -1
  167. package/dist/{chunk-hzmnqe4x.js → chunk-ydkjf626.js} +2 -2
  168. package/dist/{chunk-hzmnqe4x.js.map → chunk-ydkjf626.js.map} +1 -1
  169. package/dist/{chunk-jfnhzza6.js → chunk-yebaheh7.js} +3 -3
  170. package/dist/{chunk-jfnhzza6.js.map → chunk-yebaheh7.js.map} +1 -1
  171. package/dist/{chunk-dyew1yf7.js → chunk-zrdbytx4.js} +2 -2
  172. package/dist/{chunk-dyew1yf7.js.map → chunk-zrdbytx4.js.map} +1 -1
  173. package/dist/client/ClientRouter.d.ts +2 -0
  174. package/dist/client/ClientRouter.d.ts.map +1 -1
  175. package/dist/client/index.js +4 -3
  176. package/dist/client/index.js.map +1 -1
  177. package/dist/config/index.js +1 -1
  178. package/dist/console/run.js +2 -2
  179. package/dist/console/run.js.map +1 -1
  180. package/dist/container/index.js +2 -2
  181. package/dist/container/index.js.map +1 -1
  182. package/dist/database/index.js +2 -2
  183. package/dist/database/index.js.map +1 -1
  184. package/dist/email/index.js +2 -2
  185. package/dist/email/index.js.map +1 -1
  186. package/dist/facades/index.js +2 -2
  187. package/dist/facades/index.js.map +1 -1
  188. package/dist/foundation/index.js +2 -2
  189. package/dist/foundation/index.js.map +1 -1
  190. package/dist/http/ApiRouter.d.ts.map +1 -1
  191. package/dist/http/BodyLimitMiddleware.d.ts +27 -0
  192. package/dist/http/BodyLimitMiddleware.d.ts.map +1 -0
  193. package/dist/http/HttpRequest.d.ts.map +1 -1
  194. package/dist/http/bodyLimit.d.ts +45 -0
  195. package/dist/http/bodyLimit.d.ts.map +1 -0
  196. package/dist/http/index.d.ts +3 -0
  197. package/dist/http/index.d.ts.map +1 -1
  198. package/dist/http/index.js +2 -2
  199. package/dist/http/index.js.map +1 -1
  200. package/dist/http/middleware-config.d.ts +8 -0
  201. package/dist/http/middleware-config.d.ts.map +1 -1
  202. package/dist/http/safeFetch/addresses.d.ts +60 -0
  203. package/dist/http/safeFetch/addresses.d.ts.map +1 -0
  204. package/dist/http/safeFetch/errors.d.ts +78 -0
  205. package/dist/http/safeFetch/errors.d.ts.map +1 -0
  206. package/dist/http/safeFetch/index.d.ts +4 -0
  207. package/dist/http/safeFetch/index.d.ts.map +1 -0
  208. package/dist/http/safeFetch/safeFetch.d.ts +82 -0
  209. package/dist/http/safeFetch/safeFetch.d.ts.map +1 -0
  210. package/dist/i18n/dictionaryRuntime.js +2 -2
  211. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  212. package/dist/i18n/index.js +2 -2
  213. package/dist/i18n/index.js.map +1 -1
  214. package/dist/kernel/index.js +2 -2
  215. package/dist/kernel/index.js.map +1 -1
  216. package/dist/orm/index.js +2 -2
  217. package/dist/orm/index.js.map +1 -1
  218. package/dist/server/httpProd.d.ts.map +1 -1
  219. package/dist/server/index.js +2 -2
  220. package/dist/server/index.js.map +1 -1
  221. package/dist/server/staticFile.d.ts +20 -1
  222. package/dist/server/staticFile.d.ts.map +1 -1
  223. package/dist/services/index.js +2 -2
  224. package/dist/services/index.js.map +1 -1
  225. package/dist/services/middleware/MiddlewareRegistry.d.ts +8 -0
  226. package/dist/services/middleware/MiddlewareRegistry.d.ts.map +1 -1
  227. package/dist/services/queue/work.js +2 -2
  228. package/dist/services/queue/work.js.map +1 -1
  229. package/dist/services/router/ApiRouteDispatcher.d.ts.map +1 -1
  230. package/dist/services/router/createComponentTree.d.ts.map +1 -1
  231. package/dist/support/index.js +2 -2
  232. package/dist/support/index.js.map +1 -1
  233. package/dist/vitest/index.d.ts +27 -0
  234. package/dist/vitest/index.d.ts.map +1 -0
  235. package/dist/vitest/index.js +4 -0
  236. package/dist/vitest/index.js.map +10 -0
  237. package/package.json +3 -2
  238. package/dist/chunk-3cxbvrts.js +0 -9
  239. package/dist/chunk-3cxbvrts.js.map +0 -31
  240. package/dist/chunk-48wh5mbp.js +0 -17
  241. package/dist/chunk-70e5fypb.js +0 -24
  242. package/dist/chunk-f2n21fef.js +0 -5
  243. package/dist/chunk-qxg2dnnr.js +0 -6
  244. /package/dist/{chunk-cbywzv21.js.map → chunk-2xqrh6d0.js.map} +0 -0
  245. /package/dist/{chunk-5ngv175h.js.map → chunk-anp4kv3w.js.map} +0 -0
  246. /package/dist/{chunk-rkre6bqc.js.map → chunk-xg9vye7c.js.map} +0 -0
@@ -0,0 +1,78 @@
1
+ import type { AddressRange } from "./addresses";
2
+ /**
3
+ * Every refusal and failure `safeFetch` throws is one of these, so an app can
4
+ * tell the user what went wrong in plain words (`error.code`) without parsing
5
+ * messages. An abort through the caller's own `signal` rethrows that signal's
6
+ * reason instead, as `fetch` does.
7
+ */
8
+ export declare class SafeFetchError extends Error {
9
+ readonly code: string;
10
+ /** The URL being fetched when it failed: the redirect hop, not the first URL. */
11
+ readonly url: string;
12
+ constructor(message: string, url: string, options?: {
13
+ cause?: unknown;
14
+ });
15
+ }
16
+ export type InvalidUrlReason = "malformed" | "scheme" | "credentials" | "port";
17
+ /** Not an absolute http(s) URL, has a username or password, or uses a port not allowed. */
18
+ export declare class InvalidUrlError extends SafeFetchError {
19
+ readonly reason: InvalidUrlReason;
20
+ readonly code = "invalid-url";
21
+ constructor(url: string, reason: InvalidUrlReason, message: string);
22
+ }
23
+ /** The host name is on `deny`, or `allow` is set and the host is not on it. */
24
+ export declare class BlockedHostError extends SafeFetchError {
25
+ readonly host: string;
26
+ readonly reason: "denied" | "not-allowed";
27
+ readonly code = "blocked-host";
28
+ constructor(url: string, host: string, reason: "denied" | "not-allowed");
29
+ }
30
+ /**
31
+ * The host is, or resolves to, an address that is not on the public internet
32
+ * (loopback, private, link-local, cloud metadata, …) or one matching `deny`.
33
+ */
34
+ export declare class BlockedAddressError extends SafeFetchError {
35
+ readonly host: string;
36
+ readonly address: string;
37
+ readonly range: AddressRange | "denied" | "not-allowed";
38
+ readonly code = "blocked-address";
39
+ constructor(url: string, host: string, address: string, range: AddressRange | "denied" | "not-allowed");
40
+ }
41
+ /** The host name did not resolve. */
42
+ export declare class DnsError extends SafeFetchError {
43
+ readonly host: string;
44
+ readonly code = "dns";
45
+ constructor(url: string, host: string, cause?: unknown);
46
+ }
47
+ /** `connectTimeout` (resolving and connecting) or `timeout` (the whole request, body included) ran out. */
48
+ export declare class TimeoutError extends SafeFetchError {
49
+ readonly phase: "connect" | "total";
50
+ readonly ms: number;
51
+ readonly code = "timeout";
52
+ constructor(url: string, phase: "connect" | "total", ms: number);
53
+ }
54
+ /** The response body is larger than `maxSize` bytes (decoded). */
55
+ export declare class TooLargeError extends SafeFetchError {
56
+ readonly limit: number;
57
+ readonly code = "too-large";
58
+ constructor(url: string, limit: number);
59
+ }
60
+ /** The response's content type is not one of `contentTypes`. */
61
+ export declare class ContentTypeError extends SafeFetchError {
62
+ readonly contentType: string | null;
63
+ readonly allowed: readonly string[];
64
+ readonly code = "content-type";
65
+ constructor(url: string, contentType: string | null, allowed: readonly string[]);
66
+ }
67
+ /** More than `maxRedirects` redirects. */
68
+ export declare class TooManyRedirectsError extends SafeFetchError {
69
+ readonly limit: number;
70
+ readonly code = "too-many-redirects";
71
+ constructor(url: string, limit: number);
72
+ }
73
+ /** The connection failed or broke (refused, reset, TLS, a malformed response). */
74
+ export declare class NetworkError extends SafeFetchError {
75
+ readonly code = "network";
76
+ constructor(url: string, cause: unknown);
77
+ }
78
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../http/safeFetch/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAgB;IACrC,iFAAiF;IACjF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;gBAET,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAKxE;AAED,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,QAAQ,GAAG,aAAa,GAAG,MAAM,CAAC;AAE/E,2FAA2F;AAC3F,qBAAa,eAAgB,SAAQ,cAAc;IAI/C,QAAQ,CAAC,MAAM,EAAE,gBAAgB;IAHnC,SAAkB,IAAI,iBAAiB;gBAErC,GAAG,EAAE,MAAM,EACF,MAAM,EAAE,gBAAgB,EACjC,OAAO,EAAE,MAAM;CAIlB;AAED,+EAA+E;AAC/E,qBAAa,gBAAiB,SAAQ,cAAc;IAIhD,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,MAAM,EAAE,QAAQ,GAAG,aAAa;IAJ3C,SAAkB,IAAI,kBAAkB;gBAEtC,GAAG,EAAE,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AM,EACF,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,OAAO,EAAE,SAAS,MAAM,EAAE;CAOtC;AAED,0CAA0C;AAC1C,qBAAa,qBAAsB,SAAQ,cAAc;IAIrD,QAAQ,CAAC,KAAK,EAAE,MAAM;IAHxB,SAAkB,IAAI,wBAAwB;gBAE5C,GAAG,EAAE,MAAM,EACF,KAAK,EAAE,MAAM;CAIzB;AAED,kFAAkF;AAClF,qBAAa,YAAa,SAAQ,cAAc;IAC9C,SAAkB,IAAI,aAAa;gBACvB,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAOxC"}
@@ -0,0 +1,4 @@
1
+ export { safeFetch, SafeResponse, type SafeFetchOptions } from "./safeFetch";
2
+ export { classifyAddress, type AddressRange, type Classification, } from "./addresses";
3
+ export { BlockedAddressError, BlockedHostError, ContentTypeError, DnsError, InvalidUrlError, NetworkError, SafeFetchError, TimeoutError, TooLargeError, TooManyRedirectsError, type InvalidUrlReason, } from "./errors";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../http/safeFetch/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,EACL,eAAe,EACf,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,QAAQ,EACR,eAAe,EACf,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,aAAa,EACb,qBAAqB,EACrB,KAAK,gBAAgB,GACtB,MAAM,UAAU,CAAC"}
@@ -0,0 +1,82 @@
1
+ export type SafeFetchOptions = {
2
+ method?: string;
3
+ headers?: HeadersInit;
4
+ /** Anything `fetch` takes as a body; it is read into memory before sending. */
5
+ body?: BodyInit | null;
6
+ /** Aborting it rejects (or errors the body stream) with the signal's reason. */
7
+ signal?: AbortSignal;
8
+ /** The whole request in ms: every redirect hop and reading the body. Default 30 000. */
9
+ timeout?: number;
10
+ /**
11
+ * Resolving and connecting (TCP and TLS), per hop, in ms. Default 10 000.
12
+ * On Bun before 1.4, whose node:http doesn't report the connection, it runs
13
+ * until the response headers arrive instead.
14
+ */
15
+ connectTimeout?: number;
16
+ /** Largest response body accepted, in bytes after decompression. Default 10 MiB. */
17
+ maxSize?: number;
18
+ /** Redirects followed before `TooManyRedirectsError`. Default 5. */
19
+ maxRedirects?: number;
20
+ /** `"manual"` returns a redirect response as it is, without following it. Default `"follow"`. */
21
+ redirect?: "follow" | "manual";
22
+ /**
23
+ * Media types the final response may have, e.g. `["text/html", "image/*"]`.
24
+ * Anything else rejects with `ContentTypeError` before the body is read.
25
+ */
26
+ contentTypes?: readonly string[];
27
+ /** Ports a URL may use. Default `[80, 443]`; `"any"` allows every port. */
28
+ ports?: readonly number[] | "any";
29
+ /**
30
+ * When set, only these may be reached: host names (`"example.com"`, or
31
+ * `"*.example.com"` for its subdomains) and IP ranges (`"203.0.113.0/24"`),
32
+ * which every address the host resolves to must be in. An allowed host is
33
+ * still refused when it resolves to a private address.
34
+ */
35
+ allow?: readonly string[];
36
+ /** Host names and IP ranges never reached, in the same notation as `allow`. Wins over `allow`. */
37
+ deny?: readonly string[];
38
+ /**
39
+ * Lets private, loopback and other non-public addresses through: `true` for
40
+ * all of them (tests, local development), or a list of ranges
41
+ * (`["10.20.0.0/16"]`) for an internal service. Never set it from user input.
42
+ */
43
+ allowPrivate?: boolean | readonly string[];
44
+ /**
45
+ * Resolves a host name to its addresses. Defaults to the system resolver
46
+ * (`dns.lookup`, so `/etc/hosts` applies). The connection is made to the
47
+ * addresses returned here, after they are checked; nothing resolves the
48
+ * name again.
49
+ */
50
+ resolve?: (hostname: string) => Promise<readonly string[]>;
51
+ };
52
+ /**
53
+ * The response of `safeFetch`: a standard `Response`, with `url` and
54
+ * `redirected` filled in as `fetch` does, and the address it connected to.
55
+ */
56
+ export declare class SafeResponse extends Response {
57
+ #private;
58
+ /**
59
+ * The IP address the response came from, or `null` when the runtime doesn't
60
+ * report it (Bun before 1.4).
61
+ */
62
+ readonly address: string | null;
63
+ constructor(body: ReadableStream<Uint8Array> | null, init: ResponseInit, meta: {
64
+ url: string;
65
+ redirected: boolean;
66
+ address: string | null;
67
+ });
68
+ get url(): string;
69
+ get redirected(): boolean;
70
+ }
71
+ /**
72
+ * `fetch` for URLs that come from users. It refuses anything but http(s) on
73
+ * the allowed ports, resolves the host itself, refuses non-public addresses,
74
+ * then connects to the address it checked (the host name is still sent as
75
+ * `Host` and TLS SNI, and the certificate is verified against it), so a DNS
76
+ * answer that changes between the check and the connection can't reach
77
+ * inside. Each redirect is checked the same way.
78
+ *
79
+ * Throws `SafeFetchError` subclasses; see `errors.ts`.
80
+ */
81
+ export declare function safeFetch(input: string | URL, options?: SafeFetchOptions): Promise<SafeResponse>;
82
+ //# sourceMappingURL=safeFetch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"safeFetch.d.ts","sourceRoot":"","sources":["../../../http/safeFetch/safeFetch.ts"],"names":[],"mappings":"AA+BA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;IACvB,gFAAgF;IAChF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,wFAAwF;IACxF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oFAAoF;IACpF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,oEAAoE;IACpE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iGAAiG;IACjG,QAAQ,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC/B;;;OAGG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,2EAA2E;IAC3E,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,GAAG,KAAK,CAAC;IAClC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,kGAAkG;IAClG,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB;;;;OAIG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAAC;IAC3C;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CAC5D,CAAC;AAEF;;;GAGG;AACH,qBAAa,YAAa,SAAQ,QAAQ;;IAGxC;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;gBAG9B,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,EACvC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE;IAQpE,IAAa,GAAG,WAEf;IAED,IAAa,UAAU,YAEtB;CACF;AAuCD;;;;;;;;;GASG;AACH,wBAAsB,SAAS,CAC7B,KAAK,EAAE,MAAM,GAAG,GAAG,EACnB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,YAAY,CAAC,CAiGvB"}
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{aa as y,ba as p}from"../chunk-sedwjgvf.js";import{qa as c,ra as d,ta as l}from"../chunk-9a8qz3s7.js";import{ng as e,og as i,qg as t,rg as r,sg as o,tg as n,ug as a,vg as s}from"../chunk-v4exgqbp.js";import"../chunk-1xzdexbq.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-rjernda5.js";import{sa as c,ta as d,va as l}from"../chunk-564zfdd1.js";import{Gg as e,Hg as i,Jg as t,Kg as r,Lg as o,Mg as n,Ng as a,Og as s}from"../chunk-47rgq59q.js";import"../chunk-3s3awh38.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=A01D4EB3CAF77D8864756E2164756E21
4
+ //# debugId=0F997A027EC9F95D64756E2164756E21
@@ -4,6 +4,6 @@
4
4
  "sourcesContent": [
5
5
  ],
6
6
  "mappings": "",
7
- "debugId": "A01D4EB3CAF77D8864756E2164756E21",
7
+ "debugId": "0F997A027EC9F95D64756E2164756E21",
8
8
  "names": []
9
9
  }
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{aa as w}from"../chunk-sedwjgvf.js";import"../chunk-9a8qz3s7.js";import{Wa as b}from"../chunk-f2n21fef.js";import{dc as R,ec as S}from"../chunk-zm00crsx.js";import"../chunk-7kedxtbp.js";import{Nc as j}from"../chunk-48wh5mbp.js";import"../chunk-b0jpvp5t.js";import"../chunk-22k4b395.js";import"../chunk-3cxbvrts.js";import"../chunk-j9deswmn.js";import"../chunk-ayss2f8c.js";import"../chunk-5dwtmkk8.js";import"../chunk-xxkk60aw.js";import"../chunk-fcsq613t.js";import"../chunk-v4exgqbp.js";import"../chunk-st0d3ndv.js";import{Eg as X,Fg as E,Gg as V,Hg as L}from"../chunk-4f7n1r02.js";import"../chunk-xnggfm0s.js";import"../chunk-0fney17e.js";import"../chunk-ma5rmcbe.js";import"../chunk-3m93v7bt.js";import"../chunk-1xzdexbq.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{S as translationConfigDefaults,N as translate,E as isValidTimeZone,R as defineTranslationConfig,w as defineDictionary,V as createFormatter,L as Translator,b as TranslationServiceProvider,P as Dictionary,X as DEFAULT_TIME_ZONE};
2
+ import{aa as w}from"../chunk-rjernda5.js";import"../chunk-564zfdd1.js";import{Ya as b}from"../chunk-mrvcaakf.js";import{fc as R,gc as S}from"../chunk-h4x7cba0.js";import"../chunk-9hbwvcxn.js";import{Rc as j}from"../chunk-ncfxmtd5.js";import"../chunk-h7pafjej.js";import"../chunk-1npdp1w2.js";import"../chunk-rh9j8cwv.js";import"../chunk-fwympxqk.js";import"../chunk-njkk498k.js";import"../chunk-gqpge54c.js";import"../chunk-5wt25tyd.js";import"../chunk-k9qmr2wa.js";import"../chunk-4rr9wmh8.js";import"../chunk-47rgq59q.js";import{Wg as X,Xg as E,Yg as V,Zg as L}from"../chunk-2q7m8a16.js";import"../chunk-9mqqr05d.js";import"../chunk-2gmgd05c.js";import"../chunk-kqz8jp6v.js";import"../chunk-82hpq0bq.js";import"../chunk-3s3awh38.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{S as translationConfigDefaults,N as translate,E as isValidTimeZone,R as defineTranslationConfig,w as defineDictionary,V as createFormatter,L as Translator,b as TranslationServiceProvider,P as Dictionary,X as DEFAULT_TIME_ZONE};
3
3
 
4
- //# debugId=6EBD0BD09D520AA564756E2164756E21
4
+ //# debugId=65B0DC47E3658F0F64756E2164756E21
@@ -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": ";w0BAAA,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,gCAAgC,EAElD,OAAO,OAAO,CAAc,EAI9B,GAAI,EACF,OAAQ,EAAK,YAAY,OAClB,SACH,OAAO,OAAO,CAAK,EAAE,SAAS,MAC3B,SACH,OAAO,OAAO,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AW,GAGzB,MAIC,CACC,KACG,EAGH,CACA,IAAQ,SAAS,EAAK,OAAO,EAAG,UAAW,CACzC,OAAQ,CAAC,KACN,EAAK,EACV,EAEA,GAAI,OAAO,OAAW,IACpB,MAAU,MAAM,kCAAkC,EAGpD,GAAI,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": "6EBD0BD09D520AA564756E2164756E21",
10
+ "debugId": "65B0DC47E3658F0F64756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ya as y}from"../chunk-jfnhzza6.js";import{Va as i}from"../chunk-bsq80942.js";import{Wa as g}from"../chunk-f2n21fef.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-k6rd1nd4.js";import"../chunk-wc46df4w.js";import"../chunk-b1dqx3b9.js";import{_b as r}from"../chunk-18aqqrev.js";import"../chunk-zm00crsx.js";import"../chunk-7kedxtbp.js";import{Ad as C,Bd as m,Cd as Q,Dd as t,Ed as o,Gc as Zj,Hc as $j,Kc as Gj,Lc as Hj,od as x,td as I,ud as E,xd as K,yd as M,zd as s}from"../chunk-48wh5mbp.js";import{Pd as a}from"../chunk-b0jpvp5t.js";import{ae as V,fe as f}from"../chunk-22k4b395.js";import{gf as F}from"../chunk-3cxbvrts.js";import{zf as B}from"../chunk-j9deswmn.js";import{Ff as L}from"../chunk-ayss2f8c.js";import"../chunk-5dwtmkk8.js";import"../chunk-xxkk60aw.js";import"../chunk-fcsq613t.js";import"../chunk-v4exgqbp.js";import"../chunk-st0d3ndv.js";import"../chunk-zhk3z9zk.js";import"../chunk-4f7n1r02.js";import{Ig as _,Kg as N,Lg as b}from"../chunk-xnggfm0s.js";import"../chunk-0fney17e.js";import"../chunk-yxh4xs3k.js";import"../chunk-ma5rmcbe.js";import{Yg as q}from"../chunk-3m93v7bt.js";import"../chunk-1xzdexbq.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{Aa as y}from"../chunk-yebaheh7.js";import{Xa as i}from"../chunk-k17prwhx.js";import{Ya as g}from"../chunk-mrvcaakf.js";import{$a as T,Ab as n,ab as D,bb as e,cb as A,db as w,hb as P,ib as S,kb as h,lb as R,mb as u,nb as l,qb as v,rb as d,ub as c,xb as p}from"../chunk-2mhx4e4g.js";import"../chunk-t26n9vzw.js";import"../chunk-ftgd68se.js";import{ac as r}from"../chunk-6wrhc9bq.js";import"../chunk-h4x7cba0.js";import"../chunk-9hbwvcxn.js";import{Cd as K,Dd as M,Ed as s,Fd as C,Gd as m,Hd as Q,Id as t,Jd as o,Kc as Zj,Lc as $j,Oc as Gj,Pc as Hj,td as x,yd as I,zd as E}from"../chunk-ncfxmtd5.js";import{fe as a}from"../chunk-h7pafjej.js";import{se as V,xe as f}from"../chunk-1npdp1w2.js";import{yf as F}from"../chunk-rh9j8cwv.js";import{Rf as B}from"../chunk-fwympxqk.js";import{Xf as L}from"../chunk-njkk498k.js";import"../chunk-gqpge54c.js";import"../chunk-5wt25tyd.js";import"../chunk-k9qmr2wa.js";import"../chunk-4rr9wmh8.js";import"../chunk-47rgq59q.js";import"../chunk-tyhrrnp5.js";import"../chunk-2q7m8a16.js";import{_g as _,ah as N,bh as b}from"../chunk-9mqqr05d.js";import"../chunk-2gmgd05c.js";import"../chunk-6rz8kyqb.js";import"../chunk-kqz8jp6v.js";import{oh as q}from"../chunk-82hpq0bq.js";import"../chunk-3s3awh38.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-jfnhzza6.js";import{Va as i}from"../chunk-bsq80942.
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=6D1A9BD62F3E579364756E2164756E21
16
+ //# debugId=876FC2903CB5D03C64756E2164756E21
@@ -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 {\\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"
8
8
  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