defineActions
function defineActions<A>(definition): ActionsDefinitionResult<A>;Defined in: src/authorization/contract.ts:79
Build a product’s action constants from its lists. The const type
parameter keeps the literal union, so a product can derive its action type
from the list instead of writing it twice.
Throws if mutating or portal names an action that is not in all.
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
A extends string |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
definition |
ActionsDefinition<A> |
Returns
Section titled “Returns”Example
Section titled “Example”import { defineActions } from "@xtandard/kit/authorization";
export const { ALL_ACTIONS, MUTATING_ACTIONS, isMutatingAction } = defineActions({ all: ["endpoint:read", "endpoint:write", "message:read", "message:send"], mutating: ["endpoint:write", "message:send"],});export type WebhooksAction = (typeof ALL_ACTIONS)[number];