remove typebox, not used

master
Avraham Sakal 3 weeks ago
parent 680d734f85
commit bb4a581154

@ -19,7 +19,6 @@
"@mantine/hooks": "^8.1.1", "@mantine/hooks": "^8.1.1",
"@neondatabase/serverless": "^1.0.1", "@neondatabase/serverless": "^1.0.1",
"@openrouter/ai-sdk-provider": "^1.1.2", "@openrouter/ai-sdk-provider": "^1.1.2",
"@sinclair/typebox": "^0.34.37",
"@tabler/icons-react": "^3.34.1", "@tabler/icons-react": "^3.34.1",
"@tanstack/react-query": "^5.85.3", "@tanstack/react-query": "^5.85.3",
"@trpc/client": "^11.4.4", "@trpc/client": "^11.4.4",

@ -32,9 +32,6 @@ importers:
'@openrouter/ai-sdk-provider': '@openrouter/ai-sdk-provider':
specifier: ^1.1.2 specifier: ^1.1.2
version: 1.1.2(ai@5.0.9(zod@4.0.17))(zod@4.0.17) version: 1.1.2(ai@5.0.9(zod@4.0.17))(zod@4.0.17)
'@sinclair/typebox':
specifier: ^0.34.37
version: 0.34.37
'@tabler/icons-react': '@tabler/icons-react':
specifier: ^3.34.1 specifier: ^3.34.1
version: 3.34.1(react@19.1.0) version: 3.34.1(react@19.1.0)
@ -1155,9 +1152,6 @@ packages:
cpu: [x64] cpu: [x64]
os: [win32] os: [win32]
'@sinclair/typebox@0.34.37':
resolution: {integrity: sha512-2TRuQVgQYfy+EzHRTIvkhv2ADEouJ2xNS/Vq+W5EuuewBdOrvATvljZTxHWZSTYr2sTjTHpGvucaGAt67S2akw==}
'@standard-schema/spec@1.0.0': '@standard-schema/spec@1.0.0':
resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==} resolution: {integrity: sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==}
@ -3936,8 +3930,6 @@ snapshots:
'@rollup/rollup-win32-x64-msvc@4.44.1': '@rollup/rollup-win32-x64-msvc@4.44.1':
optional: true optional: true
'@sinclair/typebox@0.34.37': {}
'@standard-schema/spec@1.0.0': {} '@standard-schema/spec@1.0.0': {}
'@tabler/icons-react@3.34.1(react@19.1.0)': '@tabler/icons-react@3.34.1(react@19.1.0)':

@ -1,5 +1,3 @@
import type { TSchema } from "@sinclair/typebox";
import { TypeCompiler } from "@sinclair/typebox/compiler";
import { initTRPC, TRPCError } from "@trpc/server"; import { initTRPC, TRPCError } from "@trpc/server";
import type { getDbClient } from "../../database/postgres"; import type { getDbClient } from "../../database/postgres";
import type { getOpenrouter } from "@server/provider.js"; import type { getOpenrouter } from "@server/provider.js";
@ -53,22 +51,4 @@ export const authProcedure = publicProcedure.use(
} }
); );
/**
* Generate a TRPC-compatible validator function given a Typebox schema.
* This was copied from [https://github.com/sinclairzx81/typebox/blob/6cfcdc02cc813af2f1be57407c771fc4fadfc34a/example/trpc/readme.md].
* @param schema A Typebox schema
* @returns A TRPC-compatible validator function
*/
export function Validator<T extends TSchema>(schema: T) {
const check = TypeCompiler.Compile(schema);
return (value: unknown) => {
if (check.Check(value)) return value;
const err = check.Errors(value).First();
throw new TRPCError({
message: `${err?.message} for ${err?.path}`,
code: "BAD_REQUEST",
});
};
}
export const createCallerFactory = t.createCallerFactory; export const createCallerFactory = t.createCallerFactory;

Loading…
Cancel
Save