Commit graph

1943 commits

Author SHA1 Message Date
Zach Daniel
36abd313b3 chore: fix credo 2022-10-31 02:28:29 -04:00
Zach Daniel
113d2452d2 improvement: replace templates in change/preparation/validation opts
Previously, only a few specific changes supported using `arg/1` or `context/1`
in their options. Now, those templates can be used in any change options,
built-in or not.
2022-10-31 02:25:01 -04:00
Zach Daniel
e18a8782c7 chore: remove empty file 2022-10-30 22:20:02 -04:00
Zach Daniel
85e121bcd7 chore: update to latest spark 2022-10-30 22:11:56 -04:00
Zach Daniel
151433bca4 chore: update changelog 2022-10-30 21:35:16 -04:00
Zach Daniel
bf2a4a7871 chore: release version v2.4.0 2022-10-30 21:34:44 -04:00
Zach Daniel
d41c510f68 improvement: support anonymous functions for various behaviour based options
These include:

- custom create/read/update/destroy actions
- changes
- preparations
- validations
- calculations
- manual relationships

See the respective DSL guides for more.
2022-10-30 21:31:48 -04:00
Zach Daniel
d1c5c32e3f WIP 2022-10-30 21:00:57 -04:00
Zach Daniel
8cbd766172 feat: support anonymous functions in DSL
improvement: add more ergonomic manual action definitions.

