Ash Framework

AF

Ash Framework

The Elixir backend framework for unparalleled productivity. Declarative tools that let you stop wasting time. Use with Phoenix LiveView or build APIs in minutes for your front-end of choice.

Join

support

showcase

today-i-learned

Ash Authentication TOTP

Just exploring some of the features of Ash as I am considering it for a new service I am implementing. I went through the tutorial of setting up Ash authentication for a Phoenix app which worked just fine. However I was unable to determine how I could extend it to implement 2FA / TOTP using say Nimble TOTP at https://github.com/dashbitco/nimble_totp ...

Using pgsodium with Ash

Wondering if there would be an Ash way to do column encryption with pgsodium? Currently I have just done them directly in the migrations files with execute("SECURITY LABEL FOR pgsodium ON COLUMN table.column IS 'ENCRYPT WITH KEY COLUMN key_id NONCE nonce ASSOCIATED association_id'") for each column I want to get encrypted. Would custom_statements in the Ash resource be the place to do this?...

AshOban trigger `read_metadata` passed to action as argument?

Hello! In the AshOban code, there is this documentation statement: https://github.com/ash-project/ash_oban/blob/main/lib/ash_oban.ex#L129 I can't see where metadata is passed to the update action. I presume it would be somewhere here: https://github.com/ash-project/ash_oban/blob/main/lib/transformers/define_schedulers.ex#L477-L492 What am I missing? Has this part of the feature been missed, or was it never the intention to grab the metadata back out of the Oban job table into Ash land again?...

Is there a good way to version string documents in ash?

I have a table of TODOs, with one column, a :description. A user can modify a TODO's description. I'd like to efficiently store the history of a document, so that the user can look through different past versions of the doc. Is there an easy/built-in way to do this in Ash?

set action argument in form

I have two resources: User and Account I'm creating an AshFrom and use that to create an User. On submit, just before creating the User i need to create an account and pass it as argument to the action used in the for_create of the form. Unfortunately i can't manage to find a way to set the argument in the form before it calls the action...

White labeling the Ash Admin

Hi all! I'm looking at having the Ash Admin as part of the internal product of ours. Some questions: - Is it possible to customize the UI components? - Is it possible to show the admin pages below the tab interface of our website? - Is it possible to have the root layout apply to the Ash Admin pages?...

Migration from MySQL or use thereof?

Hi All, This may be a strange question. I am learning ASH and Phoenix which are excellent....

How to make 'actor' available in nested forms' action

I have Ash.set_actor(current_user) in the mount function of a liveview that contains a nested form. The create/update actions of the main (posts) and sub form (comments), both of which includes change fn changeset, %{actor: actor}, the variable actor passes the proper user map for post , but nil for comment`. Also tried passing actor like below, but it didn't help either. Is there anything else I need to do to make it available in the nested forms' action as well? ``` AshPhoenix.Form.for_update(post, :update, api: MyPosts, actor: socket.assigns.current_user,...

st_distance vs <-> in ash_geo for nearest neighbor search/filter (knn)

I'm just digging into ash_geo and attempting to implement a knn filter, as described here: https://postgis.net/workshops/postgis-intro/knn.html
Unlike a distance search, the “nearest neighbour” search doesn’t include any measurement restricting how far away candidate geometries might be, features of any distance away will be accepted, as long as they are the nearest....

How to sort on a postgres regex?

I'm trying to extract a number from a text field using regex and sort on it. ``` require Ash.Query ...

PGVector

Is it possible to use pgvector extension? https://github.com/pgvector/pgvector-elixir...

GraphQL API fails if custom type is not allowed via a field_policy

I noticed that if I ask my graphQL API to return a field that is forbidden, if the field is built-in, it will just return the field as null, all the other fields normally (assuming they are not forbidden as-well) and an error in the errors list telling that this field is forbidden. But, if I try the same with a custom type, then I just get the full result as null: ```json...

Postgres reference with non-"id" primary keys

Hey, I have these two resources: ```elixir defmodule Moneybadger.Ledger.Expense do use Ash.Resource, data_layer: AshPostgres.DataLayer...

How to use fragments and not built-in predicates in Ash.Filter keyword list syntax?

The documentation only shows how to use the Ash.Filter keyword list syntax with built-in predicates, how can I use it with fragments or non-built-in predicates? For example, this filter: ```elixir...

parse filter with fields from another resource relationship

I'm using Ash.Filter.parse/2 to generate filters using the list syntax, for example: ```elixir Ash.Filter.parse(Template, [ or: [...

Ash.Resource.ManualRead And Filters

Hi, I’m wrapping an external REST API with an Ash resource and therefor use Ash.Resource.ManualRead. Reading the data is not a problem, but as the REST API is way less capable for filtering, I would like to run the returned data through the Ash filters I applied to the query. I mapped the returned data already to the Ash resource and now have an array of these resources. But how can I now apply the filters from the query? That’s what read!() normally would do, but calling that would lead to...

Group by and count query

Hi, Just got to start to say thanks for creating this awesome library. It seems really cool so far 🚀 I was having a bit of trouble with what seems like a simple SQL query with group by. In Ecto I would write the query like this: ```elixir...

Creating an Identity referencing a key within a :map attribute (postgres-stored jsonb)

I have a resource with these attributes: ```elixir attributes do uuid_primary_key :id...

Do I have to manually make a `node` query in Absinthe to honor Global Object Identification?

I am using a SvelteKit library called Houdini to consume a GraphQL endpoint I am creating in Ash. I've intentionally marked my graphql, queries, list with relay?: true per the docs: https://ash-hq.org/docs/dsl/ash-resource#graphql-queries-list-relay-...

Postgrex error when creating record with AshGeo type

I have a resource which contains an attribute defined as: ```elixir attribute :point, AshGeo.Geometry do description "The underlying PostGIS geometry"...