@rsc-kit/mcp 0.30.48 → 0.30.49
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/recipes.js +13 -8
- package/dist/recipes.js.map +1 -1
- package/guides/go.md +58 -4
- package/guides/laravel.md +87 -4
- package/guides/public-forms.md +27 -17
- package/package.json +2 -2
package/dist/recipes.js
CHANGED
|
@@ -2913,15 +2913,20 @@ passed. A refusal handle() decides goes under its field:
|
|
|
2913
2913
|
import { fieldErrors } from '@rsc-kit/core/action'
|
|
2914
2914
|
if (await subscribed(email)) fieldErrors({ email: 'Already on the list.' })
|
|
2915
2915
|
|
|
2916
|
-
A BACKEND, WITH NO SCHEMA: defineForm({ name, action:
|
|
2917
|
-
|
|
2918
|
-
|
|
2916
|
+
A BACKEND, WITH NO SCHEMA: defineForm({ name, action: contactSend, theme }),
|
|
2917
|
+
with contactSend imported from the generated server-actions module - the
|
|
2918
|
+
action itself, never its name as a string (a string throws). No form, no
|
|
2919
|
+
handle, no zod. bunx rsc-kit make:form contactSend writes forms/contact.ts.
|
|
2920
|
+
The action is a Laravel class in app/Rsc/Actions (Contact::send is
|
|
2921
|
+
contactSend; a class in app/Rsc is rpc only and has no action) or Go's
|
|
2922
|
+
reg.HandleAction("contactSend", "Contact.send", fn). Fields and browser checks
|
|
2923
|
+
come from what it takes (rsc-host.json): a Laravel FormRequest's rules(), or a
|
|
2919
2924
|
Go struct, whose validate tags are read as hints and never run, so the Go
|
|
2920
|
-
function must still check.
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
handle: (values) =>
|
|
2925
|
+
function must still check. It takes one object; a file needs form and handle.
|
|
2926
|
+
A 422 from Laravel (a FormRequest type-hinted on the method, whose authorize()
|
|
2927
|
+
returns true) or Go (rsckit.InvalidField) lands under the same fields,
|
|
2928
|
+
uncaught. To check in TypeScript first, keep a schema and
|
|
2929
|
+
handle: (values) => contactSend(values).
|
|
2925
2930
|
|
|
2926
2931
|
THE BOT TRAP: every form carries a hidden field named homepage. Filled in, the
|
|
2927
2932
|
submission is answered as a success and dropped - handle() never runs. So a
|