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
Zach Daniel
9882037780
fix: set default argument values on generic actions
...
fixes #1220
2024-06-13 10:25:25 -04:00
Jechol Lee
c5d96e1a0a
chore: Fix warning: using map.field notation ( #1238 )
2024-06-13 08:02:35 -04:00
Davide Briani
cd06f919c0
fix: load relationships on bulk operations ( #1234 )
...
This change validates that the `load` statement of bulk operations is
respected when specified, and correctly loads relationships.
Loading relationships with pagination on results for bulk destroys is
still not supported. Indeed, relationships are currently queried using a
lateral join but after the resource deletion has happened, so it looks
like nothing is related.
Signed-off-by: Davide Briani <davide@briani.dev>
2024-06-10 20:14:37 -04:00
Zach Daniel
d5d0b04bb6
improvement: validate require_attributes
and allow_nil_input
at compile time
2024-06-10 17:43:15 -04:00
Davide Briani
ae9671158f
fix: correctly load paginated relationships after create, update, delete ( #1229 )
...
Ensure that relationships can be correctly loaded, even with pagination,
on the resources resulting from create, update and delete actions.
Signed-off-by: Davide Briani <davide.briani@secomind.com>
2024-06-10 10:46:49 -04:00
Zach Daniel
e4980d55ba
fix: don't update tenant on update, instead enforce it
...
the attribute strategy allowed for overwriting the multitenant attribute
on update. In practice, this can't really happen using any standard pattern
because any record to be updated is read with the tenant context, but it still
represents a small risk (and `schema` based multitenancy would enforce it in this
way anyway, so this is more consistent).
2024-06-05 10:43:38 -04:00
Zach Daniel
fbcafa1bfa
fix: when hydrating nested aggregates, use correct related resource/path pair
...
closes #1213
2024-05-30 00:12:12 -05:00
Zach Daniel
1c21e390be
fix: retain ref_path
when authorizing aggregates
2024-05-29 14:03:33 -04:00
Zach Daniel
e9897eb50f
fix: ensure that belongs_to relationships are properly not reloaded with lazy?: true
...
closes #1208
2024-05-29 12:59:10 -04:00
Zach Daniel
bfdb8f9bab
chore: format
2024-05-28 14:32:30 -04:00
Alan Heywood
2ee311b061
test: demonstrate error with bulk update on manual action ( #1204 )
...
The following error is produced
1) test manual updates are supported (Ash.Test.Actions.BulkUpdateTest)
test/actions/bulk/bulk_update_test.exs:358
** (CaseClauseError) no case clause matching: nil
code: |> Ash.bulk_update!(:update_manual, %{},
stacktrace:
(ash 3.0.7) lib/ash/actions/update/bulk.ex:2076: anonymous fn/11 in Ash.Actions.Update.Bulk.run_batch/10
(elixir 1.16.2) lib/enum.ex:1264: anonymous fn/3 in Enum.flat_map/2
(stdlib 5.0.2) maps.erl:416: :maps.fold_1/4
(elixir 1.16.2) lib/enum.ex:2540: Enum.flat_map/2
(ash 3.0.7) lib/ash/actions/update/bulk.ex:1966: Ash.Actions.Update.Bulk.run_batch/10
(ash 3.0.7) lib/ash/actions/update/bulk.ex:1505: Ash.Actions.Update.Bulk.do_handle_batch/13
(ash 3.0.7) lib/ash/actions/update/bulk.ex:1042: anonymous fn/12 in Ash.Actions.Update.Bulk.do_stream_batches/7
(elixir 1.16.2) lib/stream.ex:613: anonymous fn/4 in Stream.map/2
(elixir 1.16.2) lib/stream.ex:1816: anonymous fn/3 in Enumerable.Stream.reduce/3
(elixir 1.16.2) lib/stream.ex:273: anonymous fn/4 in Stream.chunk_while_fun/2
(elixir 1.16.2) lib/stream.ex:1159: anonymous fn/3 in Stream.with_index/2
(elixir 1.16.2) lib/stream.ex:1079: Stream.do_transform_each/3
(elixir 1.16.2) lib/stream.ex:1816: anonymous fn/3 in Enumerable.Stream.reduce/3
(elixir 1.16.2) lib/enum.ex:4839: Enumerable.List.reduce/3
(elixir 1.16.2) lib/stream.ex:1027: Stream.do_transform_inner_list/7
(elixir 1.16.2) lib/stream.ex:1828: Enumerable.Stream.do_each/4
(elixir 1.16.2) lib/stream.ex:1052: Stream.do_transform_inner_enum/7
(elixir 1.16.2) lib/stream.ex:1828: Enumerable.Stream.do_each/4
(elixir 1.16.2) lib/stream.ex:943: Stream.do_transform/5
(elixir 1.16.2) lib/enum.ex:4396: Enum.reverse/1
(elixir 1.16.2) lib/enum.ex:3728: Enum.to_list/1
(ash 3.0.7) lib/ash/actions/update/bulk.ex:1070: Ash.Actions.Update.Bulk.run_batches/3
(ash 3.0.7) lib/ash/actions/update/bulk.ex:386: Ash.Actions.Update.Bulk.run/6
(ash 3.0.7) lib/ash.ex:2209: Ash.bulk_update!/4
test/actions/bulk/bulk_update_test.exs:373: (test)
2024-05-27 10:32:39 -04:00
Zach Daniel
3510cd48f4
chore: clean up changelog and format
2024-05-24 00:35:13 -04:00
Zach Daniel
dc94f3a743
improvement: support nils_distinct?
on identities
...
improvement: support `where` option on `identities`
improvement: allow calculations in identity keys
closes #1001
closes #1182
2024-05-24 00:24:42 -04:00
Zach Daniel
67c6e5e22a
fix: ensure that all notifications are sent for bulk destroy/update
...
closes #1186
2024-05-22 18:42:19 -04:00
Riccardo Binetti
86676cd0fc
feat: allow retrieving the count of paginated relationships ( #1183 )
2024-05-21 08:48:11 -04:00
Riccardo Binetti
16b7ea7693
fix: check the where condition before checking validation atomicity ( #1177 )
...
:not_atomic was returned for a non-atomic validation even if the where condition
evaluated to false
2024-05-16 15:49:08 -05:00
Riccardo Binetti
65e9f51907
fix: don't require domain for empty stream bulk update and destroy ( #1175 )
...
It can't be extracted from an empty list, but it's not actually needed
2024-05-16 09:57:10 -05:00
Rebecca Le
619a0d61ad
bug: Add more failing tests around cascade_destroy functionality ( #1173 )
...
Issues occur when there is no data to cascade destroy, or notifications are requested but none are returned
2024-05-16 09:54:22 -05:00
Zach Daniel
7f7c1377cf
fix: properly validate input action on bulk destroy
...
fix: allow setting `authorize?: false`
2024-05-16 00:02:18 -05:00
Rebecca Le
48b458c4fd
bug: Add failing test for verifying bulk destroy actions ( #1172 )
...
* bug: Add failing test for verifying bulk destroy actions
* bug: Add failing test for skipping authorization checks on a bulk destroy
2024-05-15 23:24:44 -05:00
Zach Daniel
ad0274b0a3
improvement: add pattern matching for clarity on ref/1
and ref/2
...
chore: remove debug logger configuration from test
2024-05-15 11:25:54 -04:00
Zach Daniel
2681684922
improvement: add can_return_nil?/1
callback to Ash expressions
2024-05-14 17:58:13 -04:00
Davide Briani
449da541e2
Fix: keep data's metadata in atomic update ( #1165 )
2024-05-14 13:17:51 -04:00
Zach Daniel
11f0f9aa03
fix: ensure that changeset filters are honored in ETS destroy/update_query
...
fix: in simulated bulk actions, a stale record should be ignored
fix: don't rollback transactions on stale records
2024-05-12 16:16:39 -04:00
Riccardo Binetti
1f8c27225f
chore: add failing tests for filter on stream bulk update/destroy ( #1151 )
2024-05-12 15:32:13 -04:00
Riccardo Binetti
d5ae3f37b6
fix: ignore required pagination for relationships ( #1147 )
...
Maintain backwards compatibility
2024-05-10 11:48:10 -04:00
Riccardo Binetti
0e899dbbb3
improvement: add tenant to data earlier in read ( #1137 )
2024-05-08 09:21:01 -04:00
Riccardo Binetti
5dfea1df9b
feat: add relationship pagination ( #1050 )
2024-05-04 05:56:46 -04:00
Riccardo Binetti
7507cdd731
fix: make lateral join filtering in ETS data layer work ( #1111 )
...
One of the two branches was using the non-bang version of a function, which
returned `{:ok, filter}`. That value was then directly put in the Query struct,
resulting in an invalid filter that was never applied.
2024-05-03 16:56:18 -04:00
Zach Daniel
a26efe03e1
test: add test for requiring actor in atomic changes
2024-05-03 12:36:20 -04:00
Zach Daniel
6a1359c3d8
fix: various fixes around bulk actions, types, error handling
2024-05-02 23:48:10 -04:00
Zach Daniel
1bdc095b04
fix: fix match validation when performed atomically
2024-05-02 20:30:37 -04:00
Riccardo Binetti
a3418e32ef
fix: ensure only the intended failing test fails ( #1105 )
...
It was making also other tests fail
2024-05-02 19:15:26 -04:00
Riccardo Binetti
5ce12e35f8
chore: failing test for bulk update with global validations ( #1104 )
2024-05-02 17:18:08 -04:00
Zach Daniel
7fd063239f
fix: set notify?: true
when return_notifications?: true
is set
...
closes #1100
2024-05-02 14:51:35 -04:00