Skip to content

GenericQueryClientParams

Defined in: packages/core/src/api/types.ts:161

Base shape for client-side args of a vex.* query function.

Carries the ctx?: never discriminator (forbids passing a Convex query context) and the populate field, since every query function that returns documents supports relationship population (the only outlier is count, which returns a number and overrides populate?: never).

Function-specific args interfaces extend this and add their own per-function fields. limit stays per-function because it doesn’t apply to single-doc queries (get) or scalar queries (count).

Inheritance pattern

// find — adds slug + limit; populate inherited
interface FindClientArgs<TCollectionSlug, TPopulate>
extends GenericQueryClientParams<TCollectionSlug, TPopulate> {
slug: TCollectionSlug;
limit?: number;
}
// get — adds id; populate inherited; no limit (single-doc)
interface GetClientArgs<TCollectionSlug, TPopulate>
extends GenericQueryClientParams<TCollectionSlug, TPopulate> {
id: GenericId<TCollectionSlug>;
}
// search — adds slug + query + index fields + limit; populate inherited
interface SearchClientArgs<TCollectionSlug, TPopulate>
extends GenericQueryClientParams<TCollectionSlug, TPopulate> {
slug: TCollectionSlug;
query: string;
searchIndexName: string;
searchField: string;
limit?: number;
}
// count — returns a number, has no docs to populate; overrides populate
interface CountClientArgs<TCollectionSlug>
extends GenericQueryClientParams<TCollectionSlug> {
slug: TCollectionSlug;
populate?: never;
}

TCollectionSlug extends CollectionSlug = CollectionSlug

The collection slug; used to narrow populate keys via RelationshipKeysOf<TCollectionSlug>. Defaults to the full CollectionSlug union.

TPopulate extends PopulateShape<TCollectionSlug> = Record<string, never>

The populate object. Defaults to Record<string, never> (no relationships populated).

D extends number = number

optional auth?: undefined

Defined in: packages/core/src/api/types.ts:167

Discriminator: client args MUST NOT supply auth.


optional ctx?: undefined

Defined in: packages/core/src/api/types.ts:169

Discriminator: client args MUST NOT supply ctx.


optional depth?: D

Defined in: packages/core/src/api/types.ts:183

Auto-populate all relationship fields to this many levels.

Inferred as the literal D so a wrapper that threads D through to its return type narrows accordingly (depth: 2 → depth-populated doc). A non-literal number degrades to VexDocument via DepthPopulated’s guard. D defaults to number, so wrappers that do not thread it keep the plain passthrough they had before.

Use populate for documented consumer code; depth is internal.


optional populate?: TPopulate

Defined in: packages/core/src/api/types.ts:171

Recursive populate object, type-narrowed against RelationshipKeysOf<TCollectionSlug>.


optional skip?: boolean

Defined in: packages/core/src/api/types.ts:189

When true, the wrapper passes convexQuery’s "skip" sentinel instead of args, so the query is not issued. Use for conditional queries (e.g. an id that is not known yet) without violating the Rules of Hooks.