Ash Weekly: Issue #23
Aggregates get a new superpower, A VSCode extension, new OpenCollective, generic action improvements, AshCircuitBreaker released, and a GUI resource generator!
Ash Weekly!
Welcome to Ash Weekly — your quick, informal digest of what’s new and notable in the world of Ash Framework. Got something cool? Drop it in the #showcase channel on Discord!
Shameless Plugs
Support Ash via our Open Collective
Check out Ash Premium Support from Alembic
OpenCollective
We now have an Open Collective instead of my personal Github Sponsors account. This money will be transparently spent to advance both the Ash and Elixir ecosystem 😎. We’ll use it to support discord, host the website, and before long we’ll begin sponsoring work ⭐
Unrelated Aggregates
Something we’ve had for a very long time was the ability to use aggregates over related data. For example:
But this only worked in cases that you could write relationships from one resource to another. This was easy to workaround by writing a relationship with `no_attributes? true`, but would clutter up your resources and was not an intuitive solution.
Now, in addition to relationship paths, you can use resources in aggregates, enabling all kinds of useful calculations and aggregates.
Generic & Read Action Improvements
Generic actions now have a full action lifecycle like any other action type. They support things like preparations, validations and before/after action hooks! This reduces a lot of the mental overhead of using generic actions and allows for entirely new methods of building composable and reusable logic 😎.
It also reduced a whole bunch of conditionals/branching in our action lifecycle chart.
In addition to this, read actions now support all of the relevant transaction hooks.
From the community
Matt Savoia wrote a great piece on adding full text search to Ash resources, definitely worth a read!
There is now a VSCode extension that adds all kinds of goodies for Ash users 😎 Make sure to star the repo and tell Kevin just how cool this really is once you try it out!
Christian Alexander created a new package called AshCircuitBreaker which adds the ability to wrap actions in circuit breakers to allow for graceful handling of and recovery from failures.
Albin Kocheril Chacko created a website you can use to interactively work with the resource generators. Pretty slick!
I wrote a blog post about Elixir Misconceptions, more to come soon there 😁
Releases
Ash: 3.5.28-3.5.36
added an introspection module for typed structs (@matt-beanland)
better errors around invalid returns for validate and change callbacks
Support unrelated aggregates and exists expressions
add `scope` option to `Ash.Generator.changeset_generator` (Joseph Lozano)
Support many to many relationships in `ash.gen.reosurce` (Kenneth Kostrešević)
Include polymorphic relationships in usage rules (Gonzalo Muñoz)
Verify filter expressions reference real args when used in actions (Kenneth Kostrešević)
Fix typo in usage rules on `get_by_id` (albinkc)
Add array modifier to `ash.gen.resource` (Kenneth Kostrešević)
Add `prepend?` opt to hooks and Ash.Subject transaction hooks (@chazwatkins)
Create `Ash.Subject` to provide a uniform interface when dealing with something that might be a changeset, query, or action input (@chazwatkins)
Add a `log?` option to `can` functions, allowing much easier authorization logic debugging
Add transaction hooks for read actions (ChristianAlexander)
Add before/after/around transaction hooks to generic actions (ChristianAlexander)
Support global validations being applied to read actions
Ash AI: 0.2.9-0.2.11
move permission check of tools to after they are filtered by other simpler criteria (@jgwmaxwell)
Add a default adapter for ChatGoogleAI (@mylanconnolly)
Properly annotate fields as required
Handle number constraints in generated schema
Add `on_tool_start` and `on_tool_end` callbacks (@bradleygolden)
ReactorReq: 0.1.5
Support `argument` option and pass extra arguments to `guard`
Igniter: 0.6.21-0.6.28
Don’t run `git init` if already in a git repo (Erik André Jakobsen)
Fix heisenbug that was brought about from enumerating the rewrite struct (which should have been fine?)
Add a nicer error on `:oof` response from `yes?`
AshGraphql: 1.8.1-1.8.3
Add support for `relay_id_translation` on GraphQL subscriptions (Mike Wilson)
AshJsonApi: 1.4.38-1.4.42
allow providing descriptions for routes (@marinakr)
support disambiguating embedded resource input type names
Don’t make `data` required unnecessarily
Support `conn` option in test request functions, for setting headers or customizing the conn in other ways
Use `default_fields` as the fields example in docs
Use more idiomatic error messages on pre-request schema check validation failures
handle infinitely nested embeds via $refs
AshAuthentication: 4.9.8-4.9.9
Add a nicer compile time error message on mismatching magic link action type
Better error message on invalid magic link tokens
AshAuthenticationPhoenix: 2.10.4-2.10.5
Debug form errors in templates
Add daisyUI overrides module (pikdum)
AshPostgres: 2.6.12-2.6.16
Support unrelated aggregates
Do not create snapshots for resources that have no attributes (horberlan)
AshSqlite: 0.2.12
Make rollback more reliable by using `--to` instead of `-n`
AshAdmin: 0.13.13-0.13.17
Make the actor/authorizing buttons far clearer using words instead of svgs (Andy LeClair)
AshOban: 0.4.11
Support passing action_arguments to `AshOban.schedule/3` (Infinitis)
AshPhoenix: 2.3.12-2.3.14
Remove unwanted sections from Phoenix’s default AGENTS.md when installing ash_phoenix (Rodolfo Torres)
Add option to determine resource plural name in routes for `ash_phoenix.gen.html` (Kenneth Kostrešević)
Wonderful!
Excellent!