gemi 0.209.0 → 0.210.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (238) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/ai/index.js.map +1 -1
  3. package/dist/ai/testing/index.js +2 -2
  4. package/dist/ai/testing/index.js.map +1 -1
  5. package/dist/app/index.js +1 -1
  6. package/dist/bun/plugin.js +1 -1
  7. package/dist/bun/preload.js +1 -1
  8. package/dist/{chunk-zzs96hc8.js → chunk-0exm7bsw.js} +2 -2
  9. package/dist/{chunk-zzs96hc8.js.map → chunk-0exm7bsw.js.map} +1 -1
  10. package/dist/{chunk-kax9ghny.js → chunk-0nzz7ftq.js} +2 -2
  11. package/dist/{chunk-kax9ghny.js.map → chunk-0nzz7ftq.js.map} +1 -1
  12. package/dist/{chunk-arzp5dne.js → chunk-18v3qyzp.js} +2 -2
  13. package/dist/{chunk-arzp5dne.js.map → chunk-18v3qyzp.js.map} +1 -1
  14. package/dist/{chunk-p608rrfc.js → chunk-24mk3gn3.js} +3 -3
  15. package/dist/{chunk-p608rrfc.js.map → chunk-24mk3gn3.js.map} +1 -1
  16. package/dist/{chunk-t9gc6mhq.js → chunk-2swfxn2c.js} +2 -2
  17. package/dist/{chunk-t9gc6mhq.js.map → chunk-2swfxn2c.js.map} +1 -1
  18. package/dist/chunk-2x8e3j7j.js +10 -0
  19. package/dist/{chunk-rffpqhn8.js.map → chunk-2x8e3j7j.js.map} +3 -3
  20. package/dist/{chunk-yn3pf1fp.js → chunk-3c45f8f3.js} +2 -2
  21. package/dist/{chunk-yn3pf1fp.js.map → chunk-3c45f8f3.js.map} +1 -1
  22. package/dist/{chunk-2jbdbvd8.js → chunk-3r8zkpes.js} +2 -2
  23. package/dist/{chunk-2jbdbvd8.js.map → chunk-3r8zkpes.js.map} +1 -1
  24. package/dist/{chunk-yzbj11dd.js → chunk-4g7n30zy.js} +2 -2
  25. package/dist/{chunk-yzbj11dd.js.map → chunk-4g7n30zy.js.map} +1 -1
  26. package/dist/{chunk-h1f4f9wx.js → chunk-56z4jd8t.js} +2 -2
  27. package/dist/{chunk-h1f4f9wx.js.map → chunk-56z4jd8t.js.map} +1 -1
  28. package/dist/{chunk-dje6exhs.js → chunk-5ncc9tn6.js} +2 -2
  29. package/dist/{chunk-dje6exhs.js.map → chunk-5ncc9tn6.js.map} +1 -1
  30. package/dist/{chunk-vrpsgq3x.js → chunk-5ra8x6ax.js} +2 -2
  31. package/dist/{chunk-vrpsgq3x.js.map → chunk-5ra8x6ax.js.map} +1 -1
  32. package/dist/{chunk-wy87gc0b.js → chunk-6d807fgx.js} +3 -3
  33. package/dist/{chunk-wy87gc0b.js.map → chunk-6d807fgx.js.map} +1 -1
  34. package/dist/{chunk-kbkyde5f.js → chunk-6f11bb3s.js} +2 -2
  35. package/dist/{chunk-kbkyde5f.js.map → chunk-6f11bb3s.js.map} +1 -1
  36. package/dist/{chunk-szaq0f6n.js → chunk-6hkwvezk.js} +2 -2
  37. package/dist/{chunk-szaq0f6n.js.map → chunk-6hkwvezk.js.map} +1 -1
  38. package/dist/{chunk-716832vw.js → chunk-6wrk51tb.js} +2 -2
  39. package/dist/{chunk-716832vw.js.map → chunk-6wrk51tb.js.map} +1 -1
  40. package/dist/{chunk-r5ggnywk.js → chunk-768yza4f.js} +2 -2
  41. package/dist/{chunk-r5ggnywk.js.map → chunk-768yza4f.js.map} +1 -1
  42. package/dist/{chunk-fv6ncgbc.js → chunk-7m20yym1.js} +2 -2
  43. package/dist/{chunk-fv6ncgbc.js.map → chunk-7m20yym1.js.map} +1 -1
  44. package/dist/{chunk-9qyedsvw.js → chunk-8wxt3v9r.js} +3 -3
  45. package/dist/{chunk-9qyedsvw.js.map → chunk-8wxt3v9r.js.map} +1 -1
  46. package/dist/{chunk-y16vp7yf.js → chunk-9a3wbbr6.js} +2 -2
  47. package/dist/{chunk-y16vp7yf.js.map → chunk-9a3wbbr6.js.map} +1 -1
  48. package/dist/{chunk-efskg8cp.js → chunk-9cjmtx61.js} +2 -2
  49. package/dist/{chunk-efskg8cp.js.map → chunk-9cjmtx61.js.map} +1 -1
  50. package/dist/{chunk-ntcj2sgv.js → chunk-a7svhrg6.js} +3 -3
  51. package/dist/{chunk-ntcj2sgv.js.map → chunk-a7svhrg6.js.map} +1 -1
  52. package/dist/{chunk-bhc9vk13.js → chunk-akh97aw9.js} +1 -1
  53. package/dist/{chunk-9d8tz60r.js → chunk-as9cs2bk.js} +1 -1
  54. package/dist/{chunk-hmccxtd3.js → chunk-axgpe682.js} +2 -2
  55. package/dist/{chunk-hmccxtd3.js.map → chunk-axgpe682.js.map} +1 -1
  56. package/dist/{chunk-fsae9dgb.js → chunk-b5v00jn8.js} +2 -2
  57. package/dist/{chunk-fsae9dgb.js.map → chunk-b5v00jn8.js.map} +1 -1
  58. package/dist/{chunk-wcpqn1pg.js → chunk-b9q72ssw.js} +2 -2
  59. package/dist/{chunk-wcpqn1pg.js.map → chunk-b9q72ssw.js.map} +1 -1
  60. package/dist/{chunk-rhyhxgxg.js → chunk-bf4wqp2f.js} +2 -2
  61. package/dist/{chunk-rhyhxgxg.js.map → chunk-bf4wqp2f.js.map} +1 -1
  62. package/dist/{chunk-v10kckwp.js → chunk-bxtv9am0.js} +4 -4
  63. package/dist/{chunk-v10kckwp.js.map → chunk-bxtv9am0.js.map} +1 -1
  64. package/dist/{chunk-bdzj9znx.js → chunk-c94zdk4r.js} +3 -3
  65. package/dist/{chunk-bdzj9znx.js.map → chunk-c94zdk4r.js.map} +1 -1
  66. package/dist/{chunk-641fns6j.js → chunk-cdt888qf.js} +2 -2
  67. package/dist/{chunk-641fns6j.js.map → chunk-cdt888qf.js.map} +1 -1
  68. package/dist/{chunk-094hbhc8.js → chunk-cgjdxxwy.js} +2 -2
  69. package/dist/{chunk-094hbhc8.js.map → chunk-cgjdxxwy.js.map} +1 -1
  70. package/dist/{chunk-cfbhhfkv.js → chunk-d675g712.js} +3 -3
  71. package/dist/{chunk-cfbhhfkv.js.map → chunk-d675g712.js.map} +1 -1
  72. package/dist/{chunk-tjfvkzq8.js → chunk-d79zfm40.js} +1 -1
  73. package/dist/{chunk-xt90xbes.js → chunk-d8nxkc90.js} +2 -2
  74. package/dist/{chunk-xt90xbes.js.map → chunk-d8nxkc90.js.map} +1 -1
  75. package/dist/{chunk-ewhgsw1n.js → chunk-dp8nmks0.js} +2 -2
  76. package/dist/{chunk-ewhgsw1n.js.map → chunk-dp8nmks0.js.map} +1 -1
  77. package/dist/{chunk-q634cwbc.js → chunk-ds5adkcf.js} +3 -3
  78. package/dist/{chunk-q634cwbc.js.map → chunk-ds5adkcf.js.map} +1 -1
  79. package/dist/{chunk-jggtz103.js → chunk-f1jq1mp9.js} +2 -2
  80. package/dist/{chunk-jggtz103.js.map → chunk-f1jq1mp9.js.map} +1 -1
  81. package/dist/{chunk-ad0dx73f.js → chunk-f7bayqs7.js} +2 -2
  82. package/dist/{chunk-ad0dx73f.js.map → chunk-f7bayqs7.js.map} +1 -1
  83. package/dist/{chunk-zcx8n3mk.js → chunk-frjavybg.js} +2 -2
  84. package/dist/{chunk-zcx8n3mk.js.map → chunk-frjavybg.js.map} +1 -1
  85. package/dist/{chunk-zv6a6w1v.js → chunk-fypj6z8t.js} +2 -2
  86. package/dist/{chunk-zv6a6w1v.js.map → chunk-fypj6z8t.js.map} +1 -1
  87. package/dist/{chunk-mxedsqbe.js → chunk-g6z6shvz.js} +3 -3
  88. package/dist/{chunk-mxedsqbe.js.map → chunk-g6z6shvz.js.map} +1 -1
  89. package/dist/{chunk-b51a77kv.js → chunk-gg4q59q1.js} +2 -2
  90. package/dist/{chunk-b51a77kv.js.map → chunk-gg4q59q1.js.map} +1 -1
  91. package/dist/{chunk-101rvvje.js → chunk-gk2k76tn.js} +3 -3
  92. package/dist/{chunk-101rvvje.js.map → chunk-gk2k76tn.js.map} +1 -1
  93. package/dist/{chunk-t0xfzpfa.js → chunk-h4rmpnkv.js} +2 -2
  94. package/dist/{chunk-t0xfzpfa.js.map → chunk-h4rmpnkv.js.map} +1 -1
  95. package/dist/{chunk-12gthjxx.js → chunk-hchyarr4.js} +1 -1
  96. package/dist/{chunk-2k438dp6.js → chunk-j72wr9ck.js} +2 -2
  97. package/dist/{chunk-2k438dp6.js.map → chunk-j72wr9ck.js.map} +1 -1
  98. package/dist/{chunk-p27ft91c.js → chunk-jcsm6g58.js} +1 -1
  99. package/dist/{chunk-q7x7ddw0.js → chunk-jp0d4qhn.js} +2 -2
  100. package/dist/{chunk-q7x7ddw0.js.map → chunk-jp0d4qhn.js.map} +1 -1
  101. package/dist/{chunk-n0sbg84n.js → chunk-jzspg75a.js} +2 -2
  102. package/dist/{chunk-n0sbg84n.js.map → chunk-jzspg75a.js.map} +1 -1
  103. package/dist/chunk-kpww16c7.js +5 -0
  104. package/dist/{chunk-pag82mxh.js.map → chunk-kpww16c7.js.map} +1 -1
  105. package/dist/{chunk-1vnbw1d8.js → chunk-kwvx36xw.js} +2 -2
  106. package/dist/{chunk-1vnbw1d8.js.map → chunk-kwvx36xw.js.map} +1 -1
  107. package/dist/{chunk-w92n83g2.js → chunk-m4wagwhr.js} +2 -2
  108. package/dist/{chunk-w92n83g2.js.map → chunk-m4wagwhr.js.map} +1 -1
  109. package/dist/{chunk-n65hk6bq.js → chunk-mcqzgyvf.js} +2 -2
  110. package/dist/{chunk-n65hk6bq.js.map → chunk-mcqzgyvf.js.map} +1 -1
  111. package/dist/{chunk-dm6tkkwv.js → chunk-n5zq7ckd.js} +2 -2
  112. package/dist/{chunk-dm6tkkwv.js.map → chunk-n5zq7ckd.js.map} +1 -1
  113. package/dist/{chunk-tj8wbxyz.js → chunk-njfbfx3k.js} +2 -2
  114. package/dist/{chunk-tj8wbxyz.js.map → chunk-njfbfx3k.js.map} +1 -1
  115. package/dist/{chunk-hbdqv48k.js → chunk-pce2vqtc.js} +2 -2
  116. package/dist/{chunk-hbdqv48k.js.map → chunk-pce2vqtc.js.map} +1 -1
  117. package/dist/{chunk-b1y54j6v.js → chunk-pmyw9t15.js} +2 -2
  118. package/dist/{chunk-b1y54j6v.js.map → chunk-pmyw9t15.js.map} +1 -1
  119. package/dist/{chunk-mtf5kzza.js → chunk-q34hyv6y.js} +2 -2
  120. package/dist/{chunk-mtf5kzza.js.map → chunk-q34hyv6y.js.map} +1 -1
  121. package/dist/{chunk-3rgf7rsy.js → chunk-qsf3t0rc.js} +3 -3
  122. package/dist/{chunk-3rgf7rsy.js.map → chunk-qsf3t0rc.js.map} +1 -1
  123. package/dist/{chunk-a76a7869.js → chunk-qymdnzpy.js} +2 -2
  124. package/dist/{chunk-a76a7869.js.map → chunk-qymdnzpy.js.map} +1 -1
  125. package/dist/chunk-r6e5jwjm.js +117 -0
  126. package/dist/{chunk-24z18t5q.js.map → chunk-r6e5jwjm.js.map} +8 -7
  127. package/dist/{chunk-wkh9xcdq.js → chunk-rarqef1m.js} +2 -2
  128. package/dist/{chunk-wkh9xcdq.js.map → chunk-rarqef1m.js.map} +1 -1
  129. package/dist/{chunk-3raywsbj.js → chunk-rs3krbw9.js} +2 -2
  130. package/dist/{chunk-3raywsbj.js.map → chunk-rs3krbw9.js.map} +1 -1
  131. package/dist/{chunk-agrr8f8y.js → chunk-rzmngbn5.js} +2 -2
  132. package/dist/{chunk-agrr8f8y.js.map → chunk-rzmngbn5.js.map} +1 -1
  133. package/dist/{chunk-8ty6yp6r.js → chunk-s158qvjg.js} +3 -3
  134. package/dist/{chunk-8ty6yp6r.js.map → chunk-s158qvjg.js.map} +1 -1
  135. package/dist/{chunk-h4byt0x3.js → chunk-sgqfg5gg.js} +2 -2
  136. package/dist/{chunk-h4byt0x3.js.map → chunk-sgqfg5gg.js.map} +1 -1
  137. package/dist/{chunk-enq03rgh.js → chunk-sry4r3kf.js} +2 -2
  138. package/dist/{chunk-enq03rgh.js.map → chunk-sry4r3kf.js.map} +1 -1
  139. package/dist/{chunk-zrqzxc50.js → chunk-t3vgqv9a.js} +2 -2
  140. package/dist/{chunk-zrqzxc50.js.map → chunk-t3vgqv9a.js.map} +1 -1
  141. package/dist/{chunk-3wsmgdcr.js → chunk-t8ghxzva.js} +3 -3
  142. package/dist/{chunk-3wsmgdcr.js.map → chunk-t8ghxzva.js.map} +1 -1
  143. package/dist/{chunk-jr9y6k90.js → chunk-vj9f634z.js} +1 -1
  144. package/dist/{chunk-achvynaf.js → chunk-wfpvsgfy.js} +2 -2
  145. package/dist/{chunk-achvynaf.js.map → chunk-wfpvsgfy.js.map} +1 -1
  146. package/dist/{chunk-1agwddws.js → chunk-xdrnzs3t.js} +2 -2
  147. package/dist/{chunk-1agwddws.js.map → chunk-xdrnzs3t.js.map} +1 -1
  148. package/dist/{chunk-8gyq2etb.js → chunk-y10tys3s.js} +2 -2
  149. package/dist/{chunk-8gyq2etb.js.map → chunk-y10tys3s.js.map} +1 -1
  150. package/dist/{chunk-7fr265wp.js → chunk-ybdmkzb9.js} +2 -2
  151. package/dist/{chunk-7fr265wp.js.map → chunk-ybdmkzb9.js.map} +1 -1
  152. package/dist/{chunk-raejxs3y.js → chunk-z0c08ete.js} +2 -2
  153. package/dist/{chunk-raejxs3y.js.map → chunk-z0c08ete.js.map} +1 -1
  154. package/dist/{chunk-6zcqa5fz.js → chunk-z7r6td69.js} +2 -2
  155. package/dist/{chunk-6zcqa5fz.js.map → chunk-z7r6td69.js.map} +1 -1
  156. package/dist/{chunk-qc7x8q1q.js → chunk-zbm7njvf.js} +2 -2
  157. package/dist/{chunk-qc7x8q1q.js.map → chunk-zbm7njvf.js.map} +1 -1
  158. package/dist/chunks/{RealtimeClient-CmGMu3vA.js → RealtimeClient-CuTFz0v1.js} +2 -2
  159. package/dist/chunks/{RealtimeClient-CmGMu3vA.js.map → RealtimeClient-CuTFz0v1.js.map} +1 -1
  160. package/dist/chunks/{ThemeProvider-Cd7Ioorg.js → ThemeProvider-BO3sQkWl.js} +185 -9
  161. package/dist/chunks/ThemeProvider-BO3sQkWl.js.map +1 -0
  162. package/dist/chunks/{fetchFileRequest-VDh0ivL-.js → fetchFileRequest-CrKd0rD5.js} +2 -2
  163. package/dist/chunks/{fetchFileRequest-VDh0ivL-.js.map → fetchFileRequest-CrKd0rD5.js.map} +1 -1
  164. package/dist/chunks/{live-DAt2MPE2.js → live-BCCfTb28.js} +3 -3
  165. package/dist/chunks/{live-DAt2MPE2.js.map → live-BCCfTb28.js.map} +1 -1
  166. package/dist/chunks/{mutationExtras-CodkSO_f.js → mutationExtras-cPXZS6Hf.js} +2 -2
  167. package/dist/chunks/{mutationExtras-CodkSO_f.js.map → mutationExtras-cPXZS6Hf.js.map} +1 -1
  168. package/dist/chunks/{subscriptionStream-CotXoVnq.js → subscriptionStream-CRrAISl8.js} +2 -2
  169. package/dist/chunks/{subscriptionStream-CotXoVnq.js.map → subscriptionStream-CRrAISl8.js.map} +1 -1
  170. package/dist/client/Mutation.d.ts +7 -0
  171. package/dist/client/Mutation.d.ts.map +1 -1
  172. package/dist/client/QueryManagerContext.d.ts +12 -0
  173. package/dist/client/QueryManagerContext.d.ts.map +1 -1
  174. package/dist/client/QueryResource.d.ts +54 -0
  175. package/dist/client/QueryResource.d.ts.map +1 -1
  176. package/dist/client/index.d.ts +1 -0
  177. package/dist/client/index.d.ts.map +1 -1
  178. package/dist/client/index.js +54 -13
  179. package/dist/client/index.js.map +1 -1
  180. package/dist/client/queryEffects.d.ts +5 -1
  181. package/dist/client/queryEffects.d.ts.map +1 -1
  182. package/dist/client/requestTimeout.d.ts +29 -0
  183. package/dist/client/requestTimeout.d.ts.map +1 -0
  184. package/dist/client/useMutation.d.ts +8 -1
  185. package/dist/client/useMutation.d.ts.map +1 -1
  186. package/dist/client/useQuery.d.ts +15 -0
  187. package/dist/client/useQuery.d.ts.map +1 -1
  188. package/dist/config/index.js +1 -1
  189. package/dist/console/run.js +2 -2
  190. package/dist/console/run.js.map +1 -1
  191. package/dist/container/index.js +2 -2
  192. package/dist/container/index.js.map +1 -1
  193. package/dist/database/index.js +2 -2
  194. package/dist/database/index.js.map +1 -1
  195. package/dist/email/index.js +2 -2
  196. package/dist/email/index.js.map +1 -1
  197. package/dist/facades/index.js +2 -2
  198. package/dist/facades/index.js.map +1 -1
  199. package/dist/foundation/index.js +2 -2
  200. package/dist/foundation/index.js.map +1 -1
  201. package/dist/http/index.js +2 -2
  202. package/dist/http/index.js.map +1 -1
  203. package/dist/i18n/dictionaryRuntime.js +2 -2
  204. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  205. package/dist/i18n/index.js +2 -2
  206. package/dist/i18n/index.js.map +1 -1
  207. package/dist/kernel/index.js +2 -2
  208. package/dist/kernel/index.js.map +1 -1
  209. package/dist/orm/index.js +2 -2
  210. package/dist/orm/index.js.map +1 -1
  211. package/dist/probe/index.js +2 -2
  212. package/dist/probe/index.js.map +1 -1
  213. package/dist/server/index.js +2 -2
  214. package/dist/server/index.js.map +1 -1
  215. package/dist/services/index.js +2 -2
  216. package/dist/services/index.js.map +1 -1
  217. package/dist/services/queue/work.js +2 -2
  218. package/dist/services/queue/work.js.map +1 -1
  219. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  220. package/dist/services/router/globalMiddleware.d.ts.map +1 -1
  221. package/dist/services/router/matchViewRoute.d.ts +8 -0
  222. package/dist/services/router/matchViewRoute.d.ts.map +1 -1
  223. package/dist/stats/route-table.js +1 -1
  224. package/dist/support/index.js +2 -2
  225. package/dist/support/index.js.map +1 -1
  226. package/dist/testing/index.js +2 -2
  227. package/dist/vitest/index.js +1 -1
  228. package/package.json +1 -1
  229. package/dist/chunk-24z18t5q.js +0 -117
  230. package/dist/chunk-pag82mxh.js +0 -5
  231. package/dist/chunk-rffpqhn8.js +0 -10
  232. package/dist/chunks/ThemeProvider-Cd7Ioorg.js.map +0 -1
  233. /package/dist/{chunk-bhc9vk13.js.map → chunk-akh97aw9.js.map} +0 -0
  234. /package/dist/{chunk-9d8tz60r.js.map → chunk-as9cs2bk.js.map} +0 -0
  235. /package/dist/{chunk-tjfvkzq8.js.map → chunk-d79zfm40.js.map} +0 -0
  236. /package/dist/{chunk-12gthjxx.js.map → chunk-hchyarr4.js.map} +0 -0
  237. /package/dist/{chunk-p27ft91c.js.map → chunk-jcsm6g58.js.map} +0 -0
  238. /package/dist/{chunk-jr9y6k90.js.map → chunk-vj9f634z.js.map} +0 -0
