A resource's rules as JSON-ready data for the client.
Rules are keyed "<type>.<action>", where <type> is the resource's
JSON:API type or, without one, its module's last segment underscored. Each
rule is %{"effects" => [effect]}, effects in order:
%{"set" => %{"attr" => json_logic}, "source" => "derived" | "declared"}%{"push" => %{"event" => "xp_awarded", "payload" => %{"key" => json_logic}}}; the payload also gets"id",{"var": "ctx.push_ids.<event>.<label>"}(seeAshBackendDrivenOptimisticUi.PushId), except in the rule of a create action%{"where" => json_logic, "effects" => [effect]}%{"insert" => %{"at" => "start" | "end" | %{"sorted_by" => "field"}}}: put the record the sets build into the list, at an end or before the first row whosefieldsorts after its own%{"remove" => %{}}: take the record out of the list%{"clear" => %{"from" => path}}: empty the nested lists atpath%{"edit" => %{"from" => path}}: apply the sets to the record's own row in the nested lists atpath
An insert with "into", or a remove with "from", works on a list nested
inside the one record the client holds. The path is a list of steps,
%{"key" => "exercises"} or %{"key" => "exercises", "match" => %{"field" => json_logic}},
the latter keeping only the rows whose field equals the value.
An expression AshBackendDrivenOptimisticUi.Compiler cannot compile raises, so a rule
set is never half-built.
Summary
Functions
Every optimistic of resource, keyed "<type>.<action>".
Every on of resource, keyed by event name.
The JSON:API type of resource, or its module's last segment underscored.
Functions
@spec for_resource(Ash.Resource.t()) :: %{required(String.t()) => map()}
Every optimistic of resource, keyed "<type>.<action>".
@spec reactions_for_resource(Ash.Resource.t()) :: %{required(String.t()) => [map()]}
Every on of resource, keyed by event name.
@spec type(Ash.Resource.t()) :: String.t()
The JSON:API type of resource, or its module's last segment underscored.