Skip to content

Commit 83b1af5

Browse files
committed
Move final functions and types into $lib/validate and $lib/server/validate
1 parent c865b8b commit 83b1af5

File tree

12 files changed

+18
-15
lines changed

12 files changed

+18
-15
lines changed

Site/src/components/PostReply.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<script lang="ts">
22
import { page } from "$app/state"
33
4-
const {
5-
formData
6-
}: { formData: import("sveltekit-superforms").SuperForm<any> } = $props()
4+
const { formData }: { formData: import("$lib/validate").SuperForm<any> } =
5+
$props()
76
87
const { form, errors, message, constraints, enhance, delayed } = formData
98
</script>

Site/src/components/forms/Codearea.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
help?: string
1414
placeholder?: string
1515
rows?: number
16-
formData: import("sveltekit-superforms").SuperForm<any>
16+
formData: import("$lib/validate").SuperForm<any>
1717
} = $props()
1818
1919
const { form, errors, constraints } = formData

Site/src/components/forms/Form.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
inline?: boolean
1919
nopad?: boolean // Don't pad the icon on the submit button
2020
// method?: HTMLFormAttributes["method"]
21-
formData: import("sveltekit-superforms").SuperForm<any>
21+
formData: import("$lib/validate").SuperForm<any>
2222
children: Snippet
2323
} & HTMLFormAttributes = $props()
2424

Site/src/components/forms/Input.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
inline?: boolean
2626
column?: boolean
2727
disabled?: boolean
28-
formData: import("sveltekit-superforms").SuperForm<any>
28+
formData: import("$lib/validate").SuperForm<any>
2929
} & HTMLInputAttributes = $props()
3030
3131
let { errors } = $derived(formData)

Site/src/components/forms/Select.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
// multiple?: boolean
2525
options: string[]
2626
selected?: string
27-
formData: import("sveltekit-superforms").SuperForm<any>
27+
formData: import("$lib/validate").SuperForm<any>
2828
} = $props()
2929
3030
let { form, errors, constraints } = $derived(formData)

Site/src/components/forms/SubInput.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
name: string
1616
disabled: boolean
1717
type: HTMLInputTypeAttribute
18-
formData: import("sveltekit-superforms").SuperForm<any>
18+
formData: import("$lib/validate").SuperForm<any>
1919
} & HTMLInputAttributes = $props()
2020
2121
let { form, errors, constraints } = $derived(formData)

Site/src/components/forms/Textarea.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
rows?: number
2020
lowpad?: boolean
2121
defaultValue?: string
22-
formData: import("sveltekit-superforms").SuperForm<any>
22+
formData: import("$lib/validate").SuperForm<any>
2323
} & HTMLTextareaAttributes = $props()
2424
2525
let { form, errors, constraints } = $derived(formData)

Site/src/lib/server/formError.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Returns a custom error for a superForm
22

33
import { fail } from "@sveltejs/kit"
4-
import type { SuperValidated } from "sveltekit-superforms"
4+
import type { SuperValidated } from "$lib/server/validate"
55

66
/**
77
* Returns a custom error for a superForm.

Site/src/lib/server/ratelimit.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// TODO: Possibly move this to the database instead of server state
22

33
import { fail } from "@sveltejs/kit"
4-
import type { SuperValidated } from "sveltekit-superforms"
5-
import { message } from "sveltekit-superforms/server"
4+
import type { SuperValidated } from "$lib/server/validate"
5+
import { message } from "$lib/server/validate"
66

77
const ratelimitTimewindow = new Map<string, number>()
88
const ratelimitRequests = new Map<string, number>()

Site/src/lib/server/validate.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
// I know barrel files suck but I'd like to wrap these functions in the near future
22

33
export { arktype } from "sveltekit-superforms/adapters"
4-
export { message, superValidate } from "sveltekit-superforms/server"
4+
export {
5+
message,
6+
type SuperValidated,
7+
superValidate,
8+
} from "sveltekit-superforms/server"

0 commit comments

Comments
 (0)