Commit graph

857 commits

Author SHA1 Message Date
Zach Daniel
763b0c59ed chore: update tests to avoid flakiness 2024-08-07 19:44:01 -04:00
Zach Daniel
a719c791ba improvement: add optimized path for casting embeds when they are simple
improvement: add `include_embedded_source_by_default?` config to optimize embeds
improvement: support `:fields` constraint on `:struct` type, enabling persistence
2024-08-07 16:47:01 -04:00
Jonatan Männchen
d1efc3fb6c
fix: after_batch arguments for bulk_create with return_records? disabled (#1371)
Fixes #1369
2024-08-07 16:17:40 -04:00
Jonatan Männchen
4efe51418e
improvement: Warn on bulk action return_stream? without any other return_*? options enabled. (#1370)
Resolves #1368
2024-08-07 14:51:15 -04:00
Minsub Kim
ad1a634fc0
test: use other resource's calculation in expr (#1365) 2024-08-06 08:44:15 -04:00
Zach Daniel
c4a910a5d1 improvement: support authorize_with option on Ash.read 2024-08-05 12:36:19 -04:00
m0rt3nlund
4508b439a5
improvement: Add defaults and typespec to resulting Resource struct (#1364)
* improvement: Add typespec to resource if it doesn't exist

---------

Co-authored-by: morten.lund@maskon.no <morten.lund@maskon.no>
Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
2024-08-05 10:35:17 -04:00
Zach Daniel
54738baad2 fix: prefer source_attribute is required, instead of relationship name
we only do this if the source attribute is accepted by the action

fixes #1362
2024-08-02 09:41:34 -04:00
Zach Daniel
28f73546cc fix: roll back bulk update/destroy on before action error 2024-08-01 12:09:01 -04:00
Zach Daniel
db54a655c8 fix: properly key nested calculations and add additional tests 2024-07-31 13:19:04 -04:00
Zach Daniel
8a368c0fcd fix: fix behavior of synthesized joins across data layers
test: fix our testing set up so its actually testing join synthesizer

closes #1354
2024-07-30 22:11:32 -04:00
Zach Daniel
cb7b712460 improvement: implement change/3 automatically if batch callbacks are defined
fix: properly handle mixed atomic & non-atomic validations/changes
2024-07-29 19:54:12 -04:00
Barnabas Jovanovics
1ce0480a85
test: tests for atomic only validation (#1331) 2024-07-29 15:29:39 -04:00
Zach Daniel
b3ac13e760 chore: release version v3.3.0 2024-07-27 17:05:46 -04:00
Zach Daniel
dc4a63c86c fix: ensure that statuses are set correctly on bulk actions
fix: properly transfer process context(tracers) for bulk actions

closes #1332
2024-07-26 11:38:41 -04:00
Jonatan Männchen
3de985ccc5
feat: Add Ash.Type.File (#1337) 2024-07-26 07:57:23 -04:00
Jonatan Männchen
bda0c0e0da
chore: credo fix (#1347) 2024-07-25 18:08:32 -04:00
Riccardo Binetti
df7adce976
fix: apply constraints to NewType even when casting an array (#1341)
The previous implementation was behaving differently when dealing with single
values and arrays.
Close #1342
2024-07-25 10:17:18 -04:00
Zach Daniel
99966d0e57 fix: fix enum typespec generation for strings/mixed types 2024-07-25 09:30:04 -04:00
Zach Daniel
b46e172627 fix: properly generate types for string & mixed enums 2024-07-25 07:34:53 -04:00
Barnabas Jovanovics
8a1c47c131
test: add test for string enum (#1344) 2024-07-25 07:24:50 -04:00
Riccardo Binetti
d199f701ac
fix: pass reuse_values? true when loading in Ash.Query.apply_to/2 (#1346)
The function is meant to be used to act on data that is in-memory, so it makes
sense to not read data again. Moreover this caused an infinite loop if using
this at the end of a manual read.
Add a regression test for the manual read case.
2024-07-25 07:21:08 -04:00
Jonatan Männchen
8d3b0b7246
improvement: Expose type t() on Ash.Type.Enum implementations (#1338) 2024-07-24 07:06:11 -04:00
Zach Daniel
be542cf880 fix: only call batch_change if it is defined, never change in bulk create 2024-07-22 14:32:27 -04:00
Zach Daniel
bad62c1e8a improvement: add authorize_with fallback option to bulk actions
improvement: store non-expr atomic changes in attributes for simplicity
fix: make `relating_to_actor` built-in-check aware of atomics

closes #1327
2024-07-22 10:03:14 -04:00
Zach Daniel
34d6f229c5 improvement: allow policy conditions to be applied inside their block
```elixir
policy do
  condition [...]
  authorize_if ...
end
```
2024-07-22 07:10:09 -04:00
Zach Daniel
3c2f51224a chore: get build passing 2024-07-19 12:40:09 -04:00
Jinkyou Son
063e654405
fix: cast_input/2 of Ash.Type.NewType returning :ok (#1324) 2024-07-18 23:07:14 -04:00
Zach Daniel
6632f599bc chore: keep only correct changes from earlier reverts 2024-07-17 15:08:19 -04:00
Zach Daniel
05cdaa04c5 Revert "fix: honor atomic validations in destroy actions using filter"
This reverts commit a6a9961c0d.
2024-07-17 15:06:39 -04:00
Zach Daniel
a6a9961c0d fix: honor atomic validations in destroy actions using filter
test: add tests for atomic validations in destroy actions
2024-07-17 14:32:57 -04:00
Hannes Wüthrich
dad0bfd1c4
fix: handle casting nil vectors (#1316) 2024-07-17 09:52:12 -04:00
Tore Pettersen
37755a870b
feat: Allow field policies to hide private fields (#1289)
* Allow field policies to hide private fields

* Create option for how to handle private fields

* Improve docs
2024-07-15 08:16:52 -04:00
Zach Daniel
476dfede63 improvement: add cast_atomic_constraints callback and use it in core typest 2024-07-12 23:12:59 -04:00
Riccardo Binetti
3e39595730
test: add failing test for bulk update with numeric constraints (#1310) 2024-07-12 08:15:25 -04:00
Torkild Gundersen Kjevik
ad6954aca8
improvement: add strict? option to Ash.Query.load (#1302)
---------

Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
2024-07-11 09:34:30 -04:00
Zach Daniel
7cb007d32d test: add tests for integers 2024-07-10 13:13:55 -04:00
Andreas Donig
28c1aa4f30
improvement: don't refer to private attributes when parsing filter inputs that refer to relationships (#1280)
---------

Co-authored-by: Andreas Donig <git@innwiese.de>
2024-07-10 12:14:27 -04:00
Zach Daniel
426ee6671d fix: ensure that manual action configurations are honored for bulk actions 2024-07-10 11:24:48 -04:00
Zach Daniel
e1dffc0c0c fix: properly enforce tenancy on all mutative actions 2024-07-06 13:41:58 -04:00
Zach Daniel
25faa93a83 chore: thread calc & relationship paths through calculation dependency loader 2024-07-04 10:39:22 -04:00
Riccardo Binetti
97cab3d767
chore: failing test for nested calculation loading a relationship (#1283) 2024-07-04 10:10:16 -04:00
Zach Daniel
5a4fdcc362 fix: don't reuse calculations/aggregates if authorize? is true 2024-07-04 09:46:38 -04:00
Zach Daniel
920f52ff27 chore: fix build 2024-07-04 08:55:39 -04:00
Zach Daniel
fa94e76855 Revert "fix: don't reuse requested relationship loads for calculations"
This reverts commit 49da3638f1.
2024-07-04 07:09:56 -04:00
Zach Daniel
49da3638f1 fix: don't reuse requested relationship loads for calculations
this is less efficient, and there are still some cases where
we could combine queries, but we need to first solve the behavioral
issues where relationships loaded for calculations could sometimes be loaded
in an "authorized" state when they should not be. We can improve the
speed/efficiency later, correctness is more important.
2024-07-03 18:32:20 -04:00
pinetops
22ac5bbcc1
test: added test case showing calculations erroneously respect policies (#1278) 2024-07-03 12:43:15 -04:00
Zach Daniel
a06b161591 fix: properly set context on streamed batch changesets 2024-07-03 11:34:05 -04:00
Robert Timis
a06bf364ac
test: replicate forbidden error on update (#1276) 2024-07-03 10:54:12 -04:00
Hannes Wüthrich
0e5587552c
fix: invert logic for lazy-loading calculations/aggregates (#1275) 2024-07-03 07:06:11 -04:00