@webamoki/web-svelte 0.5.13 → 0.5.14
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/utils/form.d.ts +1 -1
- package/dist/utils/form.js +3 -7
- package/package.json +1 -1
package/dist/utils/form.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export declare function prepareEmptyForm<S extends type.Any<Record<string, unkno
|
|
|
20
20
|
delayed: import("svelte/store").Readable<boolean>;
|
|
21
21
|
errors: import("sveltekit-superforms/client").SuperFormErrors<S["infer"]>;
|
|
22
22
|
};
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function getServerForm<S extends type.Any<Record<string, unknown>>>(request: Request, schema: S): Promise<SuperValidated<S["infer"], any, S["inferIn"]>>;
|
package/dist/utils/form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { toast } from 'svelte-sonner';
|
|
2
2
|
import { dateTransport } from './index.js';
|
|
3
3
|
import { type } from 'arktype';
|
|
4
|
-
import { defaults,
|
|
4
|
+
import { defaults, superForm, superValidate } from 'sveltekit-superforms';
|
|
5
5
|
import { arktype, arktypeClient } from 'sveltekit-superforms/adapters';
|
|
6
6
|
export function prepareForm(validated, schema, options) {
|
|
7
7
|
const form = superForm(validated, {
|
|
@@ -55,10 +55,6 @@ export function prepareEmptyForm(schema, options) {
|
|
|
55
55
|
const errors = form.errors;
|
|
56
56
|
return { form, data: form.form, delayed, errors };
|
|
57
57
|
}
|
|
58
|
-
export async function
|
|
59
|
-
|
|
60
|
-
if (!form.valid) {
|
|
61
|
-
throw fail(400, { form });
|
|
62
|
-
}
|
|
63
|
-
return form;
|
|
58
|
+
export async function getServerForm(request, schema) {
|
|
59
|
+
return await superValidate(request, arktype(schema), { transport: dateTransport });
|
|
64
60
|
}
|