Zach Daniel
d6a973cef0
improvement: better error messages on incorrect action types
2024-09-04 20:41:56 -04:00
Zach Daniel
d144be692e
fix: properly await tasks from lazy loading multiple relationships
2024-09-04 10:32:34 -04:00
Andreas Donig
de0f72b475
Fix: honor bulk upsert condition ( #1432 )
...
* Require Ash.Expr to make sure upsert_conflict/1 is available
* Make sure it correctly tests opts[:upsert_condition] for nilness
* Make sure the base changeset also adheres to the upsert condition
* Revert the changes so we can show the problem with a test case
* Add a test case that shows what the problem is
* Add the upsert_condition filter to the base changeset again
* Change the way the test checks because bulk_create/4 does not return unchanged records
2024-09-03 16:23:12 -04:00
Zach Daniel
6f2a14715d
improvement: show an explanation when no policies apply
2024-09-02 12:48:36 -04:00
Zach Daniel
c7eaabdb2e
fix: correctly handle return values of batch callbacks ( #1424 )
...
* improvement: factor out static branches at compile time
---------
Co-authored-by: Hannes Wüthrich <hannes.wuethrich@zebbra.ch>
2024-08-31 15:53:14 -04:00
Zach Daniel
4adddcdd69
Revert "improvement: make authorization failures behave consistently across reads"
...
This reverts commit ffa37d0c95
.
2024-08-30 19:51:46 -04:00
Zach Daniel
ffa37d0c95
improvement: make authorization failures behave consistently across reads
2024-08-30 19:45:28 -04:00
Rebecca Le
cc55670c7f
bug: Add failing test for lazy-reloaded calculations that aren't loading their dependencies ( #1420 )
2024-08-30 18:29:38 -04:00
Zach Daniel
cb80df9ed8
test: test new default keyset pagination
2024-08-30 17:36:10 -04:00
Zach Daniel
0007d0e60a
fix: return proper data shape when doing a read in a transaction
...
closes #1410
2024-08-30 15:19:38 -04:00
Jinkyou Son
e2731ecd2d
Replace PaginationNotSupported exception with ActionRequiresPagination exception ( #1411 )
2024-08-30 13:11:46 -04:00
Hannes Wüthrich
4a75743812
Fix generated change/3
function when only implementing batch_change/3
( #1415 )
2024-08-28 08:04:52 -04:00
Zach Daniel
7cf38273fa
improvement: prevent unnecessary calls to Ash.load
2024-08-20 11:55:46 -04:00
Zach Daniel
48507eac13
chore: run proper callback and test that we call the loading callback
2024-08-20 10:25:50 -04:00
Zach Daniel
51f57b6390
chore: pass context to load relationships
2024-08-20 10:18:01 -04:00
Jonatan Männchen
e200b5b9d1
chore: Implement upsert_condition for bulk create ( #1389 )
2024-08-14 20:26:03 -04:00
Zach Daniel
ba30ec880e
chore: clean up tests
2024-08-14 11:46:18 -04:00
Zach Daniel
7cb3e04b2a
fix: fix ets lateral join source field usage
...
fix: properly apply distinct in ets
2024-08-14 11:11:03 -04:00
Jonatan Männchen
93775109c7
improvement: Implement condition for upsert ( #1386 )
...
Resolves #1385
2024-08-13 19:19:13 -04:00
Zach Daniel
1654ccdead
fix: properly pass actor, action, tenant etc. to lazy loaded relationships
2024-08-13 11:16:00 -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
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
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
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
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
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
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
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
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
e1dffc0c0c
fix: properly enforce tenancy on all mutative actions
2024-07-06 13:41:58 -04:00
Hannes Wüthrich
0e5587552c
fix: invert logic for lazy-loading calculations/aggregates ( #1275 )
2024-07-03 07:06:11 -04:00
Zach Daniel
d997902a6c
chore: raise explicit error on missing last_relationship/2
2024-07-02 15:19:33 -04:00
Zach Daniel
a3b026404e
test: add passing test for bulk update code interface policies
...
fix: properly match on async task exceptions
2024-07-02 14:33:13 -04:00
Zach Daniel
f13895b0f2
fix: override authorize?: nil
context
...
fix: ensure forbidden errors behave the same on `id` provided to code interfaces
2024-07-02 11:05:13 -04:00
Zach Daniel
b1d9c81725
chore: more list.wrapping of notifications
2024-07-02 10:41:15 -04:00
Zach Daniel
d53ad508cd
test: update non-simple-equality manual relationship tests
2024-07-01 17:32:32 -04:00
kernel-io
3265b36589
fix: compare keys in manual relationships when using 'complex' types ( #1270 )
...
Signed-off-by: kernel-io <kernel-io@users.noreply.github.com>
2024-07-01 17:21:01 -04:00
Zach Daniel
66ebb1422e
tests: more notification transaction tests
2024-06-28 13:59:03 -04:00
Zach Daniel
2d29dab90b
fix: set tenant context when calling data layers
...
fix: set `from_many?` if a `has_one` has a `sort` applied
(because there is no other reason to apply a `sort`)
2024-06-28 11:13:34 -04:00
Zach Daniel
6898bde0a4
fix: proper return value from synthesized joins
...
fix: properly support multitenancy in joins in ets
2024-06-27 20:53:35 -04:00
Ryan
a117327c0c
test: assert that notifications are sent for bulk updates and destroys using the :stream strategy ( #1266 )
2024-06-25 12:39:18 -04:00
Davide Briani
b256e1d8a3
test: Test loading paginated relationship when tenant is in primary key ( #1252 )
...
* Chore: test loading paginated relationship when tenant is in primary key
Ash is already able to load paginated relationships on multitenant
resources after a create or update action.
However this change specifically test the case of a many to many
relationship where the tenant is included in the primary key of the
joined resources.
Signed-off-by: Davide Briani <davide@briani.dev>
* fix: apply pagination at runtime for non lateral join queries
fix: consider multitenancy when checking if through-join is unique
---------
Signed-off-by: Davide Briani <davide@briani.dev>
Co-authored-by: Zach Daniel <zach@zachdaniel.dev>
2024-06-21 15:00:50 -04:00
Davide Briani
71d871b54a
Test loading relationships on multitenant resources after create or update ( #1249 )
...
* Chore: add tests on loading relationship on multitenant resource
Add tests to verify that relationships can be loaded on multitenant
resources after a create or update action.
Signed-off-by: Davide Briani <davide@briani.dev>
* fix: set tenant in ets data layer when generating aggregates
---------
Signed-off-by: Davide Briani <davide@briani.dev>
Co-authored-by: Zach Daniel <zach@zachdaniel.dev>
2024-06-20 16:46:29 -04:00