Zach Daniel
cb80df9ed8
test: test new default keyset pagination
2024-08-30 17:36:10 -04:00
Zach Daniel
9b0fb15ecb
fix: honor the countable
option in pagination
...
the default unfortunately had to be changed to `true`, given that it was being ignored before
chore: clean up error declarations
2024-08-30 15:34:40 -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
b841eaf54c
chore: add tests for accept & some opts improvements
2024-08-21 11:58:11 -04:00
Zach Daniel
d593e3cee9
improvement: error at compile for bypasses that will have no effect
...
chore: remove unused `checks` field from `%Ash.Policy.Authorizer.Policy{}`
2024-08-20 21:30:55 -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
Zach Daniel
a43624c9f3
improvement: add cascade update built in change ( #1398 )
...
---------
Co-authored-by: Alykhan Jetha <aj@marketcircle.com>
2024-08-19 11:34:38 -04:00
Zach Daniel
7071884d05
improvement: optimize field checking for loading fields in query
...
improvement: allow functions in tracers for lazy loading metadata
2024-08-15 21:19:23 -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
dc73c3a3d5
feat: add policy groups
...
Policy groups allow you to group policies by shared conditions.
This can help simplify the mental overhead of large sets of policies.
For example:
```elixir
policies do
policy_group actor_attribute_equals(:role, :owner) do
policy action_type(:read) do
authorize_if expr(owner_id == ^actor(:id))
end
policy action_type([:create, :update, :destroy]) do
forbid_if
authorize_if expr(owner_id == ^actor(:id))
end
end
end
```
2024-08-09 16:48:54 -04:00
Zach Daniel
5a4864650b
improvement: prune calculations made unnecessary by field policies
...
closes #1356
2024-08-09 13:46:02 -04:00
Zach Daniel
2f22905ff3
chore: add better errors to help debug strange path/field errors in sort code
2024-08-08 20:26:53 -04:00
Jinkyou Son
2fc934fb61
fix: Fix error with nil value on structure types ( #1380 )
...
* Fix no cond clause evaluated to a truthy value error
* Fix error with nil value
* Add tests
2024-08-08 20:15:20 -04:00
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