The old method will likely be deprecated some time in the future (there is no rush really, they both work).
2022-10-30 21:00:57 -04:00
Michael St Clair
5626c8be2c
fix: don't add required belongs_to error if changeset is invalid (#437) 2022-10-30 17:40:10 -04:00
Zach Daniel
d70a05c805 fix: don't lazy load when managing relationships
if a relationship was loaded previously we were just using that relationship value.
However, this has a chance to cause incorrect behavior in edge cases. One such
edge case is illustrated here: https://github.com/ash-project/ash/pull/434 We can return to the
more optimized behavior when lazy loading is improved via https://github.com/ash-project/ash/issues/438
2022-10-30 10:36:26 -04:00
oco-adam
2c85e325cd
test: Add test demonstrating minimal example of strange upsert behaviour (#434) 2022-10-29 19:33:19 -04:00
Zach Daniel
1718314f40 chore: update spark 2022-10-28 10:34:43 -05:00
Zach Daniel
e52d7187d8 improvement: more additions to the resource builder, update spark
test: add a test for loading many to many relationships on code interface actions
2022-10-28 10:18:01 -05:00
Zach Daniel
8aab478003 chore: release version v2.3.0 2022-10-27 17:54:27 -05:00
James Harton
2d6762ae61
feat(Ash.PlugHelpers): standardise conn interface for actors/tenants. (#432) 2022-10-27 17:52:42 -05:00
Zach Daniel
3c6758fa59 chore: use the tenant from the existing query when reselecting/loading calcs 2022-10-27 07:57:17 -05:00
Zach Daniel
bdb2265196 improvement: pass tenant to calculation query explicitly 2022-10-27 07:51:16 -05:00
James Harton
4917e283cd
fix(DataLayer): incorrect typespec for run_query/2 callback. (#431) 2022-10-26 14:36:57 -05:00
Zach Daniel
39ea911d33 docs: various guide/documentation updates 2022-10-25 23:17:49 -05:00
Zach Daniel
f89fd53806 fix: in Ash.Seed, don't try to update a non-loaded record 2022-10-25 22:30:00 -05:00
Zach Daniel
6e43784535 docs: update docs, add some context, remove dead link 2022-10-25 09:11:54 -06:00
Zach Daniel
a66a487cf8 chore: add resource builder to hex docs 2022-10-24 12:06:07 -06:00
Zach Daniel
1a1714a37c docs: add resource builder to doc index 2022-10-24 12:05:41 -06:00
Zach Daniel
6b9cff5d43 feat: add Ash.Resource.Builder, the start of DSL builder utilities of rextension writing 2022-10-24 12:04:56 -06:00
Zach Daniel
72171da732 docs: update some descriptions 2022-10-24 08:57:22 -06:00
Zach Daniel
8c0e4de6bd improvement: allow using get_path/2 by name, as well as bracket access
prior to this, you had to say `map[:foo][:bar]`, but now you can also say
`get_path(map, [:foo, :bar])`. This makes certain things much clearer, i.e
`^arg(:foo)[:foo]`, which is problematic, would normally need to be written
as `(^arg(:foo))[:foo]` so that the pin only applied to the `arg/1` call.
This looks much nicer as `get_path(^arg(:foo), [:foo])`.
2022-10-24 07:57:21 -06:00
Josh Price
3d05bfa95e
improvement: SVG, PDF, PNG, Markdown and plain mermaid formats (#428) 2022-10-24 07:55:05 -06:00
Zach Daniel
67814a2160 docs: add more context to manual relationship guide
docs: add a "Defining Idiomatic Actions" guide

chore: fix flaky tests
2022-10-23 23:08:17 -06:00
Zach Daniel
3dd16304f7 improvement: optimize nested exists filter statements
i.e `exists(friends, exists(friends, name == ^name))`
will be automatically translated to `exists(friends.friends, name == ^name)`.
2022-10-23 22:16:50 -06:00
Zach Daniel
5e3b71e79b fix: properly load manual to_one relationships 2022-10-23 22:16:50 -06:00
Zach Daniel
03482cf908 docs: add an initial "Why Ash?" guide 2022-10-23 22:16:50 -06:00
Mykolas Mankevicius
6a9ea80eae
docs: Update get started guide to be more beginner friendly (#429)
Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
2022-10-23 22:07:51 -06:00
Zach Daniel
986e08e0c2 fix: properly compare against decimal values
improvement: support floats & decimals in the `compare` validation
2022-10-21 10:46:46 -04:00
Zach Daniel
7540b31244 chore: release version v2.2.0 2022-10-21 08:31:50 -04:00
Zach Daniel
87877e7f87 improvement: when returning a page, choose keyset if before or after was supplied
This allows for better pagination experiences because you clearly expect
an `Ash.Page.Keyset` if you are using `before/after`
2022-10-21 08:24:51 -04:00
Zach Daniel
d439ac9cbc improvement: add keysets to records if any action supports keysets
feat: add `Ash.Api.Info.depend_on_resources/1` to get the list of resources at compile time

A common desire is to have modules that validate things across Api modules, however `Ash.Api.Info.resources/1`
is not safe to use at compile time. `Ash.Api.Info.depend_on_resources/1` will set up the proper compile
time dependencies, making it safe to use at compile time
2022-10-20 21:57:51 -04:00
Zach Daniel
d1f05b6c42 fix: don't attempt to re-authorize access to already retrieved records in Api.load/2
improvement: show conditions in policy breakdowns
2022-10-20 13:00:23 -04:00
Zach Daniel
8092cd899a docs: remove more experimental warnings 2022-10-20 02:00:56 -04:00
Zach Daniel
d22cf2714b docs: remove experimental warning from manual relationships 2022-10-20 01:59:52 -04:00
Zach Daniel
57466b3498 docs: remove outdated statement about calculations being limited 2022-10-19 22:17:44 -04:00
Zach Daniel
2d7dfc4948 chore: release version v2.1.0 2022-10-19 17:46:19 -04:00
zimt28
9337ed6479
feat: Custom short names for types (#423)
A compile env can be set to allow customizing the available type short names. This supports two things:

1. Adding custom type short names, like `attribute :price, :money` mapping to `MyApp.Type.Money`
2. Overriding the builtin type short names, like `attribute, :price, :string` mapping to a custom string type implementation (there is likely no reason to do this)
2022-10-19 15:24:40 -04:00
Zach Daniel
235e965627 improvement: sort relationship in order of input when managing it
This helps with things like https://github.com/ash-project/ash_phoenix/issues/57
which involve rendering the relationship value after editing it. Retaining
the order allows direct reuse without any gymnastics
2022-10-19 00:39:10 -04:00
Zach Daniel
5a11736931 docs: remove outdated @authorizers reference 2022-10-18 17:43:33 -05:00
Zach Daniel
37074207d8 docs: update actions guide 2022-10-18 17:32:50 -05:00
Zach Daniel
f774e60749 fix: set defaults before running changes 2022-10-18 14:27:35 -05:00
Zach Daniel
4ca69be25e improvement: generate example class/er diagrams 2022-10-18 14:26:42 -05:00
Zach Daniel
4915e5d583 improvement: add now() to expression syntax 2022-10-18 14:19:28 -05:00
zimt28
e4e6be1550
Update README.md (#421) 2022-10-17 16:59:56 -05:00