ActionContext
ActionContext<
TUser,TServices> =object
Defined in: packages/actions/src/types.ts:62
Context provided to every action’s OperationsFn.
Created by the getContext callback in ActionsConfig and passed
alongside the database instance and parsed input to each action. When
services are registered with createActions, they appear on
ctx.services so handlers can access them without importing module-
level singletons.
Example
Section titled “Example”const ctx: ActionContext<{ id: string; role: string }, { nutritionApi: NutritionApi }> = { db, user: { id: "u_1", role: "author" }, grants: [{ action: "manage", subject: "all" }], services: { nutritionApi },};Type Parameters
Section titled “Type Parameters”TUser
The shape of the authenticated user object.
TServices
Section titled “TServices”TServices extends ActionServices = ActionServices
The shape of the registered services map. Defaults to an empty record when no services are registered.
Properties
Section titled “Properties”db:
Db
Defined in: packages/actions/src/types.ts:64
The Drizzle database instance from @cfast/db.
grants
Section titled “grants”grants:
Grant[]
Defined in: packages/actions/src/types.ts:68
The user’s permission grants, used for permission checking.
services
Section titled “services”services:
TServices
Defined in: packages/actions/src/types.ts:74
External services registered with createActions. Defaults to
an empty object {} when no services are provided at factory time,
so handlers can always safely destructure ctx.services.
user:
TUser
Defined in: packages/actions/src/types.ts:66
The authenticated user for the current request.