diff --git a/packages/better-auth/src/api/routes/session.ts b/packages/better-auth/src/api/routes/session.ts index 294fd3ee76..3b2b5e26f6 100644 --- a/packages/better-auth/src/api/routes/session.ts +++ b/packages/better-auth/src/api/routes/session.ts @@ -14,37 +14,17 @@ import { APIError } from "better-call"; import * as z from "zod"; import { deleteSessionCookie, + getChunkedCookie, setCookieCache, setSessionCookie, } from "../../cookies"; -import { symmetricDecodeJWT } from "../../crypto/jwt"; +import { getSessionQuerySchema } from "../../cookies/session-store"; +import { symmetricDecodeJWT } from "../../crypto"; import type { InferSession, InferUser, Session, User } from "../../types"; import type { Prettify } from "../../types/helper"; import { getDate } from "../../utils/date"; import { safeJSONParse } from "../../utils/json"; -export const getSessionQuerySchema = z.optional( - z.object({ - /** - * If cookie cache is enabled, it will disable the cache - * and fetch the session from the database - */ - disableCookieCache: z.coerce - .boolean() - .meta({ - description: "Disable cookie cache and fetch session from database", - }) - .optional(), - disableRefresh: z.coerce - .boolean() - .meta({ - description: - "Disable session refresh. Useful for checking session status, without updating the session", - }) - .optional(), - }), -); - export const getSession =