@@ -338,6 +338,65 @@ async function confirm(first) {
338
338
  }
339
339
  }
340
340
  //#endregion
341
+ //#region client/requestTimeout.ts
342
+ /**
343
+ * What a query or mutation fails with when its `timeout` passed before the
344
+ * answer (headers and body) arrived. The request is aborted. For a query it
345
+ * is a network failure like any other: `isRetryableQueryError` is `true`, so
346
+ * `retry` retries it.
347
+ */
348
+ var RequestTimeoutError = class extends Error {
349
+ url;
350
+ timeout;
351
+ constructor(url, timeout) {
352
+ super(`Request to ${url} timed out after ${timeout}ms`);
353
+ this.url = url;
354
+ this.timeout = timeout;
355
+ this.name = "TimeoutError";
356
+ }
357
+ };
358
+ /**
359
+ * Abort `controller` once `timeout` ms have passed. No timer for an unset,
360
+ * zero, negative or non-finite timeout. `timedOut()` tells the caller's
361
+ * `catch` that the abort was this timer, not a cancel; `clear()` runs once
362
+ * the request settles.
363
+ *
364
+ * `tighten(timeout)` gives the request already on the wire a timeout from
365
+ * now, when that ends sooner than the one it has (otherwise it changes
366
+ * nothing): a request is never aborted at once, however long it has already
367
+ * waited. `timeout()` is the one in force.
368
+ */
369
+ function startRequestTimeout(controller, timeout) {
370
+ let timedOut = false;
371
+ let settled = false;
372
+ let current;
373
+ let deadline = Infinity;
374
+ let timer = null;
375
+ const tighten = (next) => {
376
+ if (!controller || settled) return;
377
+ if (typeof next !== "number" || !(next > 0) || !Number.isFinite(next)) return;
378
+ const now = Date.now();
379
+ if (now + next >= deadline) return;
380
+ current = next;
381
+ deadline = now + next;
382
+ if (timer !== null) clearTimeout(timer);
383
+ timer = setTimeout(() => {
384
+ timedOut = true;
385
+ controller.abort();
386
+ }, next);
387
+ };
388
+ tighten(timeout);
389
+ return {
390
+ timedOut: () => timedOut,
391
+ timeout: () => current,
392
+ tighten,
393
+ clear: () => {
394
+ settled = true;
395
+ if (timer !== null) clearTimeout(timer);
396
+ }
397
+ };
398
+ }
399
+ //#endregion
341
400
  //#region client/QueryResource.ts
