gemi 0.186.0 → 0.187.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai/index.js +2 -2
- package/dist/ai/index.js.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bin/gemi.js +8 -2
- package/dist/bin/gemi.js.map +4 -4
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-h2t135y3.js → chunk-0bzcxgks.js} +3 -3
- package/dist/{chunk-h2t135y3.js.map → chunk-0bzcxgks.js.map} +1 -1
- package/dist/{chunk-vhyabcw9.js → chunk-0jbwxas3.js} +2 -2
- package/dist/{chunk-vhyabcw9.js.map → chunk-0jbwxas3.js.map} +1 -1
- package/dist/{chunk-7b10n8m8.js → chunk-10sbvn36.js} +2 -2
- package/dist/{chunk-7b10n8m8.js.map → chunk-10sbvn36.js.map} +1 -1
- package/dist/{chunk-q6rse2fh.js → chunk-1ecvjvbg.js} +2 -2
- package/dist/{chunk-q6rse2fh.js.map → chunk-1ecvjvbg.js.map} +1 -1
- package/dist/{chunk-przahq2e.js → chunk-1x1je71f.js} +2 -2
- package/dist/{chunk-przahq2e.js.map → chunk-1x1je71f.js.map} +1 -1
- package/dist/{chunk-a1r1r1z7.js → chunk-2757n2e2.js} +2 -2
- package/dist/{chunk-a1r1r1z7.js.map → chunk-2757n2e2.js.map} +1 -1
- package/dist/{chunk-00sj67nx.js → chunk-28xqs354.js} +2 -2
- package/dist/{chunk-00sj67nx.js.map → chunk-28xqs354.js.map} +1 -1
- package/dist/{chunk-894xp2a6.js → chunk-2a4q9t8c.js} +2 -2
- package/dist/{chunk-894xp2a6.js.map → chunk-2a4q9t8c.js.map} +1 -1
- package/dist/{chunk-kzv3v0tm.js → chunk-2pj5e233.js} +3 -3
- package/dist/{chunk-kzv3v0tm.js.map → chunk-2pj5e233.js.map} +1 -1
- package/dist/{chunk-sn31ps9c.js → chunk-2ys56r3z.js} +2 -2
- package/dist/{chunk-sn31ps9c.js.map → chunk-2ys56r3z.js.map} +1 -1
- package/dist/{chunk-d5ftst76.js → chunk-3cmm9atm.js} +2 -2
- package/dist/{chunk-d5ftst76.js.map → chunk-3cmm9atm.js.map} +1 -1
- package/dist/{chunk-0ahecas6.js → chunk-3t37a4e5.js} +2 -2
- package/dist/{chunk-0ahecas6.js.map → chunk-3t37a4e5.js.map} +1 -1
- package/dist/{chunk-7gnspwra.js → chunk-3yzmzcxn.js} +2 -2
- package/dist/{chunk-7gnspwra.js.map → chunk-3yzmzcxn.js.map} +1 -1
- package/dist/{chunk-g32mpf79.js → chunk-4e99zzkt.js} +2 -2
- package/dist/{chunk-g32mpf79.js.map → chunk-4e99zzkt.js.map} +1 -1
- package/dist/{chunk-2rpz1p8g.js → chunk-5q2v29ma.js} +1 -1
- package/dist/{chunk-ty3kycy4.js → chunk-5sc7j1g0.js} +2 -2
- package/dist/{chunk-ty3kycy4.js.map → chunk-5sc7j1g0.js.map} +1 -1
- package/dist/{chunk-wtdmwmm7.js → chunk-5yj3k754.js} +3 -3
- package/dist/{chunk-wtdmwmm7.js.map → chunk-5yj3k754.js.map} +1 -1
- package/dist/{chunk-ye72q3kx.js → chunk-6cq83t7e.js} +2 -2
- package/dist/{chunk-ye72q3kx.js.map → chunk-6cq83t7e.js.map} +1 -1
- package/dist/{chunk-3fm7gmp5.js → chunk-6m5rt6xg.js} +2 -2
- package/dist/{chunk-3fm7gmp5.js.map → chunk-6m5rt6xg.js.map} +1 -1
- package/dist/{chunk-810nrvt4.js → chunk-7pes8axs.js} +2 -2
- package/dist/{chunk-810nrvt4.js.map → chunk-7pes8axs.js.map} +1 -1
- package/dist/{chunk-2qac05gb.js → chunk-8nxrgzxp.js} +2 -2
- package/dist/{chunk-2qac05gb.js.map → chunk-8nxrgzxp.js.map} +1 -1
- package/dist/{chunk-84j5b07n.js → chunk-9by5yphc.js} +1 -1
- package/dist/{chunk-zenfs4e2.js → chunk-9caq1znh.js} +3 -3
- package/dist/{chunk-zenfs4e2.js.map → chunk-9caq1znh.js.map} +1 -1
- package/dist/{chunk-zyzhqnbm.js → chunk-9sv8skzh.js} +2 -2
- package/dist/{chunk-zyzhqnbm.js.map → chunk-9sv8skzh.js.map} +1 -1
- package/dist/{chunk-3derdn99.js → chunk-aezj1erg.js} +2 -2
- package/dist/{chunk-3derdn99.js.map → chunk-aezj1erg.js.map} +1 -1
- package/dist/{chunk-gtdf51jz.js → chunk-ascbx2kb.js} +1 -1
- package/dist/{chunk-skq4g7qa.js → chunk-b3e27j6t.js} +2 -2
- package/dist/{chunk-skq4g7qa.js.map → chunk-b3e27j6t.js.map} +1 -1
- package/dist/{chunk-9mf6qzxy.js → chunk-bf88yh7q.js} +2 -2
- package/dist/{chunk-9mf6qzxy.js.map → chunk-bf88yh7q.js.map} +1 -1
- package/dist/{chunk-6tferehw.js → chunk-bw2ptzxr.js} +2 -2
- package/dist/{chunk-6tferehw.js.map → chunk-bw2ptzxr.js.map} +1 -1
- package/dist/{chunk-64r5cs5g.js → chunk-c3rn99hm.js} +1 -1
- package/dist/{chunk-a1414jdv.js → chunk-cgxk8pn8.js} +3 -3
- package/dist/{chunk-a1414jdv.js.map → chunk-cgxk8pn8.js.map} +1 -1
- package/dist/{chunk-srsmhbpt.js → chunk-d19x7t1z.js} +2 -2
- package/dist/{chunk-srsmhbpt.js.map → chunk-d19x7t1z.js.map} +1 -1
- package/dist/{chunk-m906xc76.js → chunk-dwt3p2aw.js} +2 -2
- package/dist/{chunk-m906xc76.js.map → chunk-dwt3p2aw.js.map} +1 -1
- package/dist/{chunk-yaacfbky.js → chunk-eeqfp05r.js} +2 -2
- package/dist/{chunk-yaacfbky.js.map → chunk-eeqfp05r.js.map} +1 -1
- package/dist/{chunk-7dhvb6nn.js → chunk-epmtvd6j.js} +2 -2
- package/dist/{chunk-7dhvb6nn.js.map → chunk-epmtvd6j.js.map} +1 -1
- package/dist/{chunk-87nekrjj.js → chunk-gap8ta5q.js} +2 -2
- package/dist/{chunk-87nekrjj.js.map → chunk-gap8ta5q.js.map} +1 -1
- package/dist/chunk-ghf4kgs6.js +5 -0
- package/dist/{chunk-f25x1sn1.js.map → chunk-ghf4kgs6.js.map} +1 -1
- package/dist/{chunk-c07s6w45.js → chunk-gpsqtjx5.js} +1 -1
- package/dist/{chunk-6daabbfj.js → chunk-gw9sy16b.js} +2 -2
- package/dist/{chunk-6daabbfj.js.map → chunk-gw9sy16b.js.map} +1 -1
- package/dist/{chunk-z65e3vdy.js → chunk-hc58rnwq.js} +2 -2
- package/dist/{chunk-z65e3vdy.js.map → chunk-hc58rnwq.js.map} +1 -1
- package/dist/{chunk-87pn20z5.js → chunk-jg1n0b5e.js} +2 -2
- package/dist/{chunk-87pn20z5.js.map → chunk-jg1n0b5e.js.map} +1 -1
- package/dist/{chunk-ecv4mtgh.js → chunk-jqdqpdss.js} +2 -2
- package/dist/{chunk-ecv4mtgh.js.map → chunk-jqdqpdss.js.map} +1 -1
- package/dist/{chunk-7bz43qbt.js → chunk-jx8n3w5j.js} +3 -3
- package/dist/{chunk-7bz43qbt.js.map → chunk-jx8n3w5j.js.map} +1 -1
- package/dist/{chunk-f2tjtwm0.js → chunk-kgsmh0v0.js} +2 -2
- package/dist/{chunk-f2tjtwm0.js.map → chunk-kgsmh0v0.js.map} +1 -1
- package/dist/{chunk-xjb2kzkj.js → chunk-kj6wqkjc.js} +4 -4
- package/dist/{chunk-xjb2kzkj.js.map → chunk-kj6wqkjc.js.map} +1 -1
- package/dist/{chunk-yx03gndz.js → chunk-kqwenh9b.js} +2 -2
- package/dist/{chunk-yx03gndz.js.map → chunk-kqwenh9b.js.map} +1 -1
- package/dist/{chunk-96r16t57.js → chunk-m62jshaz.js} +3 -3
- package/dist/{chunk-96r16t57.js.map → chunk-m62jshaz.js.map} +1 -1
- package/dist/{chunk-beqhakdf.js → chunk-n2vx8eqm.js} +2 -2
- package/dist/{chunk-beqhakdf.js.map → chunk-n2vx8eqm.js.map} +1 -1
- package/dist/chunk-n7nx6hby.js +117 -0
- package/dist/{chunk-0rkastve.js.map → chunk-n7nx6hby.js.map} +15 -8
- package/dist/{chunk-dh4ax9cj.js → chunk-nchyjgpr.js} +2 -2
- package/dist/{chunk-dh4ax9cj.js.map → chunk-nchyjgpr.js.map} +1 -1
- package/dist/{chunk-spmxhsze.js → chunk-nd2vajx0.js} +2 -2
- package/dist/{chunk-spmxhsze.js.map → chunk-nd2vajx0.js.map} +1 -1
- package/dist/{chunk-288ee6av.js → chunk-nwafkabk.js} +2 -2
- package/dist/{chunk-288ee6av.js.map → chunk-nwafkabk.js.map} +1 -1
- package/dist/{chunk-7tm669mw.js → chunk-pcc8v9jc.js} +2 -2
- package/dist/{chunk-7tm669mw.js.map → chunk-pcc8v9jc.js.map} +1 -1
- package/dist/{chunk-mpreff3t.js → chunk-q7nz3b4q.js} +2 -2
- package/dist/{chunk-mpreff3t.js.map → chunk-q7nz3b4q.js.map} +1 -1
- package/dist/{chunk-6d3527qt.js → chunk-qj138p8j.js} +2 -2
- package/dist/{chunk-6d3527qt.js.map → chunk-qj138p8j.js.map} +1 -1
- package/dist/{chunk-tvkdqnhv.js → chunk-rsnm21vr.js} +3 -3
- package/dist/{chunk-tvkdqnhv.js.map → chunk-rsnm21vr.js.map} +1 -1
- package/dist/{chunk-fdpvgeey.js → chunk-rztf3yam.js} +2 -2
- package/dist/{chunk-fdpvgeey.js.map → chunk-rztf3yam.js.map} +1 -1
- package/dist/{chunk-e38xa29v.js → chunk-s52ecbdd.js} +2 -2
- package/dist/{chunk-e38xa29v.js.map → chunk-s52ecbdd.js.map} +1 -1
- package/dist/{chunk-dezd1fn5.js → chunk-s5p7pd7v.js} +2 -2
- package/dist/{chunk-dezd1fn5.js.map → chunk-s5p7pd7v.js.map} +1 -1
- package/dist/{chunk-kcvzs31p.js → chunk-sg8fcsvn.js} +2 -2
- package/dist/{chunk-kcvzs31p.js.map → chunk-sg8fcsvn.js.map} +1 -1
- package/dist/{chunk-xgg9w7ep.js → chunk-tnqvxzbw.js} +2 -2
- package/dist/{chunk-xgg9w7ep.js.map → chunk-tnqvxzbw.js.map} +1 -1
- package/dist/{chunk-rdnxkecg.js → chunk-tns989kw.js} +2 -2
- package/dist/{chunk-rdnxkecg.js.map → chunk-tns989kw.js.map} +1 -1
- package/dist/{chunk-cf5a958j.js → chunk-ttcmvam5.js} +2 -2
- package/dist/{chunk-cf5a958j.js.map → chunk-ttcmvam5.js.map} +1 -1
- package/dist/{chunk-z2k8m02z.js → chunk-twn4yxsd.js} +8 -2
- package/dist/chunk-twn4yxsd.js.map +10 -0
- package/dist/{chunk-vv8vjjez.js → chunk-v7e5gv6w.js} +2 -2
- package/dist/{chunk-vv8vjjez.js.map → chunk-v7e5gv6w.js.map} +1 -1
- package/dist/{chunk-hq710s2a.js → chunk-wd3eyjbj.js} +3 -3
- package/dist/{chunk-hq710s2a.js.map → chunk-wd3eyjbj.js.map} +1 -1
- package/dist/{chunk-krgwft9w.js → chunk-x0983cez.js} +2 -2
- package/dist/{chunk-krgwft9w.js.map → chunk-x0983cez.js.map} +1 -1
- package/dist/{chunk-xmjzyzn6.js → chunk-x0vrrfp7.js} +2 -2
- package/dist/{chunk-xmjzyzn6.js.map → chunk-x0vrrfp7.js.map} +1 -1
- package/dist/{chunk-bg2e7stx.js → chunk-xa2k8dm0.js} +2 -2
- package/dist/{chunk-bg2e7stx.js.map → chunk-xa2k8dm0.js.map} +1 -1
- package/dist/{chunk-vvg3yxrc.js → chunk-xf515fp7.js} +2 -2
- package/dist/{chunk-vvg3yxrc.js.map → chunk-xf515fp7.js.map} +1 -1
- package/dist/{chunk-3jpj6hjh.js → chunk-y4yv9e31.js} +1 -1
- package/dist/{chunk-d9pnjkxr.js → chunk-y8c704wp.js} +2 -2
- package/dist/{chunk-d9pnjkxr.js.map → chunk-y8c704wp.js.map} +1 -1
- package/dist/{chunk-mpt1zsfv.js → chunk-yn2v5axb.js} +2 -2
- package/dist/{chunk-mpt1zsfv.js.map → chunk-yn2v5axb.js.map} +1 -1
- package/dist/{chunk-b55zt46z.js → chunk-zdwgcyjh.js} +2 -2
- package/dist/{chunk-b55zt46z.js.map → chunk-zdwgcyjh.js.map} +1 -1
- package/dist/{chunk-nadkwh8a.js → chunk-znnt70rn.js} +3 -3
- package/dist/{chunk-nadkwh8a.js.map → chunk-znnt70rn.js.map} +1 -1
- package/dist/chunks/{RealtimeClient-C7VTiRUv.js → RealtimeClient-CyGWZr6p.js} +2 -2
- package/dist/chunks/{RealtimeClient-C7VTiRUv.js.map → RealtimeClient-CyGWZr6p.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-Ddumzd7S.js → ThemeProvider-BnmnRvEc.js} +53 -34
- package/dist/chunks/ThemeProvider-BnmnRvEc.js.map +1 -0
- package/dist/chunks/{fetchFileRequest-ClV8HU3g.js → fetchFileRequest-D4fAcY7D.js} +2 -2
- package/dist/chunks/{fetchFileRequest-ClV8HU3g.js.map → fetchFileRequest-D4fAcY7D.js.map} +1 -1
- package/dist/chunks/{live-BAFgp_WN.js → live-B4RW02g2.js} +3 -3
- package/dist/chunks/{live-BAFgp_WN.js.map → live-B4RW02g2.js.map} +1 -1
- package/dist/chunks/{mutationExtras-ozY1Rd1R.js → mutationExtras-DgdYjcaa.js} +2 -2
- package/dist/chunks/{mutationExtras-ozY1Rd1R.js.map → mutationExtras-DgdYjcaa.js.map} +1 -1
- package/dist/chunks/{subscriptionStream-CTiRok5u.js → subscriptionStream-Ca5V54ee.js} +2 -2
- package/dist/chunks/{subscriptionStream-CTiRok5u.js.map → subscriptionStream-Ca5V54ee.js.map} +1 -1
- package/dist/client/QueryManagerContext.d.ts +17 -1
- package/dist/client/QueryManagerContext.d.ts.map +1 -1
- package/dist/client/ServerQueryContext.d.ts +10 -4
- package/dist/client/ServerQueryContext.d.ts.map +1 -1
- package/dist/client/index.js +27 -25
- package/dist/client/index.js.map +1 -1
- package/dist/client/islands.d.ts +47 -2
- package/dist/client/islands.d.ts.map +1 -1
- package/dist/client/useQuery.d.ts.map +1 -1
- package/dist/config/index.js +1 -1
- package/dist/console/run.js +2 -2
- package/dist/console/run.js.map +1 -1
- package/dist/container/index.js +2 -2
- package/dist/container/index.js.map +1 -1
- package/dist/database/index.js +2 -2
- package/dist/database/index.js.map +1 -1
- package/dist/email/index.js +2 -2
- package/dist/email/index.js.map +1 -1
- package/dist/facades/index.js +2 -2
- package/dist/facades/index.js.map +1 -1
- package/dist/foundation/index.js +2 -2
- package/dist/foundation/index.js.map +1 -1
- package/dist/http/index.js +2 -2
- package/dist/http/index.js.map +1 -1
- package/dist/i18n/dictionaryRuntime.js +2 -2
- package/dist/i18n/dictionaryRuntime.js.map +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/i18n/index.js.map +1 -1
- package/dist/internal/islandRuntime.d.ts +9 -2
- package/dist/internal/islandRuntime.d.ts.map +1 -1
- package/dist/internal/staticNavigationRuntime.d.ts +2 -2
- package/dist/internal/staticNavigationRuntime.d.ts.map +1 -1
- package/dist/kernel/index.js +2 -2
- package/dist/kernel/index.js.map +1 -1
- package/dist/orm/index.js +2 -2
- package/dist/orm/index.js.map +1 -1
- package/dist/probe/index.js +2 -2
- package/dist/probe/index.js.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.js +2 -2
- package/dist/services/index.js.map +1 -1
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/ServerQueryStore.d.ts +10 -0
- package/dist/services/router/ServerQueryStore.d.ts.map +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/staticDocument.d.ts +8 -0
- package/dist/services/router/staticDocument.d.ts.map +1 -1
- package/dist/stats/route-table.js +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +16 -3
- package/dist/testing/index.js.map +1 -1
- package/dist/vite/index.mjs +6 -0
- package/dist/vitest/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-0rkastve.js +0 -117
- package/dist/chunk-f25x1sn1.js +0 -5
- package/dist/chunk-z2k8m02z.js.map +0 -10
- package/dist/chunks/ThemeProvider-Ddumzd7S.js.map +0 -1
- /package/dist/{chunk-2rpz1p8g.js.map → chunk-5q2v29ma.js.map} +0 -0
- /package/dist/{chunk-84j5b07n.js.map → chunk-9by5yphc.js.map} +0 -0
- /package/dist/{chunk-gtdf51jz.js.map → chunk-ascbx2kb.js.map} +0 -0
- /package/dist/{chunk-64r5cs5g.js.map → chunk-c3rn99hm.js.map} +0 -0
- /package/dist/{chunk-c07s6w45.js.map → chunk-gpsqtjx5.js.map} +0 -0
- /package/dist/{chunk-3jpj6hjh.js.map → chunk-y4yv9e31.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { X as applyParams, gt as QueryError, pt as parseRetryAfter } from "./ThemeProvider-
|
|
1
|
+
import { X as applyParams, gt as QueryError, pt as parseRetryAfter } from "./ThemeProvider-BnmnRvEc.js";
|
|
2
2
|
//#region client/fetchFileRequest.ts
|
|
3
3
|
/**
|
|
4
4
|
* `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a
|
|
@@ -54,4 +54,4 @@ function filenameOf(response) {
|
|
|
54
54
|
//#endregion
|
|
55
55
|
export { fetchFile, filenameOf };
|
|
56
56
|
|
|
57
|
-
//# sourceMappingURL=fetchFileRequest-
|
|
57
|
+
//# sourceMappingURL=fetchFileRequest-D4fAcY7D.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchFileRequest-
|
|
1
|
+
{"version":3,"file":"fetchFileRequest-D4fAcY7D.js","names":[],"sources":["../../client/fetchFileRequest.ts"],"sourcesContent":["import { applyParams } from \"../utils/applyParams\";\nimport type { FetchedBlob, FetchedText, FetchFileOptions } from \"./fetchFile\";\nimport { QueryError } from \"./QueryError\";\nimport { parseRetryAfter } from \"./retryPolicy\";\n\n// What `fetchBlob` and `fetchText` in `./fetchFile` load on their first call\n// (#915).\n\ntype RequestOptions = Omit<FetchFileOptions<string>, \"params\"> & {\n params?: Record<string, string | number | undefined>;\n};\n\n/**\n * `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a\n * non-2xx, and the body read `as` a blob or text.\n */\nexport async function fetchFile(\n path: string,\n // The caller's `FetchFileOptions<P>`, checked against its path there.\n options: object | undefined,\n as: \"blob\" | \"text\",\n): Promise<FetchedBlob | FetchedText> {\n const response = await request(path, options as RequestOptions);\n const body = as === \"blob\" ? { blob: await response.blob() } : { text: await response.text() };\n return { ...body, filename: filenameOf(response), response } as FetchedBlob | FetchedText;\n}\n\nasync function request(path: string, options: RequestOptions = {}) {\n const { params = {}, search, signal, init } = options;\n const url = applyParams(path, params);\n const query = searchString(search);\n const response = await fetch(`/api${url}${query ? `?${query}` : \"\"}`, {\n ...init,\n method: \"GET\",\n signal,\n });\n if (!response.ok) {\n // An error body that is not JSON (a proxy's HTML 502) is still that status.\n const body = await response.json().catch(() => null);\n throw new QueryError(\n url,\n query,\n response.status,\n body,\n parseRetryAfter(response.headers.get(\"retry-after\")),\n );\n }\n return response;\n}\n\nfunction searchString(search: FetchFileOptions<string>[\"search\"]) {\n if (!search) return \"\";\n if (search instanceof URLSearchParams) return search.toString();\n const params = new URLSearchParams();\n for (const [key, value] of Object.entries(search)) {\n if (value !== null && value !== undefined) params.append(key, String(value));\n }\n return params.toString();\n}\n\n/**\n * The file name in a `Content-Disposition` header: the RFC 5987\n * `filename*=UTF-8''...` form when present and decodable, else `filename`.\n *\n * @internal Exported for tests.\n */\nexport function filenameOf(response: Response): string | null {\n const header = response.headers.get(\"content-disposition\");\n if (!header) return null;\n const extended = /filename\\*\\s*=\\s*([^']*)'[^']*'([^;]+)/i.exec(header);\n if (extended) {\n try {\n return decodeURIComponent(extended[2].trim());\n } catch {\n // A malformed escape: fall back to the plain form.\n }\n }\n const plain = /filename\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|([^;]+))/i.exec(header);\n if (!plain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AO;CACpB,MAAM,WAAW,0CAA0C,KAAK,MAAM;CACtE,IAAI,UACF,IAAI;EACF,OAAO,mBAAmB,SAAS,EAAE,CAAC,KAAK,CAAC;CAC9C,QAAQ,CAER;CAEF,MAAM,QAAQ,kDAAkD,KAAK,MAAM;CAC3E,IAAI,CAAC,OAAO,OAAO;CAEnB,QADa,MAAM,OAAO,KAAA,IAAY,MAAM,EAAE,CAAC,QAAQ,UAAU,IAAI,IAAI,MAAM,EAAE,CAAC,KAAK,MACxE;AACjB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as realtime, J as loadedModule } from "./ThemeProvider-
|
|
1
|
+
import { G as realtime, J as loadedModule } from "./ThemeProvider-BnmnRvEc.js";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -76,7 +76,7 @@ function followLive(provided, live, resource, setOpen) {
|
|
|
76
76
|
};
|
|
77
77
|
const socket = provided ?? realtime.client;
|
|
78
78
|
if (socket) start(socket);
|
|
79
|
-
else import("./RealtimeClient-
|
|
79
|
+
else import("./RealtimeClient-CyGWZr6p.js").then((module) => start(loadedModule(module).tabClient())).catch(() => {});
|
|
80
80
|
return () => {
|
|
81
81
|
stop?.();
|
|
82
82
|
stop = null;
|
|
@@ -85,4 +85,4 @@ function followLive(provided, live, resource, setOpen) {
|
|
|
85
85
|
//#endregion
|
|
86
86
|
export { live_exports as n, followLive as t };
|
|
87
87
|
|
|
88
|
-
//# sourceMappingURL=live-
|
|
88
|
+
//# sourceMappingURL=live-B4RW02g2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"live-
|
|
1
|
+
{"version":3,"file":"live-B4RW02g2.js","names":[],"sources":["../../client/realtime/live.ts"],"sourcesContent":["import type { QueryResource } from \"../QueryResource\";\nimport type { ChannelPattern } from \"../useChannel\";\nimport { EVENT_COALESCE_MS } from \"./useChannelSubscription\";\nimport type { ChannelParamValues, RealtimeSocket } from \"./RealtimeClient\";\nimport { loadedModule } from \"../lazyModule\";\nimport { realtime } from \"./loader\";\n\n/**\n * `useQuery`'s `live` option: the channel whose events and resyncs refetch\n * the query. A pattern without params (`\"user\"`), `[pattern, params]`, or\n * `{ channel, params }`.\n */\nexport type LiveChannel =\n | ChannelPattern\n | readonly [ChannelPattern, ChannelParamValues]\n | { channel: ChannelPattern; params?: ChannelParamValues };\n\nexport function resolveLiveChannel(\n live: LiveChannel | null | undefined | false,\n): { pattern: string; params: ChannelParamValues } | null {\n if (!live) return null;\n if (typeof live === \"string\") return { pattern: live, params: {} };\n if (Array.isArray(live)) return { pattern: live[0], params: live[1] ?? {} };\n const object = live as { channel: string; params?: ChannelParamValues };\n return { pattern: object.channel, params: object.params ?? {} };\n}\n\n/**\n * `useQuery`'s `live` subscription, loaded on first use by `followLive` in\n * `./loader` (#891). The channel's events refetch every cached variant of the\n * query (the rendered ones now), a burst of them once per\n * `EVENT_COALESCE_MS`; a resync refetches at once. `setOpen` follows whether\n * the channel is open, which pauses the query's polling.\n */\nexport function subscribeLive(\n socket: RealtimeSocket,\n live: LiveChannel,\n resource: () => QueryResource,\n setOpen: (open: boolean) => void,\n): () => void {\n const channel = resolveLiveChannel(live);\n if (!channel) return () => {};\n const refresh = () => {\n const target = resource();\n for (const key of target.variantKeys()) target.invalidate(key);\n };\n let timer: ReturnType<typeof setTimeout> | null = null;\n const release = socket.subscribe(channel.pattern, channel.params, {\n onEvent: () => {\n if (timer) return;\n timer = setTimeout(() => {\n timer = null;\n refresh();\n }, EVENT_COALESCE_MS);\n },\n onResync: refresh,\n onStatus: (status) => setOpen(status === \"open\"),\n });\n return () => {\n if (timer) clearTimeout(timer);\n release();\n };\n}\n\n/**\n * What `followLive` in `./loader` hands over to once this module is loaded:\n * subscribes on the provided socket, or the tab's client, loading that first\n * when it is not there yet. Returns the function that stops it.\n */\nexport function followLive(\n provided: RealtimeSocket | null,\n live: LiveChannel,\n resource: () => QueryResource,\n setOpen: (open: boolean) => void,\n): () => void {\n // `undefined` until it subscribes, `null` once stopped.\n let stop: (() => void) | null | undefined;\n const start = (socket: RealtimeSocket) => {\n if (stop === undefined) stop = subscribeLive(socket, live, resource, setOpen);\n };\n const socket = provided ?? realtime.client;\n if (socket) start(socket);\n // Its own `import()` of the client rather than `loadRealtimeClient`, which\n // would keep that in the entry chunk of every app with a `useQuery`. A\n // failed load leaves the channel closed, so the query keeps polling.\n else\n import(\"./RealtimeClient.js\")\n .then((module) => start(loadedModule(module).tabClient()))\n .catch(() => {});\n return () => {\n stop?.();\n stop = null;\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAiBA,SAAgB,mBACd,MACwD;CACxD,IAAI,CAAC,MAAM,OAAO;CAClB,IAAI,OAAO,SAAS,UAAU,OAAO;EAAE,SAAS;EAAM,QAAQ,CAAC;CAAE;CACjE,IAAI,MAAM,QAAQ,IAAI,GAAG,OAAO;EAAE,SAAS,KAAK;EAAI,QAAQ,KAAK,MAAM,CAAC;CAAE;CAC1E,MAAM,SAAS;CACf,OAAO;EAAE,SAAS,OAAO;EAAS,QAAQ,OAAO,UAAU,CAAC;CAAE;AAChE;;;;;;;;AASA,SAAgB,cACd,QACA,MACA,UACA,SACY;CACZ,MAAM,UAAU,mBAAmB,IAAI;CACvC,IAAI,CAAC,SAAS,aAAa,CAAC;CAC5B,MAAM,gBAAgB;EACpB,MAAM,SAAS,SAAS;EACxB,KAAK,MAAM,OAAO,OAAO,YAAY,GAAG,OAAO,WAAW,GAAG;CAC/D;CACA,IAAI,QAA8C;CAClD,MAAM,UAAU,OAAO,UAAU,QAAQ,SAAS,QAAQ,QAAQ;EAChE,eAAe;GACb,IAAI,OAAO;GACX,QAAQ,iBAAiB;IACvB,QAAQ;IACR,QAAQ;GACV,GAAA,GAAoB;EACtB;EACA,UAAU;EACV,WAAW,WAAW,QAAQ,WAAW,MAAM;CACjD,CAAC;CACD,aAAa;EACX,IAAI,OAAO,aAAa,KAAK;EAC7B,QAAQ;CACV;AACF;;;;;;AAOA,SAAgB,WACd,UACA,MACA,UACA,SACY;CAEZ,IAAI;CACJ,MAAM,SAAS,WAA2B;EACxC,IAAI,SAAS,KAAA,GAAW,OAAO,cAAc,QAAQ,MAAM,UAAU,OAAO;CAC9E;CACA,MAAM,SAAS,YAAY,SAAS;CACpC,IAAI,QAAQ,MAAM,MAAM;MAKtB,OAAO,+BAAsB,CAC1B,MAAM,WAAW,MAAM,aAAa,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CACzD,YAAY,CAAC,CAAC;CACnB,aAAa;EACX,OAAO;EACP,OAAO;CACT;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { X as applyParams, Y as toVariantKey } from "./ThemeProvider-
|
|
1
|
+
import { X as applyParams, Y as toVariantKey } from "./ThemeProvider-BnmnRvEc.js";
|
|
2
2
|
import { p as mutationErrorFromBody, s as isObject } from "./MutationError-DuKqBW8o.js";
|
|
3
3
|
//#region client/mutationErrorHelpers.ts
|
|
4
4
|
var FALLBACK_MESSAGE = "Something went wrong. Try again.";
|
|
@@ -112,4 +112,4 @@ function applyQueryUpdates(getResource, routeParams, updates, answer) {
|
|
|
112
112
|
//#endregion
|
|
113
113
|
export { applyQueryUpdates, withMutationErrorHelpers, writeQueryData };
|
|
114
114
|
|
|
115
|
-
//# sourceMappingURL=mutationExtras-
|
|
115
|
+
//# sourceMappingURL=mutationExtras-DgdYjcaa.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mutationExtras-
|
|
1
|
+
{"version":3,"file":"mutationExtras-DgdYjcaa.js","names":[],"sources":["../../client/mutationErrorHelpers.ts","../../client/queryUpdates.ts"],"sourcesContent":["import {\n isObject,\n mutationErrorFromBody,\n type MutationErrorHelpers,\n type MutationValidationError,\n type WithMutationErrorHelpers,\n} from \"./MutationError\";\n\n// `error.list()` and `error.field(name)` on what the mutation hooks hand over.\n// Loaded with the hooks' other extras when one mounts (see\n// `./mutationModules`), so no route's entry chunk carries it (#915).\n//\n// `list` and `field` repeat `mutationErrorList` and `mutationErrorField` from\n// `./MutationError` on purpose. Those are public and synchronous, so they sit\n// in whatever chunk calls them; importing them here would put them, and so\n// this code, back in every entry chunk. `MutationError.helpers.test` runs the\n// same cases through both.\n\nconst FALLBACK_MESSAGE = \"Something went wrong. Try again.\";\n\n// `isValidationError`, which an import would keep in the entry chunk.\nfunction isValidationError(error: unknown): error is MutationValidationError {\n return isObject(error) && error.kind === \"validation_error\";\n}\n\n// A `QueryError`'s refusal, read as the mutation hooks read a body. Read by\n// shape, not `instanceof`, so a copy of the class from another bundle works.\nfunction unwrapQueryError(error: unknown): unknown {\n if (error instanceof Error && error.name === \"QueryError\" && \"body\" in error) {\n const { body, status } = error as Error & { body: unknown; status: number };\n return body == null ? error : mutationErrorFromBody(body, status);\n }\n return error;\n}\n\n// `error.list(fallback)`: see `mutationErrorList`.\nfunction list(\n error: unknown,\n fallback: string = FALLBACK_MESSAGE,\n): string[] {\n const value = unwrapQueryError(error);\n if (isValidationError(value)) {\n const messages = Object.values(value.messages ?? {})\n .flat()\n .filter((message) => typeof message === \"string\" && message !== \"\");\n return messages.length > 0 ? messages : [fallback];\n }\n if (\n isObject(value) &&\n !(value instanceof Error) &&\n value.kind !== \"server_error\" &&\n typeof value.message === \"string\" &&\n value.message !== \"\"\n ) {\n return [value.message];\n }\n return [fallback];\n}\n\n// `error.field(name)`: see `mutationErrorField`.\nfunction field(error: unknown, name: string): string[] {\n const value = unwrapQueryError(error);\n if (!isValidationError(value)) return [];\n const messages = value.messages?.[name];\n return Array.isArray(messages) ? [...messages] : [];\n}\n\n/**\n * Puts `list` and `field` on an error the hooks hand over, as non-enumerable\n * properties, so `toEqual`, a spread and `JSON.stringify` see the same object\n * as before. A key the error already has is left alone; a primitive or a\n * frozen value is returned as it is.\n *\n * @internal\n */\nexport function withMutationErrorHelpers<T>(error: T): WithMutationErrorHelpers<T> {\n if (!isObject(error) || !Object.isExtensible(error)) {\n return error as WithMutationErrorHelpers<T>;\n }\n const helpers: MutationErrorHelpers = {\n list: (fallback) => list(error, fallback),\n field: (name) => field(error, name),\n };\n for (const key of [\"list\", \"field\"] as const) {\n if (key in error) continue;\n Object.defineProperty(error, key, {\n value: helpers[key],\n configurable: true,\n writable: true,\n enumerable: false,\n });\n }\n return error as WithMutationErrorHelpers<T>;\n}\n","import type { QueryResource } from \"./QueryResource\";\nimport type { QueryTarget, QueryUpdate } from \"./useSetQueryData\";\nimport { applyParams } from \"../utils/applyParams\";\nimport { toVariantKey } from \"../utils/variantKey\";\n\n// The cache writes behind a mutation's `updates` and `useSetQueryData()`\n// (#897). Loaded with the hooks' other extras when one mounts (see\n// `./mutationModules`), so no route's entry chunk carries it (#915).\n\ntype Resolve = (key: string) => QueryResource;\n\n/**\n * Write data the server just produced (a mutation's answer) into a variant,\n * with no refetch: unlike `mutate`, the value is not a guess to reconcile.\n * The variant counts as freshly fetched, so its `staleTime` starts again, and\n * a GET already on the wire for it is dropped when it lands, since it may\n * carry the data from before the write. A reader suspended on the variant\n * wakes up with it (#897). Here rather than on `QueryResource`, which every\n * entry chunk carries (#915).\n */\nfunction setVariant(resource: QueryResource, variantKey: string, data: unknown) {\n resource.dropHttpCache(variantKey);\n resource.markApplied(variantKey);\n const store = resource.store.getValue();\n resource.fill(store, variantKey, data, Date.now());\n resource.store.next(store);\n}\n\n/** The value to write, or a function of the cached one. */\nexport type WriteQueryNext = { value: unknown } | { update: (current: any) => unknown };\n\n/**\n * Write into every variant `target` names. `next` is the value to write, or\n * a function of the cached value; a function skips a variant with nothing\n * cached. A value seeds a single variant that is not cached yet; a predicate\n * only ever reaches variants that are.\n */\nexport function writeQueryData(\n getResource: Resolve,\n routeParams: Record<string, any>,\n target: QueryTarget<any>,\n next: WriteQueryNext,\n) {\n const { path, params = {}, search = {} } = target;\n const resource = getResource(applyParams(String(path), { ...routeParams, ...params }));\n const write = (variantKey: string) => {\n if (\"value\" in next) {\n setVariant(resource, variantKey, next.value);\n return;\n }\n const state = resource.peek(variantKey);\n if (!state?.hasData) return;\n setVariant(resource, variantKey, next.update(state.data));\n };\n\n if (typeof search === \"function\") {\n for (const variantKey of resource.variantKeys()) {\n if (!resource.peek(variantKey)?.hasData) continue;\n if (search(new URLSearchParams(variantKey))) write(variantKey);\n }\n return;\n }\n write(toVariantKey(search));\n}\n\n/**\n * Write a mutation's `updates` with its answer.\n */\nexport function applyQueryUpdates(\n getResource: Resolve,\n routeParams: Record<string, any>,\n updates: ReadonlyArray<QueryUpdate<any>> | undefined,\n answer: unknown,\n) {\n for (const update of updates ?? []) {\n const { data } = update as { data?: (answer: any, current: any) => any };\n writeQueryData(\n getResource,\n routeParams,\n update,\n data ? { update: (current) => data(answer, current) } : { value: answer },\n );\n }\n}\n"],"mappings":";;;AAkBA,IAAM,mBAAmB;AAGzB,SAAS,kBAAkB,OAAkD;CAC3E,OAAO,SAAS,KAAK,KAAK,MAAM,SAAS;AAC3C;AAIA,SAAS,iBAAiB,OAAyB;CACjD,IAAI,iBAAiB,SAAS,MAAM,SAAS,gBAAgB,UAAU,OAAO;EAC5E,MAAM,EAAE,MAAM,WAAW;EACzB,OAAO,QAAQ,OAAO,QAAQ,sBAAsB,MAAM,MAAM;CAClE;CACA,OAAO;AACT;AAGA,SAAS,KACP,OACA,WAAmB,kBACT;CACV,MAAM,QAAQ,iBAAiB,KAAK;CACpC,IAAI,kBAAkB,KAAK,GAAG;EAC5B,MAAM,WAAW,OAAO,OAAO,MAAM,YAAY,CAAC,CAAC,CAAC,CACjD,KAAK,CAAC,CACN,QAAQ,YAAY,OAAO,YAAY,YAAY,YAAY,EAAE;EACpE,OAAO,SAAS,SAAS,IAAI,WAAW,CAAC,QAAQ;CACnD;CACA,IACE,SAAS,KAAK,KACd,EAAE,iBAAiB,UACnB,MAAM,SAAS,kBACf,OAAO,MAAM,YAAY,YACzB,MAAM,YAAY,IAElB,OAAO,CAAC,MAAM,OAAO;CAEvB,OAAO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rB,WAAW,UAAU,YAAY,KAAK,OAAO,MAAM,IAAI,CAAC;CAC1D;CAEA,IAAI,OAAO,WAAW,YAAY;EAChC,KAAK,MAAM,cAAc,SAAS,YAAY,GAAG;GAC/C,IAAI,CAAC,SAAS,KAAK,UAAU,CAAC,EAAE,SAAS;GACzC,IAAI,OAAO,IAAI,gBAAgB,UAAU,CAAC,GAAG,MAAM,UAAU;EAC/D;EACA;CACF;CACA,MAAM,aAAa,MAAM,CAAC;AAC5B;;;;AAKA,SAAgB,kBACd,aACA,aACA,SACA,QACA;CACA,KAAK,MAAM,UAAU,WAAW,CAAC,GAAG;EAClC,MAAM,EAAE,SAAS;EACjB,eACE,aACA,aACA,QACA,OAAO,EAAE,SAAS,YAAY,KAAK,QAAQ,OAAO,EAAE,IAAI,EAAE,OAAO,OAAO,CAC1E;CACF;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dt as equalJitter } from "./ThemeProvider-
|
|
1
|
+
import { dt as equalJitter } from "./ThemeProvider-BnmnRvEc.js";
|
|
2
2
|
//#region client/subscriptionStream.ts
|
|
3
3
|
var MIN_RETRY_MS = 1e3;
|
|
4
4
|
var MAX_RETRY_MS = 3e4;
|
|
@@ -175,4 +175,4 @@ async function* readEvents(body) {
|
|
|
175
175
|
//#endregion
|
|
176
176
|
export { follow, readEvents };
|
|
177
177
|
|
|
178
|
-
//# sourceMappingURL=subscriptionStream-
|
|
178
|
+
//# sourceMappingURL=subscriptionStream-Ca5V54ee.js.map
|
package/dist/chunks/{subscriptionStream-CTiRok5u.js.map → subscriptionStream-Ca5V54ee.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptionStream-CTiRok5u.js","names":[],"sources":["../../client/subscriptionStream.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from \"react\";\n\nimport type { ChangeFeedMessage } from \"../services/change-feed/wire\";\nimport { equalJitter } from \"./retryPolicy\";\nimport type { SubscriptionConfig, SubscriptionStatus } from \"./useSubscription\";\n\n// `useSubscription`'s connection: the SSE request, its reader and the\n// reconnect loop. Loaded by the hook with a dynamic `import()` when it first\n// connects, so it lands in a chunk of its own rather than in the entry chunk\n// every route loads (#891). Import it as a type only from anywhere else.\n\nconst MIN_RETRY_MS = 1_000;\nconst MAX_RETRY_MS = 30_000;\n\n/** The server answered in a way retrying will not change (401, 403, 404). */\nclass FatalStatus extends Error {\n constructor(readonly status: number) {\n super(`The subscription was refused with ${status}.`);\n }\n}\n\nexport interface SubscriptionState {\n status: SubscriptionStatus;\n cursor: string | null;\n error: Error | null;\n}\n\nexport interface FollowOptions {\n endpoint: string;\n pauseWhenHidden: boolean;\n /** Where to resume; advanced as events arrive. */\n cursor: { current: string | null };\n callbacks: { current: SubscriptionConfig<unknown> };\n setState: Dispatch<SetStateAction<SubscriptionState>>;\n /** The jitter's random source; `Math.random` unless a test passes its own. */\n random?: () => number;\n}\n\n/**\n * Follows `endpoint` until the returned function is called: connects,\n * reconnects with backoff, pauses while the tab is hidden, and reports\n * through `setState` and `callbacks`.\n *\n * The backoff step is 1s, doubling per failed attempt up to 30s, and back to\n * 1s once a stream reaches `ready`. Each wait is jittered (\"equal jitter\", a\n * random point between half the step and all of it): a server restart ends\n * every open tab's stream in the same instant, and an exact schedule would\n * bring them all back in the same instant too. A `Retry-After` the server\n * sent is waited out exactly.\n */\nexport function follow({\n endpoint,\n pauseWhenHidden,\n cursor,\n callbacks,\n setState,\n random = Math.random,\n}: FollowOptions): () => void {\n let stopped = false;\n let request: AbortController | null = null;\n let resume: (() => void) | null = null;\n let retryMs = MIN_RETRY_MS;\n const hidden = () =>\n pauseWhenHidden && typeof document !== \"undefined\" && document.visibilityState === \"hidden\";\n const onVisibilityChange = () => {\n if (hidden()) request?.abort();\n else resume?.();\n };\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n }\n const wait = (ms: number) =>\n new Promise<void>((resolve) => {\n const timer = setTimeout(done, ms);\n function done() {\n clearTimeout(timer);\n resume = null;\n resolve();\n }\n // Shown again, or unmounted: stop waiting.\n resume = done;\n });\n\n void (async () => {\n while (!stopped) {\n if (hidden()) {\n setState((s) => ({ ...s, status: \"paused\" }));\n await new Promise<void>((resolve) => (resume = resolve));\n resume = null;\n continue;\n }\n setState((s) => ({ ...s, status: \"connecting\" }));\n const controller = (request = new AbortController());\n let delay = retryMs;\n let exact = false;\n try {\n const headers: Record<string, string> = { Accept: \"text/event-stream\" };\n if (cursor.current) headers[\"Last-Event-ID\"] = cursor.current;\n const response = await fetch(endpoint, { headers, signal: controller.signal });\n if (!response.ok || !response.body) {\n const status = response.status;\n if (status >= 400 && status < 500 && status !== 408 && status !== 429) {\n throw new FatalStatus(status);\n }\n const retryAfter = Number(response.headers.get(\"Retry-After\"));\n if (Number.isFinite(retryAfter) && retryAfter > 0) {\n delay = retryAfter * 1000;\n exact = true;\n }\n throw new Error(`The subscription answered ${status}.`);\n }\n for await (const { id, message } of readEvents(response.body)) {\n if (stopped) return;\n if (id !== undefined) cursor.current = id;\n if (message.type === \"ready\") {\n retryMs = MIN_RETRY_MS;\n delay = MIN_RETRY_MS;\n setState({ status: \"open\", cursor: cursor.current, error: null });\n } else {\n setState((s) => ({ ...s, cursor: cursor.current }));\n if (message.type === \"change\") callbacks.current.onChange?.(message as never);\n else if (message.type === \"reset\") callbacks.current.onReset?.(message as never);\n }\n }\n } catch (error) {\n if (stopped) return;\n if (error instanceof FatalStatus) {\n setState((s) => ({ ...s, status: \"closed\", error }));\n return;\n }\n // Aborted because the tab was hidden: the loop pauses instead.\n if (controller.signal.aborted) continue;\n setState((s) => ({ ...s, error: error as Error }));\n }\n if (stopped || controller.signal.aborted) continue;\n // The stream ended or failed: try again, a little later each time.\n setState((s) => ({ ...s, status: \"connecting\" }));\n await wait(exact ? delay : equalJitter(delay, random));\n retryMs = Math.min(retryMs * 2, MAX_RETRY_MS);\n }\n })();\n\n return () => {\n stopped = true;\n request?.abort();\n resume?.();\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n }\n };\n}\n\n/**\n * The events of an SSE body: `id` and the JSON `data`. Comments (keepalives)\n * and events without data are skipped; an event whose data is not JSON is\n * dropped rather than ending the stream.\n */\nexport async function* readEvents(\n body: ReadableStream<Uint8Array>,\n): AsyncGenerator<{ id?: string; message: ChangeFeedMessage }> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) return;\n // `ChangeFeed.stream` writes `\\n` only; a proxy's `\\r\\n` is folded here.\n buffer = (buffer + decoder.decode(value, { stream: true })).replace(/\\r\\n?/g, \"\\n\");\n let boundary = buffer.indexOf(\"\\n\\n\");\n while (boundary !== -1) {\n const block = buffer.slice(0, boundary);\n buffer = buffer.slice(boundary + 2);\n boundary = buffer.indexOf(\"\\n\\n\");\n let id: string | undefined;\n const data: string[] = [];\n for (const line of block.split(\"\\n\")) {\n if (line === \"\" || line.startsWith(\":\")) continue;\n const colon = line.indexOf(\":\");\n const field = colon === -1 ? line : line.slice(0, colon);\n let text = colon === -1 ? \"\" : line.slice(colon + 1);\n if (text.startsWith(\" \")) text = text.slice(1);\n if (field === \"id\") id = text;\n else if (field === \"data\") data.push(text);\n }\n if (data.length === 0) continue;\n try {\n yield { id, message: JSON.parse(data.join(\"\\n\")) };\n } catch {\n // Not JSON: not ours to apply.\n }\n }\n }\n } finally {\n await reader.cancel().catch(() => {});\n }\n}\n"],"mappings":";;AAWA,IAAM,eAAe;AACrB,IAAM,eAAe;;AAGrB,IAAM,cAAN,cAA0B,MAAM;CACT;CAArB,YAAY,QAAyB;EACnC,MAAM,qCAAqC,OAAO,EAAE;EADjC,KAAA,SAAA;CAErB;AACF;;;;;;;;;;;;;AA+BA,SAAgB,OAAO,EACrB,UACA,iBACA,QACA,WACA,UACA,SAAS,KAAK,UACc;CAC5B,IAAI,UAAU;CACd,IAAI,UAAkC;CACtC,IAAI,SAA8B;CACl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,KAAK,CAAC,EAAA,CAAG,QAAQ,UAAU,IAAI;GAClF,IAAI,WAAW,OAAO,QAAQ,MAAM;GACpC,OAAO,aAAa,IAAI;IACtB,MAAM,QAAQ,OAAO,MAAM,GAAG,QAAQ;IACtC,SAAS,OAAO,MAAM,WAAW,CAAC;IAClC,WAAW,OAAO,QAAQ,MAAM;IAChC,IAAI;IACJ,MAAM,OAAiB,CAAC;IACxB,KAAK,MAAM,QAAQ,MAAM,MAAM,IAAI,GAAG;KACpC,IAAI,SAAS,MAAM,KAAK,WAAW,GAAG,GAAG;KACzC,MAAM,QAAQ,KAAK,QAAQ,GAAG;KAC9B,MAAM,QAAQ,UAAU,KAAK,OAAO,KAAK,MAAM,GAAG,KAAK;KACvD,IAAI,OAAO,UAAU,KAAK,KAAK,KAAK,MAAM,QAAQ,CAAC;KACnD,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO,KAAK,MAAM,CAAC;KAC7C,IAAI,UAAU,MAAM,KAAK;UACpB,IAAI,UAAU,QAAQ,KAAK,KAAK,IAAI;IAC3C;IACA,IAAI,KAAK,WAAW,GAAG;IACvB,IAAI;KACF,MAAM;MAAE;MAAI,SAAS,KAAK,MAAM,KAAK,KAAK,IAAI,CAAC;KAAE;IACnD,QAAQ,CAER;GACF;EACF;CACF,UAAU;EACR,MAAM,OAAO,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;CACtC;AACF"}
|
|
1
|
+
{"version":3,"file":"subscriptionStream-Ca5V54ee.js","names":[],"sources":["../../client/subscriptionStream.ts"],"sourcesContent":["import type { Dispatch, SetStateAction } from \"react\";\n\nimport type { ChangeFeedMessage } from \"../services/change-feed/wire\";\nimport { equalJitter } from \"./retryPolicy\";\nimport type { SubscriptionConfig, SubscriptionStatus } from \"./useSubscription\";\n\n// `useSubscription`'s connection: the SSE request, its reader and the\n// reconnect loop. Loaded by the hook with a dynamic `import()` when it first\n// connects, so it lands in a chunk of its own rather than in the entry chunk\n// every route loads (#891). Import it as a type only from anywhere else.\n\nconst MIN_RETRY_MS = 1_000;\nconst MAX_RETRY_MS = 30_000;\n\n/** The server answered in a way retrying will not change (401, 403, 404). */\nclass FatalStatus extends Error {\n constructor(readonly status: number) {\n super(`The subscription was refused with ${status}.`);\n }\n}\n\nexport interface SubscriptionState {\n status: SubscriptionStatus;\n cursor: string | null;\n error: Error | null;\n}\n\nexport interface FollowOptions {\n endpoint: string;\n pauseWhenHidden: boolean;\n /** Where to resume; advanced as events arrive. */\n cursor: { current: string | null };\n callbacks: { current: SubscriptionConfig<unknown> };\n setState: Dispatch<SetStateAction<SubscriptionState>>;\n /** The jitter's random source; `Math.random` unless a test passes its own. */\n random?: () => number;\n}\n\n/**\n * Follows `endpoint` until the returned function is called: connects,\n * reconnects with backoff, pauses while the tab is hidden, and reports\n * through `setState` and `callbacks`.\n *\n * The backoff step is 1s, doubling per failed attempt up to 30s, and back to\n * 1s once a stream reaches `ready`. Each wait is jittered (\"equal jitter\", a\n * random point between half the step and all of it): a server restart ends\n * every open tab's stream in the same instant, and an exact schedule would\n * bring them all back in the same instant too. A `Retry-After` the server\n * sent is waited out exactly.\n */\nexport function follow({\n endpoint,\n pauseWhenHidden,\n cursor,\n callbacks,\n setState,\n random = Math.random,\n}: FollowOptions): () => void {\n let stopped = false;\n let request: AbortController | null = null;\n let resume: (() => void) | null = null;\n let retryMs = MIN_RETRY_MS;\n const hidden = () =>\n pauseWhenHidden && typeof document !== \"undefined\" && document.visibilityState === \"hidden\";\n const onVisibilityChange = () => {\n if (hidden()) request?.abort();\n else resume?.();\n };\n if (typeof document !== \"undefined\") {\n document.addEventListener(\"visibilitychange\", onVisibilityChange);\n }\n const wait = (ms: number) =>\n new Promise<void>((resolve) => {\n const timer = setTimeout(done, ms);\n function done() {\n clearTimeout(timer);\n resume = null;\n resolve();\n }\n // Shown again, or unmounted: stop waiting.\n resume = done;\n });\n\n void (async () => {\n while (!stopped) {\n if (hidden()) {\n setState((s) => ({ ...s, status: \"paused\" }));\n await new Promise<void>((resolve) => (resume = resolve));\n resume = null;\n continue;\n }\n setState((s) => ({ ...s, status: \"connecting\" }));\n const controller = (request = new AbortController());\n let delay = retryMs;\n let exact = false;\n try {\n const headers: Record<string, string> = { Accept: \"text/event-stream\" };\n if (cursor.current) headers[\"Last-Event-ID\"] = cursor.current;\n const response = await fetch(endpoint, { headers, signal: controller.signal });\n if (!response.ok || !response.body) {\n const status = response.status;\n if (status >= 400 && status < 500 && status !== 408 && status !== 429) {\n throw new FatalStatus(status);\n }\n const retryAfter = Number(response.headers.get(\"Retry-After\"));\n if (Number.isFinite(retryAfter) && retryAfter > 0) {\n delay = retryAfter * 1000;\n exact = true;\n }\n throw new Error(`The subscription answered ${status}.`);\n }\n for await (const { id, message } of readEvents(response.body)) {\n if (stopped) return;\n if (id !== undefined) cursor.current = id;\n if (message.type === \"ready\") {\n retryMs = MIN_RETRY_MS;\n delay = MIN_RETRY_MS;\n setState({ status: \"open\", cursor: cursor.current, error: null });\n } else {\n setState((s) => ({ ...s, cursor: cursor.current }));\n if (message.type === \"change\") callbacks.current.onChange?.(message as never);\n else if (message.type === \"reset\") callbacks.current.onReset?.(message as never);\n }\n }\n } catch (error) {\n if (stopped) return;\n if (error instanceof FatalStatus) {\n setState((s) => ({ ...s, status: \"closed\", error }));\n return;\n }\n // Aborted because the tab was hidden: the loop pauses instead.\n if (controller.signal.aborted) continue;\n setState((s) => ({ ...s, error: error as Error }));\n }\n if (stopped || controller.signal.aborted) continue;\n // The stream ended or failed: try again, a little later each time.\n setState((s) => ({ ...s, status: \"connecting\" }));\n await wait(exact ? delay : equalJitter(delay, random));\n retryMs = Math.min(retryMs * 2, MAX_RETRY_MS);\n }\n })();\n\n return () => {\n stopped = true;\n request?.abort();\n resume?.();\n if (typeof document !== \"undefined\") {\n document.removeEventListener(\"visibilitychange\", onVisibilityChange);\n }\n };\n}\n\n/**\n * The events of an SSE body: `id` and the JSON `data`. Comments (keepalives)\n * and events without data are skipped; an event whose data is not JSON is\n * dropped rather than ending the stream.\n */\nexport async function* readEvents(\n body: ReadableStream<Uint8Array>,\n): AsyncGenerator<{ id?: string; message: ChangeFeedMessage }> {\n const reader = body.getReader();\n const decoder = new TextDecoder();\n let buffer = \"\";\n try {\n for (;;) {\n const { done, value } = await reader.read();\n if (done) return;\n // `ChangeFeed.stream` writes `\\n` only; a proxy's `\\r\\n` is folded here.\n buffer = (buffer + decoder.decode(value, { stream: true })).replace(/\\r\\n?/g, \"\\n\");\n let boundary = buffer.indexOf(\"\\n\\n\");\n while (boundary !== -1) {\n const block = buffer.slice(0, boundary);\n buffer = buffer.slice(boundary + 2);\n boundary = buffer.indexOf(\"\\n\\n\");\n let id: string | undefined;\n const data: string[] = [];\n for (const line of block.split(\"\\n\")) {\n if (line === \"\" || line.startsWith(\":\")) continue;\n const colon = line.indexOf(\":\");\n const field = colon === -1 ? line : line.slice(0, colon);\n let text = colon === -1 ? \"\" : line.slice(colon + 1);\n if (text.startsWith(\" \")) text = text.slice(1);\n if (field === \"id\") id = text;\n else if (field === \"data\") data.push(text);\n }\n if (data.length === 0) continue;\n try {\n yield { id, message: JSON.parse(data.join(\"\\n\")) };\n } catch {\n // Not JSON: not ours to apply.\n }\n }\n }\n } finally {\n await reader.cancel().catch(() => {});\n }\n}\n"],"mappings":";;AAWA,IAAM,eAAe;AACrB,IAAM,eAAe;;AAGrB,IAAM,cAAN,cAA0B,MAAM;CACT;CAArB,YAAY,QAAyB;EACnC,MAAM,qCAAqC,OAAO,EAAE;EADjC,KAAA,SAAA;CAErB;AACF;;;;;;;;;;;;;AA+BA,SAAgB,OAAO,EACrB,UACA,iBACA,QACA,WACA,UACA,SAAS,KAAK,UACc;CAC5B,IAAI,UAAU;CACd,IAAI,UAAkC;CACtC,IAAI,SAA8B;CAClC,IAAI,UAAU;CACd,MAAM,eACJ,mBAAmB,OAAO,aAAa,eAAe,SAAS,oBAAoB;CACrF,MAAM,2BAA2B;EAC/B,IAAI,OAAO,GAAG,SAAS,MAAM;OACxB,SAAS;CAChB;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;IACtC,SAAS,OAAO,MAAM,WAAW,CAAC;IAClC,WAAW,OAAO,QAAQ,MAAM;IAChC,IAAI;IACJ,MAAM,OAAiB,CAAC;IACxB,KAAK,MAAM,QAAQ,MAAM,MAAM,IAAI,GAAG;KACpC,IAAI,SAAS,MAAM,KAAK,WAAW,GAAG,GAAG;KACzC,MAAM,QAAQ,KAAK,QAAQ,GAAG;KAC9B,MAAM,QAAQ,UAAU,KAAK,OAAO,KAAK,MAAM,GAAG,KAAK;KACvD,IAAI,OAAO,UAAU,KAAK,KAAK,KAAK,MAAM,QAAQ,CAAC;KACnD,IAAI,KAAK,WAAW,GAAG,GAAG,OAAO,KAAK,MAAM,CAAC;KAC7C,IAAI,UAAU,MAAM,KAAK;UACpB,IAAI,UAAU,QAAQ,KAAK,KAAK,IAAI;IAC3C;IACA,IAAI,KAAK,WAAW,GAAG;IACvB,IAAI;KACF,MAAM;MAAE;MAAI,SAAS,KAAK,MAAM,KAAK,KAAK,IAAI,CAAC;KAAE;IACnD,QAAQ,CAER;GACF;EACF;CACF,UAAU;EACR,MAAM,OAAO,OAAO,CAAC,CAAC,YAAY,CAAC,CAAC;CACtC;AACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PropsWithChildren } from "react";
|
|
1
|
+
import { type PropsWithChildren, type ReactElement } from "react";
|
|
2
2
|
import { QueryResource } from "./QueryResource";
|
|
3
3
|
import type { RetryDelayOption, RetryOption } from "./retryPolicy";
|
|
4
4
|
/**
|
|
@@ -72,6 +72,22 @@ export interface QueryManagerContextValue {
|
|
|
72
72
|
clearErrors: () => void;
|
|
73
73
|
}
|
|
74
74
|
export declare const QueryManagerContext: import("react").Context<QueryManagerContextValue>;
|
|
75
|
+
/** The key the island runtime (`h`) finds the islands' query cache under. */
|
|
76
|
+
export declare const ISLAND_QUERIES_KEY = "gemi.islandQueries";
|
|
77
|
+
/**
|
|
78
|
+
* The query cache the islands of a static page share (#1155), on
|
|
79
|
+
* `globalThis` for the island runtime, which has no imports of gemi's: it
|
|
80
|
+
* wraps each island in `Provider`, and before hydrating one `seed`s the cache
|
|
81
|
+
* with the document's `gemi-island-queries` block, so `useQuery` hydrates
|
|
82
|
+
* with the data the server rendered and fetches nothing. Without it an
|
|
83
|
+
* island's `useQuery` had no cache at all (a new resource per render).
|
|
84
|
+
* Registered when `gemi/client` loads, so an island that never imports it
|
|
85
|
+
* (and so reads no query) is left as it was.
|
|
86
|
+
*/
|
|
87
|
+
export interface IslandQueries {
|
|
88
|
+
seed: (prefetchedData: PrefetchedData) => void;
|
|
89
|
+
Provider: (props: PropsWithChildren) => ReactElement;
|
|
90
|
+
}
|
|
75
91
|
export declare const QueryManagerProvider: ({ children, queryConfig, }: PropsWithChildren<{
|
|
76
92
|
queryConfig?: QueryConfig | null;
|
|
77
93
|
}>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryManagerContext.d.ts","sourceRoot":"","sources":["../../client/QueryManagerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"QueryManagerContext.d.ts","sourceRoot":"","sources":["../../client/QueryManagerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAGlB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAKnE;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,2EAA2E;IAC3E,UAAU,CAA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CAAC,cAAc,CAAC,EAAE,cAAc,GAAG,IAAI,KAAK,IAAI,CAAC;IAC1D,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,mBAAmB,mDAM9B,CAAC;AA8CH,6EAA6E;AAC7E,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,IAAI,CAAC;IAC/C,QAAQ,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,YAAY,CAAC;CACtD;AAgBD,eAAO,MAAM,oBAAoB,GAAI,4BAGlC,iBAAiB,CAAC;IAAE,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAA;CAAE,CAAC,4CAmDzD,CAAC"}
|
|
@@ -11,15 +11,21 @@ export interface ServerQueryEntryLike {
|
|
|
11
11
|
promise: Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
export interface ServerQueriesLike {
|
|
14
|
+
/**
|
|
15
|
+
* The query's entry, started or joined. `null` when this store does not
|
|
16
|
+
* serve the query: an island on a static page only reads what the request
|
|
17
|
+
* prefetched (#1155), and renders any other query as it would with no store.
|
|
18
|
+
*/
|
|
14
19
|
ensure(path: string, options?: {
|
|
15
20
|
params?: Record<string, any>;
|
|
16
21
|
search?: Record<string, string | number | boolean | null>;
|
|
17
|
-
}, source?: "prefetch" | "render"): ServerQueryEntryLike;
|
|
22
|
+
}, source?: "prefetch" | "render"): ServerQueryEntryLike | null;
|
|
18
23
|
}
|
|
19
24
|
/**
|
|
20
|
-
* Populated only during a
|
|
21
|
-
*
|
|
22
|
-
* runs on `QueryResource`
|
|
25
|
+
* Populated only during a server render (`createRoot` threads the request's
|
|
26
|
+
* store through, and a static view gives each island's root a view of it);
|
|
27
|
+
* always `null` in the browser, where suspension runs on `QueryResource`
|
|
28
|
+
* instead.
|
|
23
29
|
*/
|
|
24
30
|
export declare const ServerQueryContext: import("react").Context<ServerQueriesLike>;
|
|
25
31
|
//# sourceMappingURL=ServerQueryContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerQueryContext.d.ts","sourceRoot":"","sources":["../../client/ServerQueryContext.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC5C,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;KAC3D,EACD,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,GAC7B,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"ServerQueryContext.d.ts","sourceRoot":"","sources":["../../client/ServerQueryContext.tsx"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;IAC5C,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,MAAM,CACJ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE;QACR,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC,CAAC;KAC3D,EACD,MAAM,CAAC,EAAE,UAAU,GAAG,QAAQ,GAC7B,oBAAoB,GAAG,IAAI,CAAC;CAChC;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,4CAAgD,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as QueryManagerProvider, A as useNavigate, C as loadDictionaryForRender, D as routeDataUrl, E as readRoutePayload, F as useLocation, G as realtime, H as configureRealtime, I as domainUrl, J as loadedModule, K as reconnectRealtime, L as isAbsoluteUrl, M as I18nProvider, N as ServerDataContext, O as useRoute, P as ServerDataProvider, Q as QueryManagerContext, S as loadDictionary, T as setActiveLocale, U as followLive, V as RealtimeContext, X as applyParams$1, Y as toVariantKey, Z as QueryConfigContext, _ as isChunkLoadError, _t as Subject, a as useRouteTransition, at as resetAuthenticationIncident, b as recoverFromBuildMismatch, c as ClientRouterContext, ct as isExternalRedirect, d as ComponentsProvider, et as USER_QUERY_CONFIG_KEYS, f as initialViewModulesReady, ft as isRetryableQueryError, g as configureChunkLoadRecovery, gt as QueryError, h as CHUNK_RELOAD_MARKER, ht as shouldRetryQuery, i as RouteTransitionProvider, it as reportAuthenticationRefusal, j as I18nContext, k as useSearchParams, l as ClientRouterProvider, lt as safeRedirectPath, m as subscribeViewModules, mt as retryDelayFor, n as useTheme, nt as DEFAULT_STALE_TIME, o as useChannelSubscription, ot as setAuthenticationNavigator, p as loadViewModule, q as loadLazy, r as m, rt as configureAuthenticationErrors, s as useCoalesced, st as INTENDED_URL_PARAM, t as ThemeProvider, tt as pickDefined, u as ComponentsContext, ut as readResponseBody, v as navigationStarted, w as registerDictionary, x as recoverFromChunkLoadError, y as otherBuild, z as Action } from "../chunks/ThemeProvider-
|
|
1
|
+
import { $ as QueryManagerProvider, A as useNavigate, C as loadDictionaryForRender, D as routeDataUrl, E as readRoutePayload, F as useLocation, G as realtime, H as configureRealtime, I as domainUrl, J as loadedModule, K as reconnectRealtime, L as isAbsoluteUrl, M as I18nProvider, N as ServerDataContext, O as useRoute, P as ServerDataProvider, Q as QueryManagerContext, S as loadDictionary, T as setActiveLocale, U as followLive, V as RealtimeContext, X as applyParams$1, Y as toVariantKey, Z as QueryConfigContext, _ as isChunkLoadError, _t as Subject, a as useRouteTransition, at as resetAuthenticationIncident, b as recoverFromBuildMismatch, c as ClientRouterContext, ct as isExternalRedirect, d as ComponentsProvider, et as USER_QUERY_CONFIG_KEYS, f as initialViewModulesReady, ft as isRetryableQueryError, g as configureChunkLoadRecovery, gt as QueryError, h as CHUNK_RELOAD_MARKER, ht as shouldRetryQuery, i as RouteTransitionProvider, it as reportAuthenticationRefusal, j as I18nContext, k as useSearchParams, l as ClientRouterProvider, lt as safeRedirectPath, m as subscribeViewModules, mt as retryDelayFor, n as useTheme, nt as DEFAULT_STALE_TIME, o as useChannelSubscription, ot as setAuthenticationNavigator, p as loadViewModule, q as loadLazy, r as m, rt as configureAuthenticationErrors, s as useCoalesced, st as INTENDED_URL_PARAM, t as ThemeProvider, tt as pickDefined, u as ComponentsContext, ut as readResponseBody, v as navigationStarted, w as registerDictionary, x as recoverFromChunkLoadError, y as otherBuild, z as Action } from "../chunks/ThemeProvider-BnmnRvEc.js";
|
|
2
2
|
import { n as RouteStateContext, r as RouteStateProvider, t as useParams } from "../chunks/useParams-BN3XXfmG.js";
|
|
3
3
|
import { a as isNetworkError, c as isPermissionError, d as isValidationError, f as mutationErrorField, h as mutationErrorList, i as isHttpError, l as isRateLimitError, m as mutationErrorKind, n as isCsrfError, o as isNotFoundError, p as mutationErrorFromBody, r as isFormError, s as isObject, t as isAuthenticationError, u as isServerError } from "../chunks/MutationError-DuKqBW8o.js";
|
|
4
4
|
import { Fragment, StrictMode, Suspense, createContext, createElement, isValidElement, lazy, memo, use, useCallback, useContext, useDeferredValue, useEffect, useInsertionEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
@@ -6,9 +6,10 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { createRoot as createRoot$1, hydrateRoot } from "react-dom/client";
|
|
7
7
|
//#region client/ServerQueryContext.tsx
|
|
8
8
|
/**
|
|
9
|
-
* Populated only during a
|
|
10
|
-
*
|
|
11
|
-
* runs on `QueryResource`
|
|
9
|
+
* Populated only during a server render (`createRoot` threads the request's
|
|
10
|
+
* store through, and a static view gives each island's root a view of it);
|
|
11
|
+
* always `null` in the browser, where suspension runs on `QueryResource`
|
|
12
|
+
* instead.
|
|
12
13
|
*/
|
|
13
14
|
var ServerQueryContext = createContext(null);
|
|
14
15
|
//#endregion
|
|
@@ -146,24 +147,24 @@ function useFrameworkQuery(url, ...args) {
|
|
|
146
147
|
};
|
|
147
148
|
let readPromise;
|
|
148
149
|
let serverError;
|
|
150
|
+
let unserved = !serverQueries;
|
|
149
151
|
if (suspense && !state?.hasData && !state?.error) if (typeof window === "undefined") {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
152
|
+
const entry = serverQueries?.ensure(url, {
|
|
153
|
+
params,
|
|
154
|
+
search
|
|
155
|
+
}) ?? null;
|
|
156
|
+
unserved = !entry;
|
|
157
|
+
if (entry) if (entry.status === "resolved") state = {
|
|
158
|
+
loading: false,
|
|
159
|
+
data: entry.data,
|
|
160
|
+
hasData: true,
|
|
161
|
+
error: null,
|
|
162
|
+
version: 0
|
|
163
|
+
};
|
|
164
|
+
else if (entry.status === "rejected") serverError = entry.error;
|
|
165
|
+
else readPromise = entry.promise;
|
|
165
166
|
} else readPromise = resource.read(variantKey, config.staleTime).promise;
|
|
166
|
-
if (suspense && typeof window === "undefined" &&
|
|
167
|
+
if (suspense && typeof window === "undefined" && unserved && !state?.hasData && process.env.NODE_ENV !== "production") {
|
|
167
168
|
const searchHint = variantKey ? `, { search: ${JSON.stringify(Object.fromEntries(new URLSearchParams(variantKey)))} }` : "";
|
|
168
169
|
console.warn(`[gemi] useQuery("${url}") rendered on the server without data. The server never fetches, so this page ships without it and the client suspends after hydration. Add \`Query.prefetch("${url}"${searchHint})\` to the route's view handler.`);
|
|
169
170
|
}
|
|
@@ -561,7 +562,7 @@ var SOCKET_ID_HEADER = "x-gemi-socket";
|
|
|
561
562
|
*/
|
|
562
563
|
var mutationExtras = {
|
|
563
564
|
current: null,
|
|
564
|
-
load: () => import("../chunks/mutationExtras-
|
|
565
|
+
load: () => import("../chunks/mutationExtras-DgdYjcaa.js")
|
|
565
566
|
};
|
|
566
567
|
/** Starts loading `./mutationExtras`: the hooks' mount effect. */
|
|
567
568
|
function preloadMutationExtras() {
|
|
@@ -919,7 +920,7 @@ function useMutate() {
|
|
|
919
920
|
//#region client/fetchFile.ts
|
|
920
921
|
var request = {
|
|
921
922
|
current: null,
|
|
922
|
-
load: () => import("../chunks/fetchFileRequest-
|
|
923
|
+
load: () => import("../chunks/fetchFileRequest-D4fAcY7D.js")
|
|
923
924
|
};
|
|
924
925
|
/**
|
|
925
926
|
* Downloads a file route's body as a `Blob`.
|
|
@@ -985,7 +986,7 @@ function useSetQueryData() {
|
|
|
985
986
|
//#endregion
|
|
986
987
|
//#region client/useSubscription.ts
|
|
987
988
|
/** `./subscriptionStream`, loaded on first use. Replaceable in tests. */
|
|
988
|
-
var streamModule = { load: () => import("../chunks/subscriptionStream-
|
|
989
|
+
var streamModule = { load: () => import("../chunks/subscriptionStream-Ca5V54ee.js") };
|
|
989
990
|
/**
|
|
990
991
|
* Follows a route that answers with `ChangeFeed.stream`, as long as the
|
|
991
992
|
* component is mounted: each change reaches `onChange`, in order, exactly
|
|
@@ -3145,6 +3146,7 @@ function assertSerialisableProps(value, island) {
|
|
|
3145
3146
|
};
|
|
3146
3147
|
walk(value, "", false);
|
|
3147
3148
|
}
|
|
3149
|
+
var withQueryManager = (manager, element) => manager ? createElement(QueryManagerContext.Provider, { value: manager }, element) : element;
|
|
3148
3150
|
var hasChildren = (children) => children !== void 0 && children !== null && typeof children !== "boolean";
|
|
3149
3151
|
function island(loader, options = {}) {
|
|
3150
3152
|
if (typeof loader !== "function") throw new Error("island() takes `() => import(\"./Component\")` and options since gemi 0.110. The island(\"name\", Component, () => import(\"./x.island\")) form was removed: see UPGRADE.md.");
|
|
@@ -3177,10 +3179,10 @@ function island(loader, options = {}) {
|
|
|
3177
3179
|
const { children, ...rest } = props;
|
|
3178
3180
|
if (!isProduction()) assertSerialisableProps(rest, label);
|
|
3179
3181
|
const uid = `i${collector.count++}-`;
|
|
3180
|
-
const html = (loader.gemiModule ? Promise.resolve(pick(loader.gemiModule)) : loader().then(pick)).then((Component) => collector.render(createElement(StaticRenderContext.Provider, { value: null }, createElement(IslandI18nContext.Provider, { value: collector.i18n }, createElement(DictionarySinkContext.Provider, { value: collector.sink }, hasChildren(children) ? createElement(Component, rest, createElement(ISLAND_SLOT_TAG, {
|
|
3182
|
+
const html = (loader.gemiModule ? Promise.resolve(pick(loader.gemiModule)) : loader().then(pick)).then((Component) => collector.render(createElement(StaticRenderContext.Provider, { value: null }, createElement(IslandI18nContext.Provider, { value: collector.i18n }, createElement(DictionarySinkContext.Provider, { value: collector.sink }, createElement(ServerQueryContext.Provider, { value: collector.queries }, withQueryManager(collector.createQueryManager(), hasChildren(children) ? createElement(Component, rest, createElement(ISLAND_SLOT_TAG, {
|
|
3181
3183
|
[ISLAND_SLOT_ATTRIBUTE]: uid,
|
|
3182
3184
|
style: { display: "contents" }
|
|
3183
|
-
})) : createElement(Component, rest)))), uid));
|
|
3185
|
+
})) : createElement(Component, rest)))))), uid));
|
|
3184
3186
|
html.catch(() => {});
|
|
3185
3187
|
const json = JSON.stringify(rest);
|
|
3186
3188
|
return {
|