gemi 0.70.1 → 0.72.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/auth/AuthManager.d.ts +1 -1
- package/dist/auth/AuthManager.d.ts.map +1 -1
- package/dist/auth/UserProvider.d.ts +93 -9
- package/dist/auth/UserProvider.d.ts.map +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/bun/plugin.js +1 -1
- package/dist/bun/preload.js +1 -1
- package/dist/{chunk-p0m3qgs5.js → chunk-0kpvbnz0.js} +2 -2
- package/dist/{chunk-p0m3qgs5.js.map → chunk-0kpvbnz0.js.map} +1 -1
- package/dist/chunk-0x9a9yha.js +19 -0
- package/dist/{chunk-4t9zv1rk.js.map → chunk-0x9a9yha.js.map} +9 -8
- package/dist/{chunk-63n765wn.js → chunk-25a65e4r.js} +2 -2
- package/dist/{chunk-63n765wn.js.map → chunk-25a65e4r.js.map} +1 -1
- package/dist/{chunk-dmxr0bt8.js → chunk-26n9365a.js} +3 -3
- package/dist/{chunk-dmxr0bt8.js.map → chunk-26n9365a.js.map} +1 -1
- package/dist/{chunk-7tmqw6a5.js → chunk-2a2qd22n.js} +2 -2
- package/dist/{chunk-7tmqw6a5.js.map → chunk-2a2qd22n.js.map} +1 -1
- package/dist/{chunk-k4vj2b98.js → chunk-385exk8p.js} +2 -2
- package/dist/{chunk-k4vj2b98.js.map → chunk-385exk8p.js.map} +1 -1
- package/dist/{chunk-mpk36kdy.js → chunk-3g94pe6x.js} +2 -2
- package/dist/{chunk-mpk36kdy.js.map → chunk-3g94pe6x.js.map} +1 -1
- package/dist/{chunk-8nzcqw9n.js → chunk-3w80kmxr.js} +2 -2
- package/dist/{chunk-8nzcqw9n.js.map → chunk-3w80kmxr.js.map} +1 -1
- package/dist/{chunk-c776vm8q.js → chunk-3zraw16t.js} +3 -3
- package/dist/{chunk-c776vm8q.js.map → chunk-3zraw16t.js.map} +1 -1
- package/dist/{chunk-tkrj74c1.js → chunk-3zv572s2.js} +2 -2
- package/dist/{chunk-tkrj74c1.js.map → chunk-3zv572s2.js.map} +1 -1
- package/dist/{chunk-zpjx407m.js → chunk-44j2dckn.js} +3 -3
- package/dist/{chunk-zpjx407m.js.map → chunk-44j2dckn.js.map} +1 -1
- package/dist/{chunk-rm5qa99y.js → chunk-47589yz8.js} +3 -3
- package/dist/{chunk-rm5qa99y.js.map → chunk-47589yz8.js.map} +1 -1
- package/dist/{chunk-7srjk8t7.js → chunk-481t5ewt.js} +2 -2
- package/dist/{chunk-7srjk8t7.js.map → chunk-481t5ewt.js.map} +1 -1
- package/dist/{chunk-th8drc6f.js → chunk-4yj86ds2.js} +2 -2
- package/dist/{chunk-th8drc6f.js.map → chunk-4yj86ds2.js.map} +1 -1
- package/dist/{chunk-xmjzrg41.js → chunk-544va0er.js} +3 -3
- package/dist/{chunk-xmjzrg41.js.map → chunk-544va0er.js.map} +1 -1
- package/dist/{chunk-vpvde0nb.js → chunk-5fxqzs72.js} +2 -2
- package/dist/{chunk-vpvde0nb.js.map → chunk-5fxqzs72.js.map} +1 -1
- package/dist/{chunk-5p4ywbsz.js → chunk-88qvsv9w.js} +2 -2
- package/dist/{chunk-5p4ywbsz.js.map → chunk-88qvsv9w.js.map} +1 -1
- package/dist/{chunk-vxr752md.js → chunk-8dvntsme.js} +2 -2
- package/dist/{chunk-vxr752md.js.map → chunk-8dvntsme.js.map} +1 -1
- package/dist/{chunk-z4k18gnp.js → chunk-9hbwvcxn.js} +2 -2
- package/dist/{chunk-z4k18gnp.js.map → chunk-9hbwvcxn.js.map} +1 -1
- package/dist/{chunk-wqamwrrn.js → chunk-ak7jma5c.js} +2 -2
- package/dist/{chunk-wqamwrrn.js.map → chunk-ak7jma5c.js.map} +1 -1
- package/dist/{chunk-5qnk24jy.js → chunk-awjqnh2x.js} +2 -2
- package/dist/{chunk-5qnk24jy.js.map → chunk-awjqnh2x.js.map} +1 -1
- package/dist/{chunk-5fxz3knw.js → chunk-b2bpwb1d.js} +2 -2
- package/dist/{chunk-5fxz3knw.js.map → chunk-b2bpwb1d.js.map} +1 -1
- package/dist/{chunk-4j6vrkmj.js → chunk-b53j44zv.js} +2 -2
- package/dist/{chunk-4j6vrkmj.js.map → chunk-b53j44zv.js.map} +1 -1
- package/dist/{chunk-4azcbkxm.js → chunk-bjr740m4.js} +1 -1
- package/dist/{chunk-qxfby5zf.js → chunk-bt9rjc80.js} +3 -3
- package/dist/{chunk-qxfby5zf.js.map → chunk-bt9rjc80.js.map} +1 -1
- package/dist/{chunk-f8wyyky5.js → chunk-c6z9f6cp.js} +2 -2
- package/dist/{chunk-f8wyyky5.js.map → chunk-c6z9f6cp.js.map} +1 -1
- package/dist/{chunk-v6v1b4jp.js → chunk-c8jt128x.js} +2 -2
- package/dist/{chunk-v6v1b4jp.js.map → chunk-c8jt128x.js.map} +1 -1
- package/dist/chunk-cvm5sm4m.js +5 -0
- package/dist/{chunk-ds8d17k6.js.map → chunk-cvm5sm4m.js.map} +1 -1
- package/dist/{chunk-f65v7rqq.js → chunk-drrxkg9v.js} +3 -3
- package/dist/{chunk-f65v7rqq.js.map → chunk-drrxkg9v.js.map} +1 -1
- package/dist/{chunk-p9rg95p6.js → chunk-ejspccjb.js} +1 -1
- package/dist/{chunk-44jp4cb2.js → chunk-ev1pe2ry.js} +2 -2
- package/dist/{chunk-44jp4cb2.js.map → chunk-ev1pe2ry.js.map} +1 -1
- package/dist/{chunk-q2qnet5h.js → chunk-fpx20wm3.js} +2 -2
- package/dist/{chunk-q2qnet5h.js.map → chunk-fpx20wm3.js.map} +1 -1
- package/dist/{chunk-2yrgzmpk.js → chunk-gf3y4k0r.js} +2 -2
- package/dist/{chunk-2yrgzmpk.js.map → chunk-gf3y4k0r.js.map} +1 -1
- package/dist/{chunk-wc4jpf86.js → chunk-gjanfny1.js} +3 -3
- package/dist/{chunk-wc4jpf86.js.map → chunk-gjanfny1.js.map} +1 -1
- package/dist/{chunk-qtwmbqzr.js → chunk-gkedmh5f.js} +2 -2
- package/dist/{chunk-qtwmbqzr.js.map → chunk-gkedmh5f.js.map} +1 -1
- package/dist/{chunk-vbrbsk9b.js → chunk-gn0vhf9n.js} +3 -3
- package/dist/{chunk-vbrbsk9b.js.map → chunk-gn0vhf9n.js.map} +1 -1
- package/dist/{chunk-fxdc34cj.js → chunk-jgn1jyys.js} +2 -2
- package/dist/{chunk-fxdc34cj.js.map → chunk-jgn1jyys.js.map} +1 -1
- package/dist/{chunk-dacq5bw8.js → chunk-mt1776nd.js} +2 -2
- package/dist/{chunk-dacq5bw8.js.map → chunk-mt1776nd.js.map} +1 -1
- package/dist/{chunk-y73tppyk.js → chunk-n74re6da.js} +2 -2
- package/dist/{chunk-y73tppyk.js.map → chunk-n74re6da.js.map} +1 -1
- package/dist/chunk-ngq4n2b3.js +54 -0
- package/dist/chunk-ngq4n2b3.js.map +15 -0
- package/dist/{chunk-k7hm7f3t.js → chunk-p7tbab19.js} +3 -3
- package/dist/{chunk-k7hm7f3t.js.map → chunk-p7tbab19.js.map} +1 -1
- package/dist/{chunk-ah13y0hy.js → chunk-ps59yj5b.js} +2 -2
- package/dist/{chunk-ah13y0hy.js.map → chunk-ps59yj5b.js.map} +1 -1
- package/dist/chunk-qb1x1r58.js +5 -0
- package/dist/{chunk-x2tqctjm.js.map → chunk-qb1x1r58.js.map} +4 -5
- package/dist/{chunk-nkfj4qq5.js → chunk-qcpar2xh.js} +2 -2
- package/dist/{chunk-nkfj4qq5.js.map → chunk-qcpar2xh.js.map} +1 -1
- package/dist/{chunk-pmze0zcr.js → chunk-qm16ep90.js} +2 -2
- package/dist/{chunk-pmze0zcr.js.map → chunk-qm16ep90.js.map} +1 -1
- package/dist/{chunk-ezd59jpg.js → chunk-r4t5a213.js} +1 -1
- package/dist/{chunk-bq3sc20y.js → chunk-rnbgw55r.js} +2 -2
- package/dist/{chunk-bq3sc20y.js.map → chunk-rnbgw55r.js.map} +1 -1
- package/dist/{chunk-p48th4ps.js → chunk-ryynt7wx.js} +2 -2
- package/dist/{chunk-p48th4ps.js.map → chunk-ryynt7wx.js.map} +1 -1
- package/dist/{chunk-cw2wjrya.js → chunk-sbeszmmp.js} +3 -3
- package/dist/{chunk-cw2wjrya.js.map → chunk-sbeszmmp.js.map} +1 -1
- package/dist/{chunk-q8630z08.js → chunk-sm8h95v3.js} +2 -2
- package/dist/{chunk-q8630z08.js.map → chunk-sm8h95v3.js.map} +1 -1
- package/dist/{chunk-ceemr927.js → chunk-tfsbtz0j.js} +2 -2
- package/dist/{chunk-ceemr927.js.map → chunk-tfsbtz0j.js.map} +1 -1
- package/dist/{chunk-gj5jjmf8.js → chunk-vt9tm0xx.js} +2 -2
- package/dist/{chunk-gj5jjmf8.js.map → chunk-vt9tm0xx.js.map} +1 -1
- package/dist/{chunk-paqjyvjm.js → chunk-w316w188.js} +2 -2
- package/dist/{chunk-paqjyvjm.js.map → chunk-w316w188.js.map} +1 -1
- package/dist/{chunk-snheb16b.js → chunk-wa5emk60.js} +2 -2
- package/dist/{chunk-snheb16b.js.map → chunk-wa5emk60.js.map} +1 -1
- package/dist/{chunk-yffy1k69.js → chunk-wtyn66c0.js} +2 -2
- package/dist/{chunk-yffy1k69.js.map → chunk-wtyn66c0.js.map} +1 -1
- package/dist/{chunk-wbv5kyhe.js → chunk-wxahf19j.js} +4 -4
- package/dist/{chunk-wbv5kyhe.js.map → chunk-wxahf19j.js.map} +1 -1
- package/dist/{chunk-wx3rx7vp.js → chunk-x3jwa5mx.js} +2 -2
- package/dist/{chunk-wx3rx7vp.js.map → chunk-x3jwa5mx.js.map} +1 -1
- package/dist/{chunk-3296fwss.js → chunk-xh65fgg1.js} +2 -2
- package/dist/{chunk-3296fwss.js.map → chunk-xh65fgg1.js.map} +1 -1
- package/dist/{chunk-083j4ktb.js → chunk-xkt6pnv3.js} +2 -2
- package/dist/{chunk-083j4ktb.js.map → chunk-xkt6pnv3.js.map} +1 -1
- package/dist/{chunk-em9kwz08.js → chunk-yt96ny9v.js} +2 -2
- package/dist/{chunk-em9kwz08.js.map → chunk-yt96ny9v.js.map} +1 -1
- package/dist/{chunk-s7v66c70.js → chunk-yvkm7qya.js} +2 -2
- package/dist/{chunk-s7v66c70.js.map → chunk-yvkm7qya.js.map} +1 -1
- package/dist/{chunk-kh64a9rh.js → chunk-z99bj1mv.js} +2 -2
- package/dist/{chunk-kh64a9rh.js.map → chunk-z99bj1mv.js.map} +1 -1
- package/dist/{chunk-hq496pa4.js → chunk-zbhqa2z7.js} +2 -2
- package/dist/{chunk-hq496pa4.js.map → chunk-zbhqa2z7.js.map} +1 -1
- package/dist/{chunk-b004v4jt.js → chunk-zkpwb3fp.js} +2 -2
- package/dist/{chunk-b004v4jt.js.map → chunk-zkpwb3fp.js.map} +1 -1
- package/dist/{chunk-2qyghpe0.js → chunk-zz0t0pwk.js} +2 -2
- package/dist/{chunk-2qyghpe0.js.map → chunk-zz0t0pwk.js.map} +1 -1
- package/dist/chunks/{ThemeProvider-Bz-y1g2i.js → ThemeProvider-D9v0VAbY.js} +53 -4
- package/dist/chunks/ThemeProvider-D9v0VAbY.js.map +1 -0
- package/dist/client/Mutation.d.ts +8 -1
- package/dist/client/Mutation.d.ts.map +1 -1
- package/dist/client/MutationError.d.ts +109 -0
- package/dist/client/MutationError.d.ts.map +1 -0
- package/dist/client/QueryResource.d.ts +24 -0
- package/dist/client/QueryResource.d.ts.map +1 -1
- package/dist/client/auth/useForgotPassword.d.ts +1 -1
- package/dist/client/auth/useResetPassword.d.ts +1 -1
- package/dist/client/auth/useSignIn.d.ts +1 -1
- package/dist/client/auth/useSignOut.d.ts +1 -1
- package/dist/client/auth/useSignUp.d.ts +1 -1
- package/dist/client/index.d.ts +4 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +284 -16
- package/dist/client/index.js.map +1 -1
- package/dist/client/useInfiniteQuery.d.ts +59 -0
- package/dist/client/useInfiniteQuery.d.ts.map +1 -0
- package/dist/client/useMutate.d.ts +7 -1
- package/dist/client/useMutate.d.ts.map +1 -1
- package/dist/client/useMutation.d.ts +6 -21
- package/dist/client/useMutation.d.ts.map +1 -1
- package/dist/client/useQuery.d.ts +4 -4
- 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/Features.d.ts +45 -2
- package/dist/facades/Features.d.ts.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/kernel/index.d.ts +3 -2
- package/dist/kernel/index.d.ts.map +1 -1
- package/dist/kernel/index.js +3 -3
- package/dist/kernel/index.js.map +2 -2
- package/dist/orm/Model.d.ts.map +1 -1
- package/dist/orm/compile/lock.d.ts +23 -0
- package/dist/orm/compile/lock.d.ts.map +1 -0
- package/dist/orm/compile/plan-relations.d.ts.map +1 -1
- package/dist/orm/compile/read.d.ts.map +1 -1
- package/dist/orm/dialect/index.d.ts +23 -0
- package/dist/orm/dialect/index.d.ts.map +1 -1
- package/dist/orm/dialect/postgres.d.ts +2 -0
- package/dist/orm/dialect/postgres.d.ts.map +1 -1
- package/dist/orm/dialect/sqlite.d.ts +2 -0
- package/dist/orm/dialect/sqlite.d.ts.map +1 -1
- package/dist/orm/errors.d.ts +17 -0
- package/dist/orm/errors.d.ts.map +1 -1
- package/dist/orm/index.d.ts +2 -2
- package/dist/orm/index.d.ts.map +1 -1
- package/dist/orm/index.js +3 -3
- package/dist/orm/index.js.map +11 -10
- package/dist/orm/plan.d.ts.map +1 -1
- package/dist/orm/types.d.ts +32 -0
- package/dist/orm/types.d.ts.map +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/index.js.map +1 -1
- package/dist/services/features/FeatureFlagStore.d.ts +14 -1
- package/dist/services/features/FeatureFlagStore.d.ts.map +1 -1
- package/dist/services/features/FeatureManager.d.ts +43 -0
- package/dist/services/features/FeatureManager.d.ts.map +1 -1
- package/dist/services/features/sources/DatabaseFeatureFlagSource.d.ts +17 -1
- package/dist/services/features/sources/DatabaseFeatureFlagSource.d.ts.map +1 -1
- package/dist/services/features/sources/FeatureFlagSource.d.ts +28 -0
- package/dist/services/features/sources/FeatureFlagSource.d.ts.map +1 -1
- package/dist/services/features/sources/StaticFeatureFlagSource.d.ts +7 -2
- package/dist/services/features/sources/StaticFeatureFlagSource.d.ts.map +1 -1
- package/dist/services/features/types.d.ts +11 -0
- package/dist/services/features/types.d.ts.map +1 -1
- package/dist/services/index.d.ts +3 -3
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +7 -7
- package/dist/services/index.js.map +3 -3
- package/dist/services/queue/work.js +2 -2
- package/dist/services/queue/work.js.map +1 -1
- package/dist/support/index.js +2 -2
- package/dist/support/index.js.map +1 -1
- package/dist/testing/index.js +1 -1
- package/package.json +1 -1
- package/skills/gemi-react-best-practices/rules/controller-throw-framework-errors.md +3 -3
- package/dist/chunk-4t9zv1rk.js +0 -19
- package/dist/chunk-ayja3wqv.js +0 -54
- package/dist/chunk-ayja3wqv.js.map +0 -15
- package/dist/chunk-ds8d17k6.js +0 -5
- package/dist/chunk-x2tqctjm.js +0 -5
- package/dist/chunks/ThemeProvider-Bz-y1g2i.js.map +0 -1
- /package/dist/{chunk-4azcbkxm.js.map → chunk-bjr740m4.js.map} +0 -0
- /package/dist/{chunk-p9rg95p6.js.map → chunk-ejspccjb.js.map} +0 -0
- /package/dist/{chunk-ezd59jpg.js.map → chunk-r4t5a213.js.map} +0 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What a failed mutation hands `onError` and puts in `error` — `useMutation`
|
|
3
|
+
* and its `usePost`/`usePut`/`usePatch`/`useDelete` shorthands, `useUpload`,
|
|
4
|
+
* and `<Form onError>`.
|
|
5
|
+
*
|
|
6
|
+
* It was typed `any` on `<Form>` and on the hooks' `error`, and as a union of
|
|
7
|
+
* `kind`s the server never sent (`not_authorized`, `insufficient_permissions`)
|
|
8
|
+
* on the hooks' `onError`. Apps sniffed the shape themselves, and got it wrong
|
|
9
|
+
* as easily as right. This is the shape the framework actually produces,
|
|
10
|
+
* member by member, read off the server's error payloads and the client's
|
|
11
|
+
* fetch code (issue #626).
|
|
12
|
+
*
|
|
13
|
+
* The value is exactly what the response's `error` field held, unchanged — a
|
|
14
|
+
* bare string for most refusals — so it is not tagged with the status it came
|
|
15
|
+
* with. Use the guards below rather than comparing strings, and
|
|
16
|
+
* `mutationErrorKind` to branch on all of them at once.
|
|
17
|
+
*/
|
|
18
|
+
/** A server-side `ValidationError` (400): messages keyed by field. */
|
|
19
|
+
export interface MutationValidationError {
|
|
20
|
+
kind: "validation_error";
|
|
21
|
+
messages: Record<string, string[]>;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A single form-level message, which `<FormError>` renders. gemi never sends
|
|
25
|
+
* one itself; a `RequestBreakerError` of the app's own can.
|
|
26
|
+
*/
|
|
27
|
+
export interface MutationFormError {
|
|
28
|
+
kind: "form_error";
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
/** `useUpload` only: an upload that failed with a body that was not JSON. */
|
|
32
|
+
export interface MutationServerError {
|
|
33
|
+
kind: "server_error";
|
|
34
|
+
message: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A `{ message }` body: a missing record, file or route (404, `"Not found"`),
|
|
38
|
+
* a policy denial (403, `"Forbidden"`), a rate limit (429,
|
|
39
|
+
* `"Rate limit exceeded"`) or an unsatisfiable range (416).
|
|
40
|
+
*/
|
|
41
|
+
export interface MutationMessageError {
|
|
42
|
+
kind?: undefined;
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Every value `onError` receives and `error` holds for a request gemi's server
|
|
47
|
+
* answered, or failed to reach:
|
|
48
|
+
*
|
|
49
|
+
* - `MutationValidationError`, `MutationFormError`, `MutationServerError` —
|
|
50
|
+
* tagged with `kind`.
|
|
51
|
+
* - `MutationMessageError` — `{ message }`, see above.
|
|
52
|
+
* - `string` — a refusal or failure answered with a bare string:
|
|
53
|
+
* `"Authentication error"` (401), `"Not authorized"` (401), `"Insufficient
|
|
54
|
+
* permissions"` (403), `"Invalid CSRF token"` (403), `"Internal Server
|
|
55
|
+
* Error"` (500; the exception's message under `gemi dev`). A refusal thrown
|
|
56
|
+
* with a message of its own arrives as that message.
|
|
57
|
+
* - `Error` — raised in the browser: a `TypeError` when the request never got
|
|
58
|
+
* an answer (offline, DNS, CORS), a `SyntaxError` when the answer was not
|
|
59
|
+
* JSON (a proxy's HTML error page, say). A throw from an `onSuccess` of
|
|
60
|
+
* yours is reported through `onError` as well, as whatever it threw.
|
|
61
|
+
*
|
|
62
|
+
* A cancelled request is not an error: `onCanceled` runs and `error` stays
|
|
63
|
+
* `null`. A route that answers an error body of its own shape is outside this
|
|
64
|
+
* type.
|
|
65
|
+
*/
|
|
66
|
+
export type MutationError = MutationValidationError | MutationFormError | MutationServerError | MutationMessageError | string | Error;
|
|
67
|
+
/** What `mutationErrorKind` answers, one per guard below. */
|
|
68
|
+
export type MutationErrorKind = "validation" | "form" | "authentication" | "permission" | "csrf" | "not_found" | "rate_limit" | "server" | "network" | "unknown";
|
|
69
|
+
declare const AUTHENTICATION = "Authentication error";
|
|
70
|
+
declare const CSRF = "Invalid CSRF token";
|
|
71
|
+
declare const SERVER = "Internal Server Error";
|
|
72
|
+
type PermissionRefusal = "Insufficient permissions" | "Not authorized";
|
|
73
|
+
type MessageOf<M extends string> = MutationMessageError & {
|
|
74
|
+
message: M;
|
|
75
|
+
};
|
|
76
|
+
/** Field messages, as `<ValidationErrors>` renders them. */
|
|
77
|
+
export declare function isValidationError(error: unknown): error is MutationValidationError;
|
|
78
|
+
/** A form-level message, as `<FormError>` renders it. */
|
|
79
|
+
export declare function isFormError(error: unknown): error is MutationFormError;
|
|
80
|
+
/** No signed-in user: `AuthenticationError` (401). */
|
|
81
|
+
export declare function isAuthenticationError(error: unknown): error is typeof AUTHENTICATION;
|
|
82
|
+
/**
|
|
83
|
+
* A signed-in user who may not do this: `InsufficientPermissionsError` (403),
|
|
84
|
+
* `AuthorizationError` (401) or a policy denial (403, `{ message:
|
|
85
|
+
* "Forbidden" }`). Recognised by the framework's default messages.
|
|
86
|
+
*/
|
|
87
|
+
export declare function isPermissionError(error: unknown): error is PermissionRefusal | MessageOf<"Forbidden">;
|
|
88
|
+
/** The CSRF cookie is missing or stale (403). A reload fixes it. */
|
|
89
|
+
export declare function isCsrfError(error: unknown): error is typeof CSRF;
|
|
90
|
+
/** A missing record, file or route (404). */
|
|
91
|
+
export declare function isNotFoundError(error: unknown): error is MessageOf<"Not found">;
|
|
92
|
+
/** `RateLimitMiddleware` refused the request (429). */
|
|
93
|
+
export declare function isRateLimitError(error: unknown): error is MessageOf<"Rate limit exceeded">;
|
|
94
|
+
/**
|
|
95
|
+
* The server failed (a production 500), or answered something that is not
|
|
96
|
+
* JSON. Under `gemi dev` a 500 carries the exception's message instead, which
|
|
97
|
+
* is `"unknown"`.
|
|
98
|
+
*/
|
|
99
|
+
export declare function isServerError(error: unknown): error is typeof SERVER | MutationServerError | SyntaxError;
|
|
100
|
+
/** The request got no answer: offline, DNS, CORS, a dropped connection. */
|
|
101
|
+
export declare function isNetworkError(error: unknown): error is TypeError;
|
|
102
|
+
/**
|
|
103
|
+
* Which of the guards above `error` passes, for a `switch` over all of them.
|
|
104
|
+
* `"unknown"` is everything else: a refusal thrown with a message of its own,
|
|
105
|
+
* a 500 under `gemi dev`, an error body of the app's own shape.
|
|
106
|
+
*/
|
|
107
|
+
export declare function mutationErrorKind(error: unknown): MutationErrorKind;
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=MutationError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MutationError.d.ts","sourceRoot":"","sources":["../../client/MutationError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sEAAsE;AACtE,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACpC;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6EAA6E;AAC7E,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;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,oBAAoB,GACpB,MAAM,GACN,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;AAUd,QAAA,MAAM,cAAc,yBAAyB,CAAC;AAK9C,QAAA,MAAM,IAAI,uBAAuB,CAAC;AAClC,QAAA,MAAM,MAAM,0BAA0B,CAAC;AAEvC,KAA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
|
|
34
34
|
*/
|
|
35
35
|
private pending;
|
|
36
|
+
/**
|
|
37
|
+
* How many mounted readers are rendering each variant. A mounted variant is
|
|
38
|
+
* on screen, so an invalidation refetches it now; one nobody renders is only
|
|
39
|
+
* marked stale and revalidates when something reads it next — invalidating
|
|
40
|
+
* every search variant a user browsed through must not put each of them on
|
|
41
|
+
* the wire at once.
|
|
42
|
+
*/
|
|
43
|
+
private watchers;
|
|
36
44
|
constructor(key: string, initialState: Record<string, any>);
|
|
37
45
|
/**
|
|
38
46
|
* Adopt server-prefetched data into the cache.
|
|
@@ -90,6 +98,22 @@ export declare class QueryResource {
|
|
|
90
98
|
* re-throwing the stored failure.
|
|
91
99
|
*/
|
|
92
100
|
clearError(variantKey?: string): void;
|
|
101
|
+
/**
|
|
102
|
+
* Mark a variant as rendered by a mounted reader until the returned release
|
|
103
|
+
* runs. `useQuery` and `useInfiniteQuery` hold one for every variant they
|
|
104
|
+
* put on screen.
|
|
105
|
+
*/
|
|
106
|
+
retain(variantKey: string): () => void;
|
|
107
|
+
/** Every variant key this resource holds state for, in insertion order. */
|
|
108
|
+
variantKeys(): string[];
|
|
109
|
+
/**
|
|
110
|
+
* The many-variant counterpart of `mutate`. The update (when given) is
|
|
111
|
+
* applied to the variant's cached data right away, but only a variant a
|
|
112
|
+
* mounted reader is rendering refetches now; any other one is marked stale
|
|
113
|
+
* and revalidates — bypassing the HTTP cache — the next time it is read.
|
|
114
|
+
*/
|
|
115
|
+
invalidate(variantKey: string, fn?: (data: any) => any): void;
|
|
116
|
+
private dropHttpCache;
|
|
93
117
|
mutate(variantKey: string, fn?: (data: any) => any): void;
|
|
94
118
|
refetch(variantKey: string): void;
|
|
95
119
|
private resolveVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QueryResource.d.ts","sourceRoot":"","sources":["../../client/QueryResource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,KAAK,KA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C,MAAM,EAAE,GAAG,CAAC;IAM1D;;;;;;;OAOG;IACH,OAAO,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,SAAS;IAsC5D,OAAO,CAAC,UAAU;IAalB,OAAO,CAAC,MAAM;IAQd,OAAO,CAAC,OAAO;IAQf;;;;;;;;;;OAUG;IACH,IAAI,CAAC,UAAU,EAAE,MAAM;IAIvB;;;;;;;;OAQG;IACH,IAAI,CACF,UAAU,EAAE,MAAM,EAClB,SAAS,GAAE,MAA2B,GACrC;QAAE,KAAK,CAAC,EAAE,KAAK,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAA;KAAE;IA+B7C,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,GAAE,MAA2B;IA2BrE;;;;;;;;;;OAUG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,GAAE,MAA2B;IAcrE;;;;OAIG;IACH,UAAU,CAAC,UAAU,CAAC,EAAE,MAAM;IAe9B;;;;OAIG;IACH,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,IAAI;IAetC,2EAA2E;IAC3E,WAAW,IAAI,MAAM,EAAE;IAIvB;;;;;OAKG;IACH,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG;IAetD,OAAO,CAAC,aAAa;IAiBrB,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,GAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAoB;IA2BlE,OAAO,CAAC,UAAU,EAAE,MAAM;YAIZ,cAAc;CAgF7B"}
|
|
@@ -12,7 +12,7 @@ export declare function useSignIn(args?: UseSignInArgs): {
|
|
|
12
12
|
accounts: import("../../auth/types").Account[];
|
|
13
13
|
extension: Record<string, any>;
|
|
14
14
|
};
|
|
15
|
-
error:
|
|
15
|
+
error: import("gemi/client").MutationError;
|
|
16
16
|
loading: boolean;
|
|
17
17
|
formData: FormData;
|
|
18
18
|
cancel: () => void;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/// <reference path="../gemi.d.ts" />
|
|
2
2
|
export { useQuery } from "./useQuery";
|
|
3
3
|
export type { QueryResult, GemiQueryDefaults } from "./useQuery";
|
|
4
|
+
export { useInfiniteQuery } from "./useInfiniteQuery";
|
|
5
|
+
export type { InfiniteQueryConfig, InfiniteQueryReturn, } from "./useInfiniteQuery";
|
|
4
6
|
export { QueryError } from "./QueryError";
|
|
5
7
|
export { useMutation, useDelete, usePatch, usePost, usePut, useUpload } from "./useMutation";
|
|
6
8
|
export { useMutate } from "./useMutate";
|
|
9
|
+
export { isValidationError, isFormError, isAuthenticationError, isPermissionError, isCsrfError, isNotFoundError, isRateLimitError, isServerError, isNetworkError, mutationErrorKind, } from "./MutationError";
|
|
10
|
+
export type { MutationError, MutationErrorKind, MutationValidationError, MutationFormError, MutationServerError, MutationMessageError, } from "./MutationError";
|
|
7
11
|
export { Form, FormError, useMutationStatus, useFormStatus, useFormData, FormFieldContainer, ValidationErrors, } from "./Mutation";
|
|
8
12
|
export { QueryManagerProvider } from "./QueryManagerContext";
|
|
9
13
|
export type { QueryConfig } from "./QueryManagerContext";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../client/index.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,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Ac,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,OAAO,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as isAbsoluteUrl, B as QueryError, C as useNavigate, D as ServerDataProvider, E as ServerDataContext, F as applyParams$1, I as QueryConfigContext, L as QueryManagerContext, M as Action, O as useLocation, P as toVariantKey, R as QueryManagerProvider, S as useSearchParams, T as I18nProvider, V as Subject, _ as registerDictionary, a as m, b as routeDataUrl, c as ClientRouterContext, d as ComponentsProvider, f as initialViewModulesReady, g as loadDictionaryForRender, h as loadDictionary, i as WebSocketContextProvider, k as domainUrl, l as ClientRouterProvider, m as subscribeViewModules, n as useTheme, o as RouteTransitionProvider, p as loadViewModule, r as WebSocketContext, s as useRouteTransition, t as ThemeProvider, u as ComponentsContext, v as setActiveLocale, w as I18nContext, x as useRoute, y as readRoutePayload, z as DEFAULT_STALE_TIME } from "../chunks/ThemeProvider-
|
|
1
|
+
import { A as isAbsoluteUrl, B as QueryError, C as useNavigate, D as ServerDataProvider, E as ServerDataContext, F as applyParams$1, I as QueryConfigContext, L as QueryManagerContext, M as Action, O as useLocation, P as toVariantKey, R as QueryManagerProvider, S as useSearchParams, T as I18nProvider, V as Subject, _ as registerDictionary, a as m, b as routeDataUrl, c as ClientRouterContext, d as ComponentsProvider, f as initialViewModulesReady, g as loadDictionaryForRender, h as loadDictionary, i as WebSocketContextProvider, k as domainUrl, l as ClientRouterProvider, m as subscribeViewModules, n as useTheme, o as RouteTransitionProvider, p as loadViewModule, r as WebSocketContext, s as useRouteTransition, t as ThemeProvider, u as ComponentsContext, v as setActiveLocale, w as I18nContext, x as useRoute, y as readRoutePayload, z as DEFAULT_STALE_TIME } from "../chunks/ThemeProvider-D9v0VAbY.js";
|
|
2
2
|
import { n as RouteStateContext, r as RouteStateProvider, t as useParams } from "../chunks/useParams-BN3XXfmG.js";
|
|
3
3
|
import { Fragment, StrictMode, Suspense, createContext, createElement, isValidElement, memo, use, useCallback, useContext, useDeferredValue, useEffect, useMemo, useRef, useState, useSyncExternalStore, useTransition } from "react";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -110,7 +110,14 @@ function useFrameworkQuery(url, ...args) {
|
|
|
110
110
|
const focusEligibleRef = useRef(!lazy);
|
|
111
111
|
const wasAwayRef = useRef(false);
|
|
112
112
|
const lastFocusRevalidationRef = useRef(0);
|
|
113
|
-
const subscribe = useCallback((onStoreChange) =>
|
|
113
|
+
const subscribe = useCallback((onStoreChange) => {
|
|
114
|
+
const release = resource.retain(variantKey);
|
|
115
|
+
const unsubscribe = resource.store.subscribe(onStoreChange);
|
|
116
|
+
return () => {
|
|
117
|
+
unsubscribe();
|
|
118
|
+
release();
|
|
119
|
+
};
|
|
120
|
+
}, [resource, variantKey]);
|
|
114
121
|
const getSnapshot = useCallback(() => resource.peek(variantKey), [resource, variantKey]);
|
|
115
122
|
const snapshot = useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
116
123
|
const lastDataRef = useRef(snapshot?.hasData ? snapshot : null);
|
|
@@ -301,6 +308,179 @@ function useFrameworkQuery(url, ...args) {
|
|
|
301
308
|
};
|
|
302
309
|
}
|
|
303
310
|
//#endregion
|
|
311
|
+
//#region client/useInfiniteQuery.ts
|
|
312
|
+
/**
|
|
313
|
+
* Follows the cursor chain through the cache: the first page, then
|
|
314
|
+
* `getNextPage` of it, and so on, up to `count` pages. Stops at the first page
|
|
315
|
+
* that has no data yet — that one is loading (or failed).
|
|
316
|
+
*/
|
|
317
|
+
function walkPages(resource, firstKey, search, pageParam, count, getNextPage) {
|
|
318
|
+
const keys = [firstKey];
|
|
319
|
+
const states = [resource.peek(firstKey)];
|
|
320
|
+
const pages = [];
|
|
321
|
+
let next = null;
|
|
322
|
+
for (let i = 0; i < count; i++) {
|
|
323
|
+
const state = states[i];
|
|
324
|
+
if (!state?.hasData) break;
|
|
325
|
+
pages.push(state.data);
|
|
326
|
+
next = getNextPage(state.data, pages.slice());
|
|
327
|
+
if (next === null || next === void 0 || next === false) break;
|
|
328
|
+
if (i + 1 === count) break;
|
|
329
|
+
const key = toVariantKey({
|
|
330
|
+
...search,
|
|
331
|
+
[pageParam]: next
|
|
332
|
+
});
|
|
333
|
+
keys.push(key);
|
|
334
|
+
states.push(resource.peek(key));
|
|
335
|
+
}
|
|
336
|
+
return {
|
|
337
|
+
keys,
|
|
338
|
+
states,
|
|
339
|
+
pages,
|
|
340
|
+
next
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* A paged list whose pages live in the query cache: page 1 is a plain
|
|
345
|
+
* `useQuery` (so it suspends, SSR-renders and `Query.prefetch`es exactly like
|
|
346
|
+
* one), and each further page is the same path with `pageParam` added to the
|
|
347
|
+
* search — its own cached variant, which `useMutate` updates and invalidates
|
|
348
|
+
* like any other. Changing `params` or `search` starts over from page 1.
|
|
349
|
+
*/
|
|
350
|
+
function useInfiniteQuery(url, options, config) {
|
|
351
|
+
const { getNextPage, pageParam = "page", getItems, getKey, ...queryConfig } = config;
|
|
352
|
+
const first = useQuery(url, options, queryConfig);
|
|
353
|
+
const routeParams = useParams();
|
|
354
|
+
const params = options && "params" in options ? {
|
|
355
|
+
...routeParams,
|
|
356
|
+
...options.params
|
|
357
|
+
} : routeParams;
|
|
358
|
+
const search = options?.search ?? {};
|
|
359
|
+
const path = applyParams$1(url, params);
|
|
360
|
+
const firstKey = toVariantKey(search);
|
|
361
|
+
const listKey = `${path}?${firstKey}`;
|
|
362
|
+
const { getResource } = useContext(QueryManagerContext);
|
|
363
|
+
const appConfig = useContext(QueryConfigContext);
|
|
364
|
+
const { prefetchedData } = useRouteData();
|
|
365
|
+
const resource = getResource(path, prefetchedData?.[path] ?? void 0);
|
|
366
|
+
const [requested, setRequested] = useState({
|
|
367
|
+
listKey,
|
|
368
|
+
count: 1
|
|
369
|
+
});
|
|
370
|
+
const count = requested.listKey === listKey ? requested.count : 1;
|
|
371
|
+
const getNextPageRef = useRef(getNextPage);
|
|
372
|
+
getNextPageRef.current = getNextPage;
|
|
373
|
+
const snapshotRef = useRef(null);
|
|
374
|
+
const getSnapshot = useCallback(() => {
|
|
375
|
+
const walked = walkPages(resource, firstKey, search, pageParam, count, getNextPageRef.current);
|
|
376
|
+
const previous = snapshotRef.current;
|
|
377
|
+
if (previous && previous.keys.length === walked.keys.length && previous.keys.every((key, i) => key === walked.keys[i]) && previous.states.every((state, i) => state === walked.states[i])) return previous;
|
|
378
|
+
snapshotRef.current = walked;
|
|
379
|
+
return walked;
|
|
380
|
+
}, [
|
|
381
|
+
resource,
|
|
382
|
+
firstKey,
|
|
383
|
+
pageParam,
|
|
384
|
+
count
|
|
385
|
+
]);
|
|
386
|
+
const chain = useSyncExternalStore(resource.store.subscribe, getSnapshot, getSnapshot);
|
|
387
|
+
const laterKeysId = chain.keys.slice(1).join("\n");
|
|
388
|
+
const staleTime = queryConfig.staleTime ?? appConfig?.staleTime;
|
|
389
|
+
const staleTimeRef = useRef(staleTime);
|
|
390
|
+
staleTimeRef.current = staleTime;
|
|
391
|
+
const ensuredRef = useRef({
|
|
392
|
+
listKey,
|
|
393
|
+
keys: /* @__PURE__ */ new Set()
|
|
394
|
+
});
|
|
395
|
+
useEffect(() => {
|
|
396
|
+
if (!laterKeysId) return;
|
|
397
|
+
if (ensuredRef.current.listKey !== listKey) ensuredRef.current = {
|
|
398
|
+
listKey,
|
|
399
|
+
keys: /* @__PURE__ */ new Set()
|
|
400
|
+
};
|
|
401
|
+
const ensured = ensuredRef.current.keys;
|
|
402
|
+
const keys = laterKeysId.split("\n");
|
|
403
|
+
const releases = keys.map((key) => resource.retain(key));
|
|
404
|
+
for (const key of keys) {
|
|
405
|
+
if (ensured.has(key)) continue;
|
|
406
|
+
ensured.add(key);
|
|
407
|
+
resource.getVariant(key, staleTimeRef.current);
|
|
408
|
+
}
|
|
409
|
+
return () => releases.forEach((release) => release());
|
|
410
|
+
}, [
|
|
411
|
+
resource,
|
|
412
|
+
listKey,
|
|
413
|
+
laterKeysId
|
|
414
|
+
]);
|
|
415
|
+
const ownFirstPage = chain.states[0]?.hasData === true;
|
|
416
|
+
const fallbackPage = ownFirstPage ? void 0 : first.data;
|
|
417
|
+
const keepingPrevious = !ownFirstPage && fallbackPage !== void 0 && first.loading;
|
|
418
|
+
const shownRef = useRef(null);
|
|
419
|
+
const pages = useMemo(() => ownFirstPage ? chain.pages : keepingPrevious && shownRef.current ? shownRef.current : fallbackPage !== void 0 ? [fallbackPage] : [], [
|
|
420
|
+
ownFirstPage,
|
|
421
|
+
chain,
|
|
422
|
+
keepingPrevious,
|
|
423
|
+
fallbackPage
|
|
424
|
+
]);
|
|
425
|
+
useEffect(() => {
|
|
426
|
+
if (ownFirstPage) shownRef.current = pages;
|
|
427
|
+
}, [ownFirstPage, pages]);
|
|
428
|
+
const pending = chain.states[chain.pages.length];
|
|
429
|
+
const hasMore = ownFirstPage && chain.pages.length === chain.keys.length && chain.next !== null && chain.next !== void 0 && chain.next !== false;
|
|
430
|
+
const isFetchingNextPage = ownFirstPage && chain.pages.length < chain.keys.length && !pending?.error;
|
|
431
|
+
const pageError = ownFirstPage && chain.pages.length < chain.keys.length ? pending?.error ?? null : null;
|
|
432
|
+
const items = useMemo(() => {
|
|
433
|
+
const out = [];
|
|
434
|
+
const seen = /* @__PURE__ */ new Set();
|
|
435
|
+
for (const page of pages) {
|
|
436
|
+
const rows = getItems ? getItems(page) : Array.isArray(page) ? page : [];
|
|
437
|
+
for (const row of rows) {
|
|
438
|
+
if (getKey) {
|
|
439
|
+
const key = getKey(row);
|
|
440
|
+
if (seen.has(key)) continue;
|
|
441
|
+
seen.add(key);
|
|
442
|
+
}
|
|
443
|
+
out.push(row);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
return out;
|
|
447
|
+
}, [
|
|
448
|
+
pages,
|
|
449
|
+
getItems,
|
|
450
|
+
getKey
|
|
451
|
+
]);
|
|
452
|
+
const fetchNextPage = useCallback(() => {
|
|
453
|
+
if (pageError) {
|
|
454
|
+
resource.refetch(chain.keys[chain.keys.length - 1]);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (!hasMore) return;
|
|
458
|
+
setRequested((current) => ({
|
|
459
|
+
listKey,
|
|
460
|
+
count: (current.listKey === listKey ? current.count : 1) + 1
|
|
461
|
+
}));
|
|
462
|
+
}, [
|
|
463
|
+
pageError,
|
|
464
|
+
hasMore,
|
|
465
|
+
resource,
|
|
466
|
+
chain,
|
|
467
|
+
listKey
|
|
468
|
+
]);
|
|
469
|
+
const refetch = useCallback(() => {
|
|
470
|
+
for (const key of chain.keys) resource.refetch(key);
|
|
471
|
+
}, [resource, chain]);
|
|
472
|
+
return {
|
|
473
|
+
pages,
|
|
474
|
+
items,
|
|
475
|
+
hasMore,
|
|
476
|
+
fetchNextPage,
|
|
477
|
+
isFetchingNextPage,
|
|
478
|
+
loading: first.loading,
|
|
479
|
+
error: first.error ?? pageError,
|
|
480
|
+
refetch
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
//#endregion
|
|
304
484
|
//#region client/useMutation.ts
|
|
305
485
|
function applyParams(url, params = {}) {
|
|
306
486
|
let out = url;
|
|
@@ -516,12 +696,37 @@ function useUpload(url, ...args) {
|
|
|
516
696
|
}
|
|
517
697
|
//#endregion
|
|
518
698
|
//#region client/useMutate.ts
|
|
699
|
+
/**
|
|
700
|
+
* The shape guard both `mutate` forms apply: the callback's return value
|
|
701
|
+
* *replaces* the cached data, so it has to keep the data's shape — a stray
|
|
702
|
+
* value must not corrupt the cache. It does not merge or append.
|
|
703
|
+
*/
|
|
704
|
+
function applyUpdate(data, fn) {
|
|
705
|
+
const updatedData = typeof fn === "function" ? fn(data) : fn;
|
|
706
|
+
if (isPlainObject(data)) {
|
|
707
|
+
if (isPlainObject(updatedData)) return updatedData;
|
|
708
|
+
throw new Error("Mutate function must return an object when the current data is an object.");
|
|
709
|
+
}
|
|
710
|
+
if (Array.isArray(data)) {
|
|
711
|
+
if (Array.isArray(updatedData)) return updatedData;
|
|
712
|
+
throw new Error("Mutate function must return an array when the current data is an array.");
|
|
713
|
+
}
|
|
714
|
+
if (typeof data !== typeof updatedData) throw new Error("Mutate function must return the same type as the current data.");
|
|
715
|
+
return updatedData;
|
|
716
|
+
}
|
|
519
717
|
function useMutate() {
|
|
520
718
|
const { getResource } = useContext(QueryManagerContext);
|
|
521
719
|
return function mutate(options, fn) {
|
|
522
720
|
const { path, params = {}, search = {} } = options ?? {};
|
|
523
721
|
const normalPath = applyParams$1(path, params);
|
|
524
722
|
const resource = getResource(normalPath);
|
|
723
|
+
if (typeof search === "function") {
|
|
724
|
+
for (const variantKey of resource.variantKeys()) {
|
|
725
|
+
if (!search(new URLSearchParams(variantKey))) continue;
|
|
726
|
+
resource.invalidate(variantKey, fn === void 0 ? void 0 : (data) => data === null ? data : applyUpdate(data, fn));
|
|
727
|
+
}
|
|
728
|
+
return;
|
|
729
|
+
}
|
|
525
730
|
const variantKey = toVariantKey(search);
|
|
526
731
|
return resource.mutate.call(resource, variantKey, (data) => {
|
|
527
732
|
if (data === void 0 || data === null) {
|
|
@@ -529,21 +734,84 @@ function useMutate() {
|
|
|
529
734
|
return data;
|
|
530
735
|
}
|
|
531
736
|
if (!fn) return data;
|
|
532
|
-
|
|
533
|
-
if (isPlainObject(data)) {
|
|
534
|
-
if (isPlainObject(updatedData)) return updatedData;
|
|
535
|
-
throw new Error("Mutate function must return an object when the current data is an object.");
|
|
536
|
-
}
|
|
537
|
-
if (Array.isArray(data)) {
|
|
538
|
-
if (Array.isArray(updatedData)) return updatedData;
|
|
539
|
-
throw new Error("Mutate function must return an array when the current data is an array.");
|
|
540
|
-
}
|
|
541
|
-
if (typeof data !== typeof updatedData) throw new Error("Mutate function must return the same type as the current data.");
|
|
542
|
-
return updatedData;
|
|
737
|
+
return applyUpdate(data, fn);
|
|
543
738
|
});
|
|
544
739
|
};
|
|
545
740
|
}
|
|
546
741
|
//#endregion
|
|
742
|
+
//#region client/MutationError.ts
|
|
743
|
+
var AUTHENTICATION = "Authentication error";
|
|
744
|
+
var PERMISSION = ["Insufficient permissions", "Not authorized"];
|
|
745
|
+
var CSRF = "Invalid CSRF token";
|
|
746
|
+
var SERVER = "Internal Server Error";
|
|
747
|
+
function isObject(error) {
|
|
748
|
+
return typeof error === "object" && error !== null;
|
|
749
|
+
}
|
|
750
|
+
function bodyMessage(error) {
|
|
751
|
+
return isObject(error) && !(error instanceof Error) && !("kind" in error) ? error.message : void 0;
|
|
752
|
+
}
|
|
753
|
+
/** Field messages, as `<ValidationErrors>` renders them. */
|
|
754
|
+
function isValidationError(error) {
|
|
755
|
+
return isObject(error) && error.kind === "validation_error";
|
|
756
|
+
}
|
|
757
|
+
/** A form-level message, as `<FormError>` renders it. */
|
|
758
|
+
function isFormError(error) {
|
|
759
|
+
return isObject(error) && error.kind === "form_error";
|
|
760
|
+
}
|
|
761
|
+
/** No signed-in user: `AuthenticationError` (401). */
|
|
762
|
+
function isAuthenticationError(error) {
|
|
763
|
+
return error === AUTHENTICATION;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* A signed-in user who may not do this: `InsufficientPermissionsError` (403),
|
|
767
|
+
* `AuthorizationError` (401) or a policy denial (403, `{ message:
|
|
768
|
+
* "Forbidden" }`). Recognised by the framework's default messages.
|
|
769
|
+
*/
|
|
770
|
+
function isPermissionError(error) {
|
|
771
|
+
return typeof error === "string" && PERMISSION.includes(error) || bodyMessage(error) === "Forbidden";
|
|
772
|
+
}
|
|
773
|
+
/** The CSRF cookie is missing or stale (403). A reload fixes it. */
|
|
774
|
+
function isCsrfError(error) {
|
|
775
|
+
return error === CSRF;
|
|
776
|
+
}
|
|
777
|
+
/** A missing record, file or route (404). */
|
|
778
|
+
function isNotFoundError(error) {
|
|
779
|
+
return bodyMessage(error) === "Not found";
|
|
780
|
+
}
|
|
781
|
+
/** `RateLimitMiddleware` refused the request (429). */
|
|
782
|
+
function isRateLimitError(error) {
|
|
783
|
+
return bodyMessage(error) === "Rate limit exceeded";
|
|
784
|
+
}
|
|
785
|
+
/**
|
|
786
|
+
* The server failed (a production 500), or answered something that is not
|
|
787
|
+
* JSON. Under `gemi dev` a 500 carries the exception's message instead, which
|
|
788
|
+
* is `"unknown"`.
|
|
789
|
+
*/
|
|
790
|
+
function isServerError(error) {
|
|
791
|
+
return error === SERVER || isObject(error) && error.kind === "server_error" || error instanceof SyntaxError;
|
|
792
|
+
}
|
|
793
|
+
/** The request got no answer: offline, DNS, CORS, a dropped connection. */
|
|
794
|
+
function isNetworkError(error) {
|
|
795
|
+
return error instanceof TypeError;
|
|
796
|
+
}
|
|
797
|
+
/**
|
|
798
|
+
* Which of the guards above `error` passes, for a `switch` over all of them.
|
|
799
|
+
* `"unknown"` is everything else: a refusal thrown with a message of its own,
|
|
800
|
+
* a 500 under `gemi dev`, an error body of the app's own shape.
|
|
801
|
+
*/
|
|
802
|
+
function mutationErrorKind(error) {
|
|
803
|
+
if (isValidationError(error)) return "validation";
|
|
804
|
+
if (isFormError(error)) return "form";
|
|
805
|
+
if (isAuthenticationError(error)) return "authentication";
|
|
806
|
+
if (isPermissionError(error)) return "permission";
|
|
807
|
+
if (isCsrfError(error)) return "csrf";
|
|
808
|
+
if (isNotFoundError(error)) return "not_found";
|
|
809
|
+
if (isRateLimitError(error)) return "rate_limit";
|
|
810
|
+
if (isServerError(error)) return "server";
|
|
811
|
+
if (isNetworkError(error)) return "network";
|
|
812
|
+
return "unknown";
|
|
813
|
+
}
|
|
814
|
+
//#endregion
|
|
547
815
|
//#region client/Mutation.tsx
|
|
548
816
|
var MutationContext = createContext({
|
|
549
817
|
isPending: false,
|
|
@@ -623,8 +891,8 @@ function Form(props) {
|
|
|
623
891
|
if (onSubmitStart?.(formData, formRef.current) === false) return;
|
|
624
892
|
trigger(formData);
|
|
625
893
|
};
|
|
626
|
-
const validationErrors = error
|
|
627
|
-
const formError = error
|
|
894
|
+
const validationErrors = isValidationError(error) ? error.messages : {};
|
|
895
|
+
const formError = isFormError(error) ? error.message : null;
|
|
628
896
|
return /* @__PURE__ */ jsx(MutationContext.Provider, {
|
|
629
897
|
value: {
|
|
630
898
|
isPending: loading,
|
|
@@ -2058,6 +2326,6 @@ function useAppIdMissmatch() {
|
|
|
2058
2326
|
return current !== next;
|
|
2059
2327
|
}
|
|
2060
2328
|
//#endregion
|
|
2061
|
-
export { Form, FormError, FormFieldContainer, Head, Image, Link, OpenGraphImage, QueryError, QueryManagerProvider, Redirect, ValidationErrors, create, createRoot, defineDictionary, init, useAppIdMissmatch, useBreadcrumbs, useBroadcast, useDelete, useDictionary, useDomain, useFeature, useFeatures, useForgotPassword, useFormData, useFormStatus, useIntendedUrl, useIsNavigationPending, useLocale, useLocation, useMutate, useMutation, useMutationStatus, useNavigate, useNavigationProgress, useParams, usePatch, usePost, usePrefetch, usePut, useQuery, useResetPassword, useRoute, useRouteTransition, useSearchParams, useSignIn, useSignOut, useSignUp, useSubscription, useTheme, useTranslator, useUpload, useUser };
|
|
2329
|
+
export { Form, FormError, FormFieldContainer, Head, Image, Link, OpenGraphImage, QueryError, QueryManagerProvider, Redirect, ValidationErrors, create, createRoot, defineDictionary, init, isAuthenticationError, isCsrfError, isFormError, isNetworkError, isNotFoundError, isPermissionError, isRateLimitError, isServerError, isValidationError, mutationErrorKind, useAppIdMissmatch, useBreadcrumbs, useBroadcast, useDelete, useDictionary, useDomain, useFeature, useFeatures, useForgotPassword, useFormData, useFormStatus, useInfiniteQuery, useIntendedUrl, useIsNavigationPending, useLocale, useLocation, useMutate, useMutation, useMutationStatus, useNavigate, useNavigationProgress, useParams, usePatch, usePost, usePrefetch, usePut, useQuery, useResetPassword, useRoute, useRouteTransition, useSearchParams, useSignIn, useSignOut, useSignUp, useSubscription, useTheme, useTranslator, useUpload, useUser };
|
|
2062
2330
|
|
|
2063
2331
|
//# sourceMappingURL=index.js.map
|