342
401
  var DEFAULT_STALE_TIME = 5e3;
343
402
  var MAX_TIMEOUT = 2 ** 31 - 1;
@@ -406,6 +465,22 @@ var QueryResource = class {
406
465
  * `peekForHydration`.
407
466
  */
408
467
  streamed = /* @__PURE__ */ new Set();
468
+ /**
469
+ * The `timeout` of each mounted reader of a variant, in ms, one entry per
470
+ * `holdRequestTimeout`. A request gets the smallest one; a variant whose
471
+ * readers set none waits for the answer as long as the browser does.
472
+ */
473
+ timeouts = /* @__PURE__ */ new Map();
474
+ /**
475
+ * Timeouts set by readers rendering right now (`setRequestTimeout`), so a
476
+ * request a render starts gets its reader's timeout before that reader has
477
+ * mounted. Dropped at the end of the task: by then a reader that committed
478
+ * holds its timeout, and one whose render was thrown away has no say.
479
+ */
480
+ renderTimeouts = /* @__PURE__ */ new Map();
481
+ renderTimeoutsClearing = false;
482
+ /** The timeout timer of every request on the wire, per variant. */
483
+ requestTimers = /* @__PURE__ */ new Map();
409
484
  constructor(key, initialState) {
410
485
  this.key = key;
411
486
  this.store = new Subject(/* @__PURE__ */ new Map());
@@ -484,6 +559,63 @@ var QueryResource = class {
484
559
  peekForHydration(variantKey) {
485
560
  return this.streamed.has(variantKey) ? void 0 : this.peek(variantKey);
486
561
  }
562
+ /**
563
+ * A rendering reader's `timeout`, for the requests its own render starts.
564
+ * A request past its timeout is aborted and fails with a
565
+ * `RequestTimeoutError`, which the retry policy treats as a network
566
+ * failure. `undefined` (or `0`) means the reader has no timeout, which
567
+ * never removes another reader's. Lasts until the end of the task; a
568
+ * mounted reader keeps it with `holdRequestTimeout`.
569
+ */
570
+ setRequestTimeout(variantKey, timeout) {
571
+ if (!isTimeout(timeout)) return;
572
+ this.tightenInflight(variantKey, timeout);
573
+ const current = this.renderTimeouts.get(variantKey);
574
+ if (current === void 0 || timeout < current) this.renderTimeouts.set(variantKey, timeout);
575
+ if (this.renderTimeoutsClearing) return;
576
+ this.renderTimeoutsClearing = true;
577
+ Promise.resolve().then(() => {
578
+ this.renderTimeoutsClearing = false;
579
+ this.renderTimeouts.clear();
580
+ });
581
+ }
582
+ /**
583
+ * A mounted reader's `timeout` for this variant, until the returned release
584
+ * runs. Every request of the variant gets the smallest timeout its mounted
585
+ * readers hold; a reader without one (`undefined` or `0`) holds nothing.
586
+ */
587
+ holdRequestTimeout(variantKey, timeout) {
588
+ if (!isTimeout(timeout)) return () => {};
589
+ this.tightenInflight(variantKey, timeout);
590
+ const reader = {};
591
+ let held = this.timeouts.get(variantKey);
592
+ if (!held) {
593
+ held = /* @__PURE__ */ new Map();
594
+ this.timeouts.set(variantKey, held);
595
+ }
596
+ held.set(reader, timeout);
597
+ return () => {
598
+ const current = this.timeouts.get(variantKey);
599
+ if (!current) return;
600
+ current.delete(reader);
601
+ if (current.size === 0) this.timeouts.delete(variantKey);
602
+ };
603
+ }
604
+ /**
605
+ * A reader with a smaller timeout than the requests already on the wire —
606
+ * e.g. it rendered after the reader whose render sent the request — has
607
+ * them time out by its timeout too, counted from now, so render order
608
+ * never decides it.
609
+ */
610
+ tightenInflight(variantKey, timeout) {
611
+ for (const timer of this.requestTimers.get(variantKey) ?? []) timer.tighten(timeout);
612
+ }
613
+ /** The timeout the next request of this variant gets, if any. */
614
+ requestTimeout(variantKey) {
615
+ let smallest = this.renderTimeouts.get(variantKey);
616
+ for (const timeout of this.timeouts.get(variantKey)?.values() ?? []) if (smallest === void 0 || timeout < smallest) smallest = timeout;
617
+ return smallest;
618
+ }
487
619
  /** Whether a request for this variant is on the wire. */
488
620
  isFetching(variantKey) {
489
621
  return this.inflight.has(variantKey);
@@ -584,7 +716,8 @@ var QueryResource = class {
584
716
  if (state.error) {
585
717
  store.set(key, {
586
718
  ...state,
587
- error: null
719
+ error: null,
720
+ reconnecting: false
588
721
  });
589
722
  changed = true;
590
723
  }
@@ -607,6 +740,7 @@ var QueryResource = class {
607
740
  else {
608
741
  this.watchers.delete(variantKey);
609
742
  this.cancelRetry(variantKey);
743
+ this.setReconnecting(variantKey, false);
610
744
  this.scheduleAbort(variantKey);
611
745
  }
612
746
  };
@@ -647,6 +781,7 @@ var QueryResource = class {
647
781
  */
648
782
  scheduleRetry(variantKey, delay) {
649
783
  if (typeof window === "undefined") return;
784
+ this.setReconnecting(variantKey, true);
650
785
  if (this.retryTimers.has(variantKey) || this.inflight.has(variantKey)) return;
651
786
  const timer = setTimeout(() => {
652
787
  this.retryTimers.delete(variantKey);
@@ -658,6 +793,24 @@ var QueryResource = class {
658
793
  }, Math.min(Math.max(0, delay || 0), MAX_TIMEOUT));
659
794
  this.retryTimers.set(variantKey, timer);
660
795
  }
796
+ /**
797
+ * The retry policy will not retry the stored error: the variant stops
798
+ * reconnecting — unless a retry another reader asked for is still
799
+ * scheduled or on the wire, which then decides.
800
+ */
801
+ giveUpRetry(variantKey) {
802
+ if (this.retryTimers.has(variantKey) || this.inflight.has(variantKey)) return;
803
+ this.setReconnecting(variantKey, false);
804
+ }
805
+ setReconnecting(variantKey, reconnecting) {
806
+ const store = this.store.getValue();
807
+ const state = store.get(variantKey);
808
+ if (!state || !!state.reconnecting === reconnecting) return;
809
+ this.store.next(store.set(variantKey, {
810
+ ...state,
811
+ reconnecting
812
+ }));
813
+ }
661
814
  cancelRetry(variantKey) {
662
815
  const timer = this.retryTimers.get(variantKey);
663
816
  if (timer !== void 0) {
@@ -695,7 +848,8 @@ var QueryResource = class {
695
848
  this.store.next(store.set(variantKey, {
696
849
  ...state,
697
850
  data: fn(state.data),
698
- error: null
851
+ error: null,
852
+ reconnecting: false
699
853
  }));
700
854
  }
701
855
  this.staleVariants.add(variantKey);
@@ -767,6 +921,13 @@ var QueryResource = class {
767
921
  }
768
922
  set.add(controller);
769
923
  }
924
+ const timeout = startRequestTimeout(controller, this.requestTimeout(variantKey));
925
+ let timers = this.requestTimers.get(variantKey);
926
+ if (!timers) {
927
+ timers = /* @__PURE__ */ new Set();
928
+ this.requestTimers.set(variantKey, timers);
929
+ }
930
+ timers.add(timeout);
770
931
  const isLatest = () => this.issued.get(variantKey) === seq;
771
932
  const isSuperseded = () => (this.applied.get(variantKey) ?? 0) >= seq;
772
933
  const recordFailure = () => {
@@ -788,7 +949,8 @@ var QueryResource = class {
788
949
  data: current?.data,
789
950
  hasData: current?.hasData ?? false,
790
951
  error,
791
- version: current?.version
952
+ version: current?.version,
953
+ reconnecting: current?.reconnecting
792
954
  }));
793
955
  };
794
956
  try {
@@ -798,7 +960,8 @@ var QueryResource = class {
798
960
  data: previousState?.data,
799
961
  hasData: previousState?.hasData ?? false,
800
962
  error: previousState?.error,
801
- version: previousState?.version
963
+ version: previousState?.version,
964
+ reconnecting: previousState?.reconnecting
802
965
  });
803
966
  let data = null;
804
967
  let response = null;
@@ -811,10 +974,14 @@ var QueryResource = class {
811
974
  try {
812
975
  data = await readResponseBody(response);
813
976
  } catch (parseError) {
814
- if (response.ok) throw parseError;
977
+ if (response.ok || timeout.timedOut()) throw parseError;
815
978
  data = null;
816
979
  }
817
980
  } catch (error) {
981
+ if (timeout.timedOut()) {
982
+ writeError(new RequestTimeoutError(`/api${fullUrl}`, timeout.timeout()));
983
+ return;
984
+ }
818
985
  if (controller?.signal.aborted) {
819
986
  const current = store.get(variantKey);
820
987
  if (isLatest() && current?.loading) this.store.next(store.set(variantKey, {
@@ -862,6 +1029,10 @@ var QueryResource = class {
862
1029
  });
863
1030
  }
864
1031
  } finally {
1032
+ timeout.clear();
1033
+ const timers = this.requestTimers.get(variantKey);
1034
+ timers?.delete(timeout);
1035
+ if (timers?.size === 0) this.requestTimers.delete(variantKey);
865
1036
  if (controller) {
866
1037
  const set = this.controllers.get(variantKey);
867
1038
  set?.delete(controller);
@@ -872,6 +1043,9 @@ var QueryResource = class {
872
1043
  }
873
1044
  }
874
1045
  };
1046
+ function isTimeout(timeout) {
1047
+ return typeof timeout === "number" && timeout > 0;
1048
+ }
875
1049
  //#endregion
876
1050
  //#region client/QueryManagerContext.tsx
877
1051
  var QueryConfigContext = createContext(null);
@@ -890,6 +1064,8 @@ var APP_WIDE_QUERY_CONFIG_KEYS = [
890
1064
  "keepPreviousData",
891
1065
  "retry",
892
1066
  "retryDelay",
1067
+ "timeout",
1068
+ "mutationTimeout",
893
1069
  "retryIntervalOnError",
894
1070
  "refreshInterval",
895
1071
  "revalidateOnFocus",
@@ -1092,7 +1268,7 @@ function loadedRealtimeClient() {
1092
1268
  }
1093
1269
  var loading = null;
1094
1270
  /** The lazily loaded client. Replaceable in tests, to simulate a failed load. */
1095
- var lazyModules = { client: () => import("./RealtimeClient-CmGMu3vA.js") };
1271
+ var lazyModules = { client: () => import("./RealtimeClient-CuTFz0v1.js") };
1096
1272
  /**
1097
1273
  * `./live`, loaded by the first live query. `<Page>` in `gemi/testing` sets
1098
1274
  * `current` up front, so a live query on a provided socket subscribes during
@@ -1100,7 +1276,7 @@ var lazyModules = { client: () => import("./RealtimeClient-CmGMu3vA.js") };
1100
1276
  */
1101
1277
  var liveModule = {
1102
1278
  current: null,
1103
- load: () => import("./live-DAt2MPE2.js").then((n) => n.n)
1279
+ load: () => import("./live-BCCfTb28.js").then((n) => n.n)
1104
1280
  };
1105
1281
  /**
1106
1282
  * The tab's client, loading its module and creating it on first use. `null`
@@ -3199,6 +3375,6 @@ function useTheme() {
3199
3375
  return useContext(ThemeContext);
3200
3376
  }
3201
3377
  //#endregion
3202
- export { toVariantKey as $, useSearchParams as A, ProgressManager as B, loadDictionary as C, readRoutePayload as D, setActiveLocale as E, ServerDataProvider as F, RealtimeContext as G, CspNonceContext as H, useLocation as I, liveModule as J, configureRealtime as K, domainUrl as L, I18nContext as M, I18nProvider as N, routeDataUrl as O, ServerDataContext as P, loadedModule as Q, isAbsoluteUrl as R, recoverFromChunkLoadError as S, registerDictionary as T, applyDocumentNonce as U, loadURLPattern as V, useCspNonce as W, reconnectRealtime as X, realtime as Y, loadLazy as Z, configureChunkLoadRecovery as _, parseRetryAfter as _t, useRouteTransition as a, pickDefined as at, otherBuild as b, QueryError as bt, ClientRouterContext as c, reportAuthenticationRefusal as ct, ComponentsContext as d, INTENDED_URL_PARAM as dt, applyParams as et, ComponentsProvider as f, isExternalRedirect as ft, CHUNK_RELOAD_MARKER as g, isRetryableQueryError as gt, subscribeViewModules as h, equalJitter as ht, RouteTransitionProvider as i, USER_QUERY_CONFIG_KEYS as it, useNavigate as j, useRoute as k, ClientRouterProvider as l, resetAuthenticationIncident as lt, loadViewModule as m, readResponseBody as mt, useTheme as n, QueryManagerContext as nt, useChannelSubscription as o, DEFAULT_STALE_TIME as ot, initialViewModulesReady as p, safeRedirectPath as pt, followLive as q, m as r, QueryManagerProvider as rt, useCoalesced as s, configureAuthenticationErrors as st, ThemeProvider as t, QueryConfigContext as tt, restoreScroll as u, setAuthenticationNavigator as ut, isChunkLoadError as v, retryDelayFor as vt, loadDictionaryForRender as w, recoverFromBuildMismatch as x, Subject as xt, navigationStarted as y, shouldRetryQuery as yt, routeHref as z };
3378
+ export { toVariantKey as $, useSearchParams as A, ProgressManager as B, loadDictionary as C, Subject as Ct, readRoutePayload as D, setActiveLocale as E, ServerDataProvider as F, RealtimeContext as G, CspNonceContext as H, useLocation as I, liveModule as J, configureRealtime as K, domainUrl as L, I18nContext as M, I18nProvider as N, routeDataUrl as O, ServerDataContext as P, loadedModule as Q, isAbsoluteUrl as R, recoverFromChunkLoadError as S, QueryError as St, registerDictionary as T, applyDocumentNonce as U, loadURLPattern as V, useCspNonce as W, reconnectRealtime as X, realtime as Y, loadLazy as Z, configureChunkLoadRecovery as _, equalJitter as _t, useRouteTransition as a, pickDefined as at, otherBuild as b, retryDelayFor as bt, ClientRouterContext as c, startRequestTimeout as ct, ComponentsContext as d, resetAuthenticationIncident as dt, applyParams as et, ComponentsProvider as f, setAuthenticationNavigator as ft, CHUNK_RELOAD_MARKER as g, readResponseBody as gt, subscribeViewModules as h, safeRedirectPath as ht, RouteTransitionProvider as i, USER_QUERY_CONFIG_KEYS as it, useNavigate as j, useRoute as k, ClientRouterProvider as l, configureAuthenticationErrors as lt, loadViewModule as m, isExternalRedirect as mt, useTheme as n, QueryManagerContext as nt, useChannelSubscription as o, DEFAULT_STALE_TIME as ot, initialViewModulesReady as p, INTENDED_URL_PARAM as pt, followLive as q, m as r, QueryManagerProvider as rt, useCoalesced as s, RequestTimeoutError as st, ThemeProvider as t, QueryConfigContext as tt, restoreScroll as u, reportAuthenticationRefusal as ut, isChunkLoadError as v, isRetryableQueryError as vt, loadDictionaryForRender as w, recoverFromBuildMismatch as x, shouldRetryQuery as xt, navigationStarted as y, parseRetryAfter as yt, routeHref as z };
3203
3379
 
3204
- //# sourceMappingURL=ThemeProvider-Cd7Ioorg.js.map
3380
+ //# sourceMappingURL=ThemeProvider-BO3sQkWl.js.map