gemi 0.129.0 → 0.131.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/App.d.ts +9 -0
- package/dist/app/App.d.ts.map +1 -1
- package/dist/app/index.js +1 -1
- package/dist/bin/gemi.js +182 -128
- package/dist/bin/gemi.js.map +7 -6
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-t7gvgz20.js → chunk-0g5f8ymy.js} +2 -2
- package/dist/{chunk-t7gvgz20.js.map → chunk-0g5f8ymy.js.map} +1 -1
- package/dist/{chunk-peng31np.js → chunk-0q68t71d.js} +3 -3
- package/dist/{chunk-peng31np.js.map → chunk-0q68t71d.js.map} +1 -1
- package/dist/{chunk-vc5kpxdk.js → chunk-2senwsdq.js} +2 -2
- package/dist/{chunk-vc5kpxdk.js.map → chunk-2senwsdq.js.map} +1 -1
- package/dist/{chunk-2869cbhd.js → chunk-2tda49mv.js} +3 -3
- package/dist/{chunk-2869cbhd.js.map → chunk-2tda49mv.js.map} +1 -1
- package/dist/{chunk-1z311hyj.js → chunk-2x0n3ze1.js} +2 -2
- package/dist/{chunk-1z311hyj.js.map → chunk-2x0n3ze1.js.map} +1 -1
- package/dist/{chunk-cp84b0ev.js → chunk-35zw2s61.js} +3 -3
- package/dist/{chunk-cp84b0ev.js.map → chunk-35zw2s61.js.map} +1 -1
- package/dist/{chunk-zw5z1k84.js → chunk-3wnczt5w.js} +3 -3
- package/dist/{chunk-zw5z1k84.js.map → chunk-3wnczt5w.js.map} +3 -3
- package/dist/{chunk-v09w6pr2.js → chunk-3xy41vc0.js} +3 -3
- package/dist/{chunk-v09w6pr2.js.map → chunk-3xy41vc0.js.map} +1 -1
- package/dist/{chunk-fezaxj28.js → chunk-47eav3ex.js} +2 -2
- package/dist/{chunk-fezaxj28.js.map → chunk-47eav3ex.js.map} +1 -1
- package/dist/{chunk-ww86zqbw.js → chunk-4gmhx2ba.js} +2 -2
- package/dist/{chunk-ww86zqbw.js.map → chunk-4gmhx2ba.js.map} +1 -1
- package/dist/{chunk-k10vbrjx.js → chunk-4wda9teq.js} +3 -3
- package/dist/{chunk-k10vbrjx.js.map → chunk-4wda9teq.js.map} +1 -1
- package/dist/{chunk-ja41ts8v.js → chunk-4z0rt6ws.js} +2 -2
- package/dist/{chunk-ja41ts8v.js.map → chunk-4z0rt6ws.js.map} +1 -1
- package/dist/{chunk-sbdm4enk.js → chunk-539w9yt3.js} +2 -2
- package/dist/{chunk-sbdm4enk.js.map → chunk-539w9yt3.js.map} +1 -1
- package/dist/{chunk-9122838b.js → chunk-58mg4rpd.js} +2 -2
- package/dist/{chunk-9122838b.js.map → chunk-58mg4rpd.js.map} +1 -1
- package/dist/{chunk-0m2fyw7g.js → chunk-63xekerg.js} +2 -2
- package/dist/{chunk-0m2fyw7g.js.map → chunk-63xekerg.js.map} +1 -1
- package/dist/{chunk-qv8sj2z3.js → chunk-65fq5a9d.js} +2 -2
- package/dist/{chunk-qv8sj2z3.js.map → chunk-65fq5a9d.js.map} +1 -1
- package/dist/{chunk-bg5qb9hm.js → chunk-65s63bdh.js} +2 -2
- package/dist/{chunk-bg5qb9hm.js.map → chunk-65s63bdh.js.map} +1 -1
- package/dist/chunk-77ymcf7q.js +4 -0
- package/dist/chunk-77ymcf7q.js.map +10 -0
- package/dist/{chunk-wn437678.js → chunk-7j48ymk1.js} +2 -2
- package/dist/{chunk-wn437678.js.map → chunk-7j48ymk1.js.map} +1 -1
- package/dist/{chunk-dak8txaw.js → chunk-7n0zn5h4.js} +2 -2
- package/dist/{chunk-dak8txaw.js.map → chunk-7n0zn5h4.js.map} +1 -1
- package/dist/{chunk-p528pvmm.js → chunk-822p54vc.js} +2 -2
- package/dist/{chunk-p528pvmm.js.map → chunk-822p54vc.js.map} +1 -1
- package/dist/{chunk-qjmcn5m5.js → chunk-838cdh6v.js} +2 -2
- package/dist/{chunk-qjmcn5m5.js.map → chunk-838cdh6v.js.map} +1 -1
- package/dist/{chunk-h55c9bdf.js → chunk-8fvt7kys.js} +1 -1
- package/dist/{chunk-xtnbcbkf.js → chunk-aprjvzrz.js} +2 -2
- package/dist/{chunk-nvfhx9d1.js.map → chunk-aprjvzrz.js.map} +1 -1
- package/dist/{chunk-sh39q44t.js → chunk-asmszzkp.js} +3 -3
- package/dist/{chunk-sh39q44t.js.map → chunk-asmszzkp.js.map} +1 -1
- package/dist/{chunk-nvfhx9d1.js → chunk-ayjfs5mm.js} +2 -2
- package/dist/{chunk-xtnbcbkf.js.map → chunk-ayjfs5mm.js.map} +1 -1
- package/dist/{chunk-kmcnfk2s.js → chunk-b00z33zg.js} +1 -1
- package/dist/{chunk-pgddb43b.js → chunk-c1gq2ttb.js} +2 -2
- package/dist/{chunk-pgddb43b.js.map → chunk-c1gq2ttb.js.map} +1 -1
- package/dist/{chunk-0vxwrc4t.js → chunk-cggywjzz.js} +2 -2
- package/dist/{chunk-0vxwrc4t.js.map → chunk-cggywjzz.js.map} +1 -1
- package/dist/{chunk-n1t4ea9g.js → chunk-d5g1caxb.js} +3 -3
- package/dist/{chunk-n1t4ea9g.js.map → chunk-d5g1caxb.js.map} +1 -1
- package/dist/{chunk-f8ce6e9c.js → chunk-dp2yz8bj.js} +2 -2
- package/dist/{chunk-f8ce6e9c.js.map → chunk-dp2yz8bj.js.map} +1 -1
- package/dist/{chunk-43vjbd6n.js → chunk-dxm5gxqk.js} +1 -1
- package/dist/{chunk-9701fx4z.js → chunk-dz76qhx8.js} +2 -2
- package/dist/{chunk-9701fx4z.js.map → chunk-dz76qhx8.js.map} +1 -1
- package/dist/{chunk-fv53h1q2.js → chunk-e1fhy2h5.js} +2 -2
- package/dist/{chunk-fv53h1q2.js.map → chunk-e1fhy2h5.js.map} +1 -1
- package/dist/{chunk-1yttk239.js → chunk-e4ay1vg9.js} +2 -2
- package/dist/{chunk-1yttk239.js.map → chunk-e4ay1vg9.js.map} +1 -1
- package/dist/{chunk-5nkvpc0a.js → chunk-f21v4n2v.js} +1 -1
- package/dist/{chunk-wv3nnq8c.js → chunk-fgtr9cds.js} +3 -3
- package/dist/{chunk-wv3nnq8c.js.map → chunk-fgtr9cds.js.map} +1 -1
- package/dist/chunk-fx7r6pdf.js +122 -0
- package/dist/{chunk-0ryswty9.js.map → chunk-fx7r6pdf.js.map} +9 -8
- package/dist/{chunk-nh9ewam0.js → chunk-fxm8fqh9.js} +1 -1
- package/dist/{chunk-tn3y2qkj.js → chunk-fzs7g6mc.js} +2 -2
- package/dist/{chunk-tn3y2qkj.js.map → chunk-fzs7g6mc.js.map} +1 -1
- package/dist/{chunk-1rq53cb0.js → chunk-gnaxedwh.js} +2 -2
- package/dist/{chunk-1rq53cb0.js.map → chunk-gnaxedwh.js.map} +1 -1
- package/dist/{chunk-njaxnv6c.js → chunk-h0xye69a.js} +2 -2
- package/dist/{chunk-njaxnv6c.js.map → chunk-h0xye69a.js.map} +1 -1
- package/dist/{chunk-ty5sp1ym.js → chunk-hdgbh8hn.js} +2 -2
- package/dist/{chunk-ty5sp1ym.js.map → chunk-hdgbh8hn.js.map} +1 -1
- package/dist/{chunk-jcps2gpp.js → chunk-hnf11jhc.js} +2 -2
- package/dist/{chunk-jcps2gpp.js.map → chunk-hnf11jhc.js.map} +1 -1
- package/dist/{chunk-vjpby5sf.js → chunk-hr8annr1.js} +3 -3
- package/dist/{chunk-vjpby5sf.js.map → chunk-hr8annr1.js.map} +1 -1
- package/dist/{chunk-k107vw69.js → chunk-j1wc4afr.js} +2 -2
- package/dist/{chunk-k107vw69.js.map → chunk-j1wc4afr.js.map} +1 -1
- package/dist/{chunk-2z1gd231.js → chunk-j4y0sjdc.js} +2 -2
- package/dist/{chunk-2z1gd231.js.map → chunk-j4y0sjdc.js.map} +1 -1
- package/dist/{chunk-er5ed5pg.js → chunk-jbd723h1.js} +3 -3
- package/dist/{chunk-er5ed5pg.js.map → chunk-jbd723h1.js.map} +1 -1
- package/dist/{chunk-5ym464xx.js → chunk-jd1afbrs.js} +4 -4
- package/dist/{chunk-5ym464xx.js.map → chunk-jd1afbrs.js.map} +1 -1
- package/dist/{chunk-xhm5wgfe.js → chunk-jxmc33m9.js} +2 -2
- package/dist/{chunk-xhm5wgfe.js.map → chunk-jxmc33m9.js.map} +1 -1
- package/dist/{chunk-pxsq9841.js → chunk-jxvec7jc.js} +2 -2
- package/dist/{chunk-pxsq9841.js.map → chunk-jxvec7jc.js.map} +1 -1
- package/dist/chunk-mvka90rq.js +5 -0
- package/dist/{chunk-pqn9j5s8.js.map → chunk-mvka90rq.js.map} +1 -1
- package/dist/{chunk-mc8mxx2a.js → chunk-mym7egdq.js} +2 -2
- package/dist/{chunk-mc8mxx2a.js.map → chunk-mym7egdq.js.map} +1 -1
- package/dist/{chunk-np73p641.js → chunk-mz73066c.js} +2 -2
- package/dist/{chunk-np73p641.js.map → chunk-mz73066c.js.map} +1 -1
- package/dist/{chunk-3dyd4z06.js → chunk-n7sbwpce.js} +2 -2
- package/dist/{chunk-3dyd4z06.js.map → chunk-n7sbwpce.js.map} +1 -1
- package/dist/{chunk-gpdsxwkt.js → chunk-p320fd3g.js} +2 -2
- package/dist/{chunk-gpdsxwkt.js.map → chunk-p320fd3g.js.map} +1 -1
- package/dist/{chunk-nwzsgzvy.js → chunk-p462p2xe.js} +2 -2
- package/dist/{chunk-nwzsgzvy.js.map → chunk-p462p2xe.js.map} +1 -1
- package/dist/{chunk-2bmk0fzm.js → chunk-p642ja42.js} +3 -3
- package/dist/{chunk-2bmk0fzm.js.map → chunk-p642ja42.js.map} +1 -1
- package/dist/{chunk-jj1ppnnk.js → chunk-p6b0cyf8.js} +2 -2
- package/dist/{chunk-jj1ppnnk.js.map → chunk-p6b0cyf8.js.map} +1 -1
- package/dist/{chunk-8jqve5dr.js → chunk-pahr13xg.js} +2 -2
- package/dist/{chunk-8jqve5dr.js.map → chunk-pahr13xg.js.map} +1 -1
- package/dist/{chunk-wf3qe12c.js → chunk-pzb3agv9.js} +2 -2
- package/dist/{chunk-wf3qe12c.js.map → chunk-pzb3agv9.js.map} +1 -1
- package/dist/{chunk-87rtxv9n.js → chunk-qspam5cf.js} +2 -2
- package/dist/{chunk-87rtxv9n.js.map → chunk-qspam5cf.js.map} +1 -1
- package/dist/{chunk-n4dk0dc9.js → chunk-qz89m7ss.js} +2 -2
- package/dist/{chunk-n4dk0dc9.js.map → chunk-qz89m7ss.js.map} +1 -1
- package/dist/{chunk-gzaaspe7.js → chunk-rjyw1thg.js} +2 -2
- package/dist/{chunk-gzaaspe7.js.map → chunk-rjyw1thg.js.map} +1 -1
- package/dist/{chunk-2epj17ac.js → chunk-t227jn4b.js} +2 -2
- package/dist/{chunk-2epj17ac.js.map → chunk-t227jn4b.js.map} +1 -1
- package/dist/{chunk-x92g4x4w.js → chunk-v5esvs66.js} +2 -2
- package/dist/{chunk-x92g4x4w.js.map → chunk-v5esvs66.js.map} +1 -1
- package/dist/{chunk-4yp84g2y.js → chunk-w26cw41m.js} +2 -2
- package/dist/{chunk-4yp84g2y.js.map → chunk-w26cw41m.js.map} +1 -1
- package/dist/{chunk-03wc6em7.js → chunk-x07rp3fc.js} +1 -1
- package/dist/{chunk-7321qjgb.js → chunk-x4yq0c9v.js} +3 -3
- package/dist/{chunk-7321qjgb.js.map → chunk-x4yq0c9v.js.map} +1 -1
- package/dist/{chunk-5bk7767a.js → chunk-xhvknqvn.js} +2 -2
- package/dist/{chunk-5bk7767a.js.map → chunk-xhvknqvn.js.map} +1 -1
- package/dist/{chunk-1gdzajwb.js → chunk-xjs72pb0.js} +2 -2
- package/dist/{chunk-1gdzajwb.js.map → chunk-xjs72pb0.js.map} +1 -1
- package/dist/{chunk-wmkrb1qv.js → chunk-y14weak4.js} +4 -4
- package/dist/{chunk-wmkrb1qv.js.map → chunk-y14weak4.js.map} +3 -3
- package/dist/{chunk-pgh7gsag.js → chunk-z1gjgr1c.js} +2 -2
- package/dist/{chunk-pgh7gsag.js.map → chunk-z1gjgr1c.js.map} +1 -1
- package/dist/{chunk-jm1f9cas.js → chunk-zc5962gh.js} +2 -2
- package/dist/{chunk-jm1f9cas.js.map → chunk-zc5962gh.js.map} +1 -1
- package/dist/{chunk-b7wmssj5.js → chunk-zzgt759n.js} +2 -2
- package/dist/{chunk-b7wmssj5.js.map → chunk-zzgt759n.js.map} +1 -1
- package/dist/chunks/MutationError-DuKqBW8o.js +199 -0
- package/dist/chunks/MutationError-DuKqBW8o.js.map +1 -0
- package/dist/chunks/{RealtimeClient-CqGve6h8.js → RealtimeClient-DsWbFRC7.js} +11 -3
- package/dist/chunks/RealtimeClient-DsWbFRC7.js.map +1 -0
- package/dist/chunks/{ThemeProvider-DaX0eyqs.js → ThemeProvider-gWqXjGh-.js} +70 -91
- package/dist/chunks/ThemeProvider-gWqXjGh-.js.map +1 -0
- package/dist/chunks/channelKey-CIhHpX6x.js +10 -0
- package/dist/chunks/channelKey-CIhHpX6x.js.map +1 -0
- package/dist/chunks/fetchFileRequest-BSrgYnAy.js +57 -0
- package/dist/chunks/fetchFileRequest-BSrgYnAy.js.map +1 -0
- package/dist/chunks/{live-DIUDdLrA.js → live-CUdMhXHL.js} +22 -3
- package/dist/chunks/live-CUdMhXHL.js.map +1 -0
- package/dist/chunks/mutationExtras-CtY-X9m7.js +115 -0
- package/dist/chunks/mutationExtras-CtY-X9m7.js.map +1 -0
- package/dist/client/MutationError.d.ts +7 -9
- package/dist/client/MutationError.d.ts.map +1 -1
- package/dist/client/QueryResource.d.ts +3 -11
- package/dist/client/QueryResource.d.ts.map +1 -1
- package/dist/client/fetchFile.d.ts +4 -7
- package/dist/client/fetchFile.d.ts.map +1 -1
- package/dist/client/fetchFileRequest.d.ts +14 -0
- package/dist/client/fetchFileRequest.d.ts.map +1 -0
- package/dist/client/index.js +88 -339
- package/dist/client/index.js.map +1 -1
- package/dist/client/lazyModule.d.ts +32 -0
- package/dist/client/lazyModule.d.ts.map +1 -0
- package/dist/client/mutationErrorHelpers.d.ts +11 -0
- package/dist/client/mutationErrorHelpers.d.ts.map +1 -0
- package/dist/client/mutationExtras.d.ts +3 -0
- package/dist/client/mutationExtras.d.ts.map +1 -0
- package/dist/client/mutationModules.d.ts +17 -0
- package/dist/client/mutationModules.d.ts.map +1 -0
- package/dist/client/queryUpdates.d.ts +22 -0
- package/dist/client/queryUpdates.d.ts.map +1 -0
- package/dist/client/realtime/RealtimeClient.d.ts +5 -0
- package/dist/client/realtime/RealtimeClient.d.ts.map +1 -1
- package/dist/client/realtime/channelKey.d.ts +4 -0
- package/dist/client/realtime/channelKey.d.ts.map +1 -0
- package/dist/client/realtime/live.d.ts +6 -0
- package/dist/client/realtime/live.d.ts.map +1 -1
- package/dist/client/realtime/loader.d.ts +20 -23
- package/dist/client/realtime/loader.d.ts.map +1 -1
- package/dist/client/realtime/useChannelSubscription.d.ts.map +1 -1
- package/dist/client/useMutation.d.ts +1 -1
- package/dist/client/useMutation.d.ts.map +1 -1
- package/dist/client/useSetQueryData.d.ts +4 -17
- package/dist/client/useSetQueryData.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/ViewRouter.d.ts +17 -0
- package/dist/http/ViewRouter.d.ts.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/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/server/httpDev.d.ts.map +1 -1
- package/dist/server/httpProd.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/index.d.ts +1 -0
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +3 -3
- package/dist/services/index.js.map +2 -2
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/services/router/DomainResolver.d.ts +12 -0
- package/dist/services/router/DomainResolver.d.ts.map +1 -1
- package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
- package/dist/services/router/config.d.ts +21 -5
- package/dist/services/router/config.d.ts.map +1 -1
- package/dist/services/router/documentScript.d.ts +46 -0
- package/dist/services/router/documentScript.d.ts.map +1 -0
- package/dist/services/router/staticDocument.d.ts +11 -1
- 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 +8 -5
- package/dist/testing/index.js.map +1 -1
- package/dist/testing/staticDocument.d.ts +8 -2
- package/dist/testing/staticDocument.d.ts.map +1 -1
- package/dist/vitest/index.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-0ryswty9.js +0 -120
- package/dist/chunk-bnp6wpzd.js +0 -4
- package/dist/chunk-bnp6wpzd.js.map +0 -10
- package/dist/chunk-pqn9j5s8.js +0 -5
- package/dist/chunks/RealtimeClient-CqGve6h8.js.map +0 -1
- package/dist/chunks/ThemeProvider-DaX0eyqs.js.map +0 -1
- package/dist/chunks/live-DIUDdLrA.js.map +0 -1
- /package/dist/{chunk-h55c9bdf.js.map → chunk-8fvt7kys.js.map} +0 -0
- /package/dist/{chunk-kmcnfk2s.js.map → chunk-b00z33zg.js.map} +0 -0
- /package/dist/{chunk-43vjbd6n.js.map → chunk-dxm5gxqk.js.map} +0 -0
- /package/dist/{chunk-5nkvpc0a.js.map → chunk-f21v4n2v.js.map} +0 -0
- /package/dist/{chunk-nh9ewam0.js.map → chunk-fxm8fqh9.js.map} +0 -0
- /package/dist/{chunk-03wc6em7.js.map → chunk-x07rp3fc.js.map} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region client/realtime/channelKey.ts
|
|
2
|
+
/** `pattern` and its params, canonical: two hooks on one channel share a `sub`. */
|
|
3
|
+
function channelKey(pattern, params) {
|
|
4
|
+
const sorted = Object.keys(params).sort().map((key) => [key, String(params[key])]);
|
|
5
|
+
return `${pattern}\u0000${JSON.stringify(sorted)}`;
|
|
6
|
+
}
|
|
7
|
+
//#endregion
|
|
8
|
+
export { channelKey as t };
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=channelKey-CIhHpX6x.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channelKey-CIhHpX6x.js","names":[],"sources":["../../client/realtime/channelKey.ts"],"sourcesContent":["import type { ChannelParamValues } from \"./RealtimeClient\";\n\n// A module of its own so the socket client (`./RealtimeClient`, loaded on\n// first use) and `FakeSocket` share it without reaching `./loader`, which\n// would keep it in every route's entry chunk (#915).\n\n/** `pattern` and its params, canonical: two hooks on one channel share a `sub`. */\nexport function channelKey(pattern: string, params: ChannelParamValues): string {\n const sorted = Object.keys(params)\n .sort()\n .map((key) => [key, String(params[key])]);\n return `${pattern}\\u0000${JSON.stringify(sorted)}`;\n}\n"],"mappings":";;AAOA,SAAgB,WAAW,SAAiB,QAAoC;CAC9E,MAAM,SAAS,OAAO,KAAK,MAAM,CAAC,CAC/B,KAAK,CAAC,CACN,KAAK,QAAQ,CAAC,KAAK,OAAO,OAAO,IAAI,CAAC,CAAC;CAC1C,OAAO,GAAG,QAAQ,QAAQ,KAAK,UAAU,MAAM;AACjD"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { it as QueryError, q as applyParams, tt as parseRetryAfter } from "./ThemeProvider-gWqXjGh-.js";
|
|
2
|
+
//#region client/fetchFileRequest.ts
|
|
3
|
+
/**
|
|
4
|
+
* `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a
|
|
5
|
+
* non-2xx, and the body read `as` a blob or text.
|
|
6
|
+
*/
|
|
7
|
+
async function fetchFile(path, options, as) {
|
|
8
|
+
const response = await request(path, options);
|
|
9
|
+
return {
|
|
10
|
+
...as === "blob" ? { blob: await response.blob() } : { text: await response.text() },
|
|
11
|
+
filename: filenameOf(response),
|
|
12
|
+
response
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
async function request(path, options = {}) {
|
|
16
|
+
const { params = {}, search, signal, init } = options;
|
|
17
|
+
const url = applyParams(path, params);
|
|
18
|
+
const query = searchString(search);
|
|
19
|
+
const response = await fetch(`/api${url}${query ? `?${query}` : ""}`, {
|
|
20
|
+
...init,
|
|
21
|
+
method: "GET",
|
|
22
|
+
signal
|
|
23
|
+
});
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const body = await response.json().catch(() => null);
|
|
26
|
+
throw new QueryError(url, query, response.status, body, parseRetryAfter(response.headers.get("retry-after")));
|
|
27
|
+
}
|
|
28
|
+
return response;
|
|
29
|
+
}
|
|
30
|
+
function searchString(search) {
|
|
31
|
+
if (!search) return "";
|
|
32
|
+
if (search instanceof URLSearchParams) return search.toString();
|
|
33
|
+
const params = new URLSearchParams();
|
|
34
|
+
for (const [key, value] of Object.entries(search)) if (value !== null && value !== void 0) params.append(key, String(value));
|
|
35
|
+
return params.toString();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The file name in a `Content-Disposition` header: the RFC 5987
|
|
39
|
+
* `filename*=UTF-8''...` form when present and decodable, else `filename`.
|
|
40
|
+
*
|
|
41
|
+
* @internal Exported for tests.
|
|
42
|
+
*/
|
|
43
|
+
function filenameOf(response) {
|
|
44
|
+
const header = response.headers.get("content-disposition");
|
|
45
|
+
if (!header) return null;
|
|
46
|
+
const extended = /filename\*\s*=\s*([^']*)'[^']*'([^;]+)/i.exec(header);
|
|
47
|
+
if (extended) try {
|
|
48
|
+
return decodeURIComponent(extended[2].trim());
|
|
49
|
+
} catch {}
|
|
50
|
+
const plain = /filename\s*=\s*(?:"((?:[^"\\]|\\.)*)"|([^;]+))/i.exec(header);
|
|
51
|
+
if (!plain) return null;
|
|
52
|
+
return (plain[1] !== void 0 ? plain[1].replace(/\\(.)/g, "$1") : plain[2].trim()) || null;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { fetchFile, filenameOf };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=fetchFileRequest-BSrgYnAy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchFileRequest-BSrgYnAy.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) return null;\n const name = plain[1] !== undefined ? plain[1].replace(/\\\\(.)/g, \"$1\") : plain[2].trim();\n return name || null;\n}\n"],"mappings":";;;;;;AAgBA,eAAsB,UACpB,MAEA,SACA,IACoC;CACpC,MAAM,WAAW,MAAM,QAAQ,MAAM,OAAyB;CAE9D,OAAO;EAAE,GADI,OAAO,SAAS,EAAE,MAAM,MAAM,SAAS,KAAK,EAAE,IAAI,EAAE,MAAM,MAAM,SAAS,KAAK,EAAE;EAC3E,UAAU,WAAW,QAAQ;EAAG;CAAS;AAC7D;AAEA,eAAe,QAAQ,MAAc,UAA0B,CAAC,GAAG;CACjE,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,QAAQ,SAAS;CAC9C,MAAM,MAAM,YAAY,MAAM,MAAM;CACpC,MAAM,QAAQ,aAAa,MAAM;CACjC,MAAM,WAAW,MAAM,MAAM,OAAO,MAAM,QAAQ,IAAI,UAAU,MAAM;EACpE,GAAG;EACH,QAAQ;EACR;CACF,CAAC;CACD,IAAI,CAAC,SAAS,IAAI;EAEhB,MAAM,OAAO,MAAM,SAAS,KAAK,CAAC,CAAC,YAAY,IAAI;EACnD,MAAM,IAAI,WACR,KACA,OACA,SAAS,QACT,MACA,gBAAgB,SAAS,QAAQ,IAAI,aAAa,CAAC,CACrD;CACF;CACA,OAAO;AACT;AAEA,SAAS,aAAa,QAA4C;CAChE,IAAI,CAAC,QAAQ,OAAO;CACpB,IAAI,kBAAkB,iBAAiB,OAAO,OAAO,SAAS;CAC9D,MAAM,SAAS,IAAI,gBAAgB;CACnC,KAAK,MAAM,CAAC,KAAK,UAAU,OAAO,QAAQ,MAAM,GAC9C,IAAI,UAAU,QAAQ,UAAU,KAAA,GAAW,OAAO,OAAO,KAAK,OAAO,KAAK,CAAC;CAE7E,OAAO,OAAO,SAAS;AACzB;;;;;;;AAQA,SAAgB,WAAW,UAAmC;CAC5D,MAAM,SAAS,SAAS,QAAQ,IAAI,qBAAqB;CACzD,IAAI,CAAC,QAAQ,OAAO;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 "./ThemeProvider-
|
|
1
|
+
import { G as loadedModule, H as realtime } from "./ThemeProvider-gWqXjGh-.js";
|
|
2
2
|
//#region \0rolldown/runtime.js
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __exportAll = (all, no_symbols) => {
|
|
@@ -13,6 +13,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region client/realtime/live.ts
|
|
15
15
|
var live_exports = /* @__PURE__ */ __exportAll({
|
|
16
|
+
followLive: () => followLive,
|
|
16
17
|
resolveLiveChannel: () => resolveLiveChannel,
|
|
17
18
|
subscribeLive: () => subscribeLive
|
|
18
19
|
});
|
|
@@ -63,7 +64,25 @@ function subscribeLive(socket, live, resource, setOpen) {
|
|
|
63
64
|
release();
|
|
64
65
|
};
|
|
65
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* What `followLive` in `./loader` hands over to once this module is loaded:
|
|
69
|
+
* subscribes on the provided socket, or the tab's client, loading that first
|
|
70
|
+
* when it is not there yet. Returns the function that stops it.
|
|
71
|
+
*/
|
|
72
|
+
function followLive(provided, live, resource, setOpen) {
|
|
73
|
+
let stop;
|
|
74
|
+
const start = (socket) => {
|
|
75
|
+
if (stop === void 0) stop = subscribeLive(socket, live, resource, setOpen);
|
|
76
|
+
};
|
|
77
|
+
const socket = provided ?? realtime.client;
|
|
78
|
+
if (socket) start(socket);
|
|
79
|
+
else import("./RealtimeClient-DsWbFRC7.js").then((module) => start(loadedModule(module).tabClient())).catch(() => {});
|
|
80
|
+
return () => {
|
|
81
|
+
stop?.();
|
|
82
|
+
stop = null;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
66
85
|
//#endregion
|
|
67
|
-
export { live_exports as t };
|
|
86
|
+
export { live_exports as n, followLive as t };
|
|
68
87
|
|
|
69
|
-
//# sourceMappingURL=live-
|
|
88
|
+
//# sourceMappingURL=live-CUdMhXHL.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-CUdMhXHL.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"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { K as toVariantKey, q as applyParams } from "./ThemeProvider-gWqXjGh-.js";
|
|
2
|
+
import { p as mutationErrorFromBody, s as isObject } from "./MutationError-DuKqBW8o.js";
|
|
3
|
+
//#region client/mutationErrorHelpers.ts
|
|
4
|
+
var FALLBACK_MESSAGE = "Something went wrong. Try again.";
|
|
5
|
+
function isValidationError(error) {
|
|
6
|
+
return isObject(error) && error.kind === "validation_error";
|
|
7
|
+
}
|
|
8
|
+
function unwrapQueryError(error) {
|
|
9
|
+
if (error instanceof Error && error.name === "QueryError" && "body" in error) {
|
|
10
|
+
const { body, status } = error;
|
|
11
|
+
return body == null ? error : mutationErrorFromBody(body, status);
|
|
12
|
+
}
|
|
13
|
+
return error;
|
|
14
|
+
}
|
|
15
|
+
function list(error, fallback = FALLBACK_MESSAGE) {
|
|
16
|
+
const value = unwrapQueryError(error);
|
|
17
|
+
if (isValidationError(value)) {
|
|
18
|
+
const messages = Object.values(value.messages ?? {}).flat().filter((message) => typeof message === "string" && message !== "");
|
|
19
|
+
return messages.length > 0 ? messages : [fallback];
|
|
20
|
+
}
|
|
21
|
+
if (isObject(value) && !(value instanceof Error) && value.kind !== "server_error" && typeof value.message === "string" && value.message !== "") return [value.message];
|
|
22
|
+
return [fallback];
|
|
23
|
+
}
|
|
24
|
+
function field(error, name) {
|
|
25
|
+
const value = unwrapQueryError(error);
|
|
26
|
+
if (!isValidationError(value)) return [];
|
|
27
|
+
const messages = value.messages?.[name];
|
|
28
|
+
return Array.isArray(messages) ? [...messages] : [];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Puts `list` and `field` on an error the hooks hand over, as non-enumerable
|
|
32
|
+
* properties, so `toEqual`, a spread and `JSON.stringify` see the same object
|
|
33
|
+
* as before. A key the error already has is left alone; a primitive or a
|
|
34
|
+
* frozen value is returned as it is.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
38
|
+
function withMutationErrorHelpers(error) {
|
|
39
|
+
if (!isObject(error) || !Object.isExtensible(error)) return error;
|
|
40
|
+
const helpers = {
|
|
41
|
+
list: (fallback) => list(error, fallback),
|
|
42
|
+
field: (name) => field(error, name)
|
|
43
|
+
};
|
|
44
|
+
for (const key of ["list", "field"]) {
|
|
45
|
+
if (key in error) continue;
|
|
46
|
+
Object.defineProperty(error, key, {
|
|
47
|
+
value: helpers[key],
|
|
48
|
+
configurable: true,
|
|
49
|
+
writable: true,
|
|
50
|
+
enumerable: false
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return error;
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
//#region client/queryUpdates.ts
|
|
57
|
+
/**
|
|
58
|
+
* Write data the server just produced (a mutation's answer) into a variant,
|
|
59
|
+
* with no refetch: unlike `mutate`, the value is not a guess to reconcile.
|
|
60
|
+
* The variant counts as freshly fetched, so its `staleTime` starts again, and
|
|
61
|
+
* a GET already on the wire for it is dropped when it lands, since it may
|
|
62
|
+
* carry the data from before the write. A reader suspended on the variant
|
|
63
|
+
* wakes up with it (#897). Here rather than on `QueryResource`, which every
|
|
64
|
+
* entry chunk carries (#915).
|
|
65
|
+
*/
|
|
66
|
+
function setVariant(resource, variantKey, data) {
|
|
67
|
+
resource.dropHttpCache(variantKey);
|
|
68
|
+
resource.markApplied(variantKey);
|
|
69
|
+
const store = resource.store.getValue();
|
|
70
|
+
resource.fill(store, variantKey, data, Date.now());
|
|
71
|
+
resource.store.next(store);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Write into every variant `target` names. `next` is the value to write, or
|
|
75
|
+
* a function of the cached value; a function skips a variant with nothing
|
|
76
|
+
* cached. A value seeds a single variant that is not cached yet; a predicate
|
|
77
|
+
* only ever reaches variants that are.
|
|
78
|
+
*/
|
|
79
|
+
function writeQueryData(getResource, routeParams, target, next) {
|
|
80
|
+
const { path, params = {}, search = {} } = target;
|
|
81
|
+
const resource = getResource(applyParams(String(path), {
|
|
82
|
+
...routeParams,
|
|
83
|
+
...params
|
|
84
|
+
}));
|
|
85
|
+
const write = (variantKey) => {
|
|
86
|
+
if ("value" in next) {
|
|
87
|
+
setVariant(resource, variantKey, next.value);
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const state = resource.peek(variantKey);
|
|
91
|
+
if (!state?.hasData) return;
|
|
92
|
+
setVariant(resource, variantKey, next.update(state.data));
|
|
93
|
+
};
|
|
94
|
+
if (typeof search === "function") {
|
|
95
|
+
for (const variantKey of resource.variantKeys()) {
|
|
96
|
+
if (!resource.peek(variantKey)?.hasData) continue;
|
|
97
|
+
if (search(new URLSearchParams(variantKey))) write(variantKey);
|
|
98
|
+
}
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
write(toVariantKey(search));
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Write a mutation's `updates` with its answer.
|
|
105
|
+
*/
|
|
106
|
+
function applyQueryUpdates(getResource, routeParams, updates, answer) {
|
|
107
|
+
for (const update of updates ?? []) {
|
|
108
|
+
const { data } = update;
|
|
109
|
+
writeQueryData(getResource, routeParams, update, data ? { update: (current) => data(answer, current) } : { value: answer });
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
//#endregion
|
|
113
|
+
export { applyQueryUpdates, withMutationErrorHelpers, writeQueryData };
|
|
114
|
+
|
|
115
|
+
//# sourceMappingURL=mutationExtras-CtY-X9m7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutationExtras-CtY-X9m7.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,O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MAAM,SAAS,CAAC,GAAG,SAAS,CAAC,MAAM;CAC3C,MAAM,WAAW,YAAY,YAAY,OAAO,IAAI,GAAG;EAAE,GAAG;EAAa,GAAG;CAAO,CAAC,CAAC;CACrF,MAAM,SAAS,eAAuB;EACpC,IAAI,WAAW,MAAM;GACnB,WAAW,UAAU,YAAY,KAAK,KAAK;GAC3C;EACF;EACA,MAAM,QAAQ,SAAS,KAAK,UAAU;EACtC,IAAI,CAAC,OAAO,SAAS;EACrB,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"}
|
|
@@ -93,6 +93,8 @@ export interface MutationMessageError {
|
|
|
93
93
|
export type MutationError = MutationValidationError | MutationFormError | MutationServerError | MutationRefusal | Error;
|
|
94
94
|
/** What `mutationErrorKind` answers, one per guard below. */
|
|
95
95
|
export type MutationErrorKind = "validation" | "form" | "authentication" | "permission" | "csrf" | "not_found" | "rate_limit" | "server" | "network" | "unknown";
|
|
96
|
+
/** @internal */
|
|
97
|
+
export declare function isObject(error: unknown): error is Record<string, unknown>;
|
|
96
98
|
/**
|
|
97
99
|
* The `MutationError` a non-2xx response's parsed body stands for.
|
|
98
100
|
*
|
|
@@ -197,6 +199,11 @@ export type WithMutationErrorHelpers<T> = T extends object ? T & Omit<MutationEr
|
|
|
197
199
|
/**
|
|
198
200
|
* `error.list(fallback)` for any value: an error kept from a mutation, a
|
|
199
201
|
* `useQuery` `QueryError` (its body is read), or anything else.
|
|
202
|
+
*
|
|
203
|
+
* Kept in step with `list` in `./mutationErrorHelpers`, which the mutation
|
|
204
|
+
* hooks load on first use (#915) and so cannot share this code: an app's
|
|
205
|
+
* bundler would put it back in the entry chunk. `MutationError.helpers.test`
|
|
206
|
+
* runs the same cases through both.
|
|
200
207
|
*/
|
|
201
208
|
export declare function mutationErrorList(error: unknown, fallback?: string): string[];
|
|
202
209
|
/**
|
|
@@ -204,13 +211,4 @@ export declare function mutationErrorList(error: unknown, fallback?: string): st
|
|
|
204
211
|
* `name` (a `QueryError`'s body is read), `[]` for anything else.
|
|
205
212
|
*/
|
|
206
213
|
export declare function mutationErrorField(error: unknown, name: string): string[];
|
|
207
|
-
/**
|
|
208
|
-
* Puts `list` and `field` on an error the hooks hand over, as non-enumerable
|
|
209
|
-
* properties, so `toEqual`, a spread and `JSON.stringify` see the same object
|
|
210
|
-
* as before. A key the error already has is left alone; a primitive or a
|
|
211
|
-
* frozen value is returned as it is.
|
|
212
|
-
*
|
|
213
|
-
* @internal
|
|
214
|
-
*/
|
|
215
|
-
export declare function withMutationErrorHelpers<T>(error: T): WithMutationErrorHelpers<T>;
|
|
216
214
|
//# sourceMappingURL=MutationError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MutationError.d.ts","sourceRoot":"","sources":["../../client/MutationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,sEAAsE;AACtE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,+CAA+C;AAC/C,MAAM,MAAM,mBAAmB,GAAG,OAAO,CACvC,WAAW,EACX,kBAAkB,GAAG,YAAY,GAAG,cAAc,CACnD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,mBAAmB,GAAG,mBAAmB;IAClF,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,aAAa,GACrB,uBAAuB,GACvB,iBAAiB,GACjB,mBAAmB,GACnB,eAAe,GACf,KAAK,CAAC;AAEV,6DAA6D;AAC7D,MAAM,MAAM,iBAAiB,GACzB,YAAY,GACZ,MAAM,GACN,gBAAgB,GAChB,YAAY,GACZ,MAAM,GACN,WAAW,GACX,YAAY,GACZ,QAAQ,GACR,SAAS,GACT,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"MutationError.d.ts","sourceRoot":"","sources":["../../client/MutationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;GAkBG;A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AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,OAAO,CAAC,CAAC,EAAE;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAC9F,CAAC,GAAG;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,GACjB,OAAO,CAAC,CAAC,EAAE;IAAE,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,EAC7C,KAAK,EAAE,CAAC,EACR,MAAM,EAAE,CAAC,GACR,KAAK,IAAI,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,CAEpC;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;OASG;IACH,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAClC,0EAA0E;IAC1E,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CAC/B;AAED;;;;GAIG;AACH,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,GACtD,CAAC,GAAG,IAAI,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAAC,GACvC,CAAC,CAAC;AAcN;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,OAAO,EACd,QAAQ,GAAE,MAAyB,GAClC,MAAM,EAAE,CAkBV;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAKzE"}
|
|
@@ -172,20 +172,12 @@ export declare class QueryResource {
|
|
|
172
172
|
* and revalidates — bypassing the HTTP cache — the next time it is read.
|
|
173
173
|
*/
|
|
174
174
|
invalidate(variantKey: string, fn?: (data: any) => any): void;
|
|
175
|
-
|
|
175
|
+
dropHttpCache(variantKey: string): void;
|
|
176
176
|
mutate(variantKey: string, fn?: (data: any) => any): void;
|
|
177
|
-
|
|
178
|
-
* Write data the server just produced (a mutation's answer) into a
|
|
179
|
-
* variant, with no refetch: unlike `mutate`, the value is not a guess to
|
|
180
|
-
* reconcile. The variant counts as freshly fetched, so its `staleTime`
|
|
181
|
-
* starts again, and a GET already on the wire for it is dropped when it
|
|
182
|
-
* lands, since it may carry the data from before the write. A reader
|
|
183
|
-
* suspended on the variant wakes up with it (#897).
|
|
184
|
-
*/
|
|
185
|
-
set(variantKey: string, data: any): void;
|
|
177
|
+
fill(store: Map<string, State>, variantKey: string, data: any, now: number): void;
|
|
186
178
|
refetch(variantKey: string): void;
|
|
187
179
|
/** Supersede every request for this variant that is already on the wire. */
|
|
188
|
-
|
|
180
|
+
markApplied(variantKey: string): void;
|
|
189
181
|
private resolveVariant;
|
|
190
182
|
}
|
|
191
183
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryResource.d.ts","sourceRoot":"","sources":["../../client/QueryResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAI3C,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,GAAG,CAAC;IACV;;;;;;OAMG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAIF,eAAO,MAAM,kBAAkB,OAAO,CAAC;AAGvC,qBAAa,aAAa;IACxB,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC;IACnC,aAAa,cAAqB;IAClC,eAAe,sBAA6B;IAC5C,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAqB;I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AM,EAAE,KAAK,EAAE,MAAM;IAqB/C,WAAW,CAAC,UAAU,EAAE,MAAM;IAQ9B;;;OAGG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM;IAQ3B,2EAA2E;IAC3E,WAAW,IAAI,MAAM,EAAE;IAIvB;;;;;OAKG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG;IAgBtD,aAAa,CAAC,UAAU,EAAE,MAAM;IAiBhC,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,GAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAoB;IAkClE,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM;IAe1E,OAAO,CAAC,UAAU,EAAE,MAAM;IAI1B,4EAA4E;IAC5E,WAAW,CAAC,UAAU,EAAE,MAAM;YAIhB,cAAc;CAsK7B"}
|
|
@@ -51,16 +51,13 @@ export interface FetchedText extends Fetched {
|
|
|
51
51
|
* `retryAfter`), the error `useQuery` throws, so `mutationErrorList(error)`
|
|
52
52
|
* reads its message. A network failure rejects with the browser's `TypeError`,
|
|
53
53
|
* an abort with its `AbortError`.
|
|
54
|
+
*
|
|
55
|
+
* The request code loads on the first call (#915), so a route that never
|
|
56
|
+
* downloads a file carries none of it; a failed load rejects as a network
|
|
57
|
+
* failure does.
|
|
54
58
|
*/
|
|
55
59
|
export declare function fetchBlob<P extends FilePath>(path: P, ...args: FetchFileArgs<P>): Promise<FetchedBlob>;
|
|
56
60
|
/** `fetchBlob`, with the body read as text. */
|
|
57
61
|
export declare function fetchText<P extends FilePath>(path: P, ...args: FetchFileArgs<P>): Promise<FetchedText>;
|
|
58
|
-
/**
|
|
59
|
-
* The file name in a `Content-Disposition` header: the RFC 5987
|
|
60
|
-
* `filename*=UTF-8''...` form when present and decodable, else `filename`.
|
|
61
|
-
*
|
|
62
|
-
* @internal Exported for tests.
|
|
63
|
-
*/
|
|
64
|
-
export declare function filenameOf(response: Response): string | null;
|
|
65
62
|
export {};
|
|
66
63
|
//# sourceMappingURL=fetchFile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchFile.d.ts","sourceRoot":"","sources":["../../client/fetchFile.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetchFile.d.ts","sourceRoot":"","sources":["../../client/fetchFile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;GAIG;AACH,MAAM,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;AAE3C,0DAA0D;AAC1D,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AAElF,MAAM,MAAM,gBAAgB,CAAC,CAAC,SAAS,MAAM,IAAI;IAC/C,4DAA4D;IAC5D,MAAM,CAAC,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,oEAAoE;IACpE,MAAM,CAAC,EACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC,GAC5D,eAAe,CAAC;IACpB,kFAAkF;IAClF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,qFAAqF;IACrF,IAAI,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC,CAAC;CACxD,CAAC;AAGF,gBAAgB;AAChB,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,MAAM,IACxC,EAAE,SAAS,SAAS,CAAC,CAAC,CAAC,GACnB,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,CAAC,CAAC,GAC/B,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,GAAG;IAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;CAAE,CAAC,CAAC;AAEhE,UAAU,OAAO;IACf;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wEAAwE;IACxE,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,WAAW,WAAY,SAAQ,OAAO;IAC1C,IAAI,EAAE,MAAM,CAAC;CACd;AASD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAsB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAChD,IAAI,EAAE,CAAC,EACP,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,WAAW,CAAC,CAEtB;AAED,+CAA+C;AAC/C,wBAAsB,SAAS,CAAC,CAAC,SAAS,QAAQ,EAChD,IAAI,EAAE,CAAC,EACP,GAAG,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GACxB,OAAO,CAAC,WAAW,CAAC,CAEtB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FetchedBlob, FetchedText } from "./fetchFile";
|
|
2
|
+
/**
|
|
3
|
+
* `fetchBlob` / `fetchText` once loaded: the `GET`, a `QueryError` for a
|
|
4
|
+
* non-2xx, and the body read `as` a blob or text.
|
|
5
|
+
*/
|
|
6
|
+
export declare function fetchFile(path: string, options: object | undefined, as: "blob" | "text"): Promise<FetchedBlob | FetchedText>;
|
|
7
|
+
/**
|
|
8
|
+
* The file name in a `Content-Disposition` header: the RFC 5987
|
|
9
|
+
* `filename*=UTF-8''...` form when present and decodable, else `filename`.
|
|
10
|
+
*
|
|
11
|
+
* @internal Exported for tests.
|
|
12
|
+
*/
|
|
13
|
+
export declare function filenameOf(response: Response): string | null;
|
|
14
|
+
//# sourceMappingURL=fetchFileRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchFileRequest.d.ts","sourceRoot":"","sources":["../../client/fetchFileRequest.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAoB,MAAM,aAAa,CAAC;AAW9E;;;GAGG;AACH,wBAAsB,SAAS,CAC7B,IAAI,EAAE,MAAM,EAEZ,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,EAAE,EAAE,MAAM,GAAG,MAAM,GAClB,OAAO,CAAC,WAAW,GAAG,WAAW,CAAC,CAIpC;AAmCD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAe5D"}
|