CreateVexRevalidateRouteProps
Defined in: packages/next/src/cache/createVexRevalidateRoute.ts:23
Props for createVexRevalidateRoute.
Properties
Section titled “Properties”config
Section titled “config”config:
VexConfig
Defined in: packages/next/src/cache/createVexRevalidateRoute.ts:28
The resolved VexCMS config. Supplies access for the write-permission
check and routes.map for target resolution.
getAuth
Section titled “getAuth”getAuth: () =>
Promise<{organization?:Record<string,unknown>;user:Record<string,unknown> |null; }>
Defined in: packages/next/src/cache/createVexRevalidateRoute.ts:34
Resolves the authenticated user and active organization for the current
request. Wire to () => fetchAuthQuery(api.auth.api.getUserOrg, {}) — the
same call the admin panel route already makes.
Returns
Section titled “Returns”Promise<{ organization?: Record<string, unknown>; user: Record<string, unknown> | null; }>
getToken
Section titled “getToken”getToken: () =>
Promise<string|null|undefined>
Defined in: packages/next/src/cache/createVexRevalidateRoute.ts:43
Reads the caller’s session token for the current request. Wire to the host
app’s getToken export (convexBetterAuthNextJs’s output, re-exported
from e.g. ~/auth/server). A falsy return means “no session”.
Returns
Section titled “Returns”Promise<string | null | undefined>
listCollection?
Section titled “listCollection?”
optionallistCollection?: (collection) =>Promise<Partial<VexDocument>[]>
Defined in: packages/next/src/cache/createVexRevalidateRoute.ts:53
Lists every document in a collection, for the collection-wide purge
({ collection, all: true }). Wire to a read through the app’s own
publishedSlugs-style query — the factory cannot know an app’s generated
Convex api, which is why this is injected like getToken/getAuth.
Omit to leave the collection-wide branch unwired: it then purges nothing
and reports that in errors, rather than silently succeeding.
Parameters
Section titled “Parameters”collection
Section titled “collection”string
Returns
Section titled “Returns”Promise<Partial<VexDocument>[]>