Skip to content

Commit

Permalink
fix valibot type error
Browse files Browse the repository at this point in the history
Signed-off-by: Vu Van Dung <[email protected]>
  • Loading branch information
joulev committed Jun 12, 2024
1 parent 0c0a6da commit e879297
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
Binary file modified bun.lockb
Binary file not shown.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,9 @@
"wrangler": "3.60.2",
"ytmusic-api": "5.2.1",
"zod": "3.23.8"
}
},
"trustedDependencies": [
"@biomejs/biome",
"@vercel/speed-insights"
]
}
2 changes: 1 addition & 1 deletion src/app/(public)/apps/irasuto/add/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { photos as photosSchema } from "~/lib/db/schema";
import type { NewIrasutoPhoto } from "~/lib/db/schema";
import { uploadPhotoToR2 } from "~/lib/s3/irasuto";

const schema = v.object({ password: v.literal(env.PASSWORD), url: v.string([v.url()]) });
const schema = v.object({ password: v.literal(env.PASSWORD), url: v.pipe(v.string(), v.url()) });

type FetchedPhoto = Omit<NewIrasutoPhoto, "storageKey"> & { url: string };

Expand Down
4 changes: 2 additions & 2 deletions src/app/(public)/apps/link/schemas.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as v from "valibot";

export const publicCreateSchema = v.object({
slug: v.optional(v.string([v.regex(/[a-zA-Z0-9-_]+/), v.minLength(1), v.maxLength(256)])),
url: v.string([v.url(), v.maxLength(4096)]),
slug: v.optional(v.pipe(v.string(), v.regex(/[a-zA-Z0-9-_]+/), v.minLength(1), v.maxLength(256))),
url: v.pipe(v.string(), v.url(), v.maxLength(4096)),
});
4 changes: 2 additions & 2 deletions src/app/(public)/apps/snippets/create-snippet-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ async function getAvailableSlug() {

export async function createSnippet(formData: FormData) {
const createSnippetSchema = v.object({
code: v.string([v.maxLength(65_536)]),
language: v.string([v.maxLength(16)]),
code: v.pipe(v.string(), v.maxLength(65_536)),
language: v.pipe(v.string(), v.maxLength(16)),
});
const { code, language } = v.parse(createSnippetSchema, {
code: formData.get("code") || "",
Expand Down

0 comments on commit e879297

Please sign in to comment.