Skip to main content
Version: Next

Interface: Query

A server-side read-only operation, callable from the client and the server.

Create one with the query constructor.

See Queries.

Extends

  • BasePart<"query">

Properties

auth?

optional auth?: boolean

If true, the query receives context.user. Defaults to true when the app has auth enabled, and false otherwise.

You can only set this field when app-level auth is enabled.


entities?

optional entities?: string[]

Entities the query reads from. Wasp injects a Prisma delegate for each one into the query's context.entities, and uses the list to invalidate the client-side cache when related actions run.


fn

fn: Reference<AnyFunction>

Reference to the Query's NodeJS implementation. The implementation can be async and receives two positional arguments: the caller-provided args payload and a Wasp-provided context containing declared entities and, when auth is enabled for the Query, the current user.


kind

kind: "query"

The internal Wasp type of this part. Used by the compiler. You should not set this field directly, instead use the dedicated constructors for each part type.

Inherited from

BasePart.kind