Skip to main content
Version: Next

Interface: Action

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

Create one with the action constructor.

See Actions.

Extends

  • BasePart<"action">

Properties

auth?

optional auth?: boolean

If true, the action 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 action operates on. Wasp injects a Prisma delegate for each one into the action's context.entities, and uses the list to invalidate the related query caches on the client.


fn

fn: Reference<AnyFunction>

Reference to the Action'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 Action, the current user.


kind

kind: "action"

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