Skip to content

CreateVexRevalidateRouteProps

Defined in: packages/next/src/cache/createVexRevalidateRoute.ts:23

Props for createVexRevalidateRoute.

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: () => 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.

Promise<{ organization?: Record<string, unknown>; user: Record<string, unknown> | null; }>


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”.

Promise<string | null | undefined>


optional listCollection?: (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.

string

Promise<Partial<VexDocument>[]>