Zach Daniel
808692bbd7
fix: improve non-atomic-upgrade policy handling
...
fix: ensure we have a primary key for certain kinds of calculations:
2024-05-23 18:34:15 -04:00
Zach Daniel
e63d80e645
fix: handle subquery-requiring calculations in calculate/2
2024-05-23 17:33:29 -04:00
Zach Daniel
feb187bdf6
improvement: add atomic_upgrade?
flag to update/destroy actions
...
improvement: do not do atomic upgrade by default unless `require_atomic?` is `true`
improvement: allow configuring the read action used by atomic upgrades
2024-05-23 11:05:17 -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
danielatdpg
05379e15b2
fix: handle list of atomic conditions ( #1194 ) ( #1195 )
2024-05-22 11:38:15 -04:00
ab3786ebf6
feat(Ash.Reactor): Add bulk_update
step type. ( #1185 )
2024-05-22 15:26:51 +12:00
Riccardo Binetti
86676cd0fc
feat: allow retrieving the count of paginated relationships ( #1183 )
2024-05-21 08:48:11 -04:00
Jinkyou Son
aae679f50e
improvement: Implement show_sensitive?
config ( #1180 )
...
* Refactor with Ash.Helpers.redact/1
* Implement show_sensitive? config
* Use Application.compile_env/3 instead of Application.get_env/3
* Update sensitive-data.md
2024-05-21 08:47:51 -04:00
807ed72e89
chore: run formatter.
2024-05-21 09:17:58 +12:00
1d5d247d7a
feat(Ash.Reactor): Add bulk_create
step type.
2024-05-21 09:14:02 +12:00
Zach Daniel
a162b52b7f
fix: use Ash.Sort.parse_input/3
in Ash.Query.sort_input/2
2024-05-20 09:52:52 -04:00
Riccardo Binetti
9fc5ddfe2b
fix: make Ash.Resource.Validation.Changing work correctly in atomics ( #1178 )
...
- Use the correct option key to select the field
- Fail without hitting the data layer if the attribute is not changing
- Allow checking relationships like the non-atomic counterpart
2024-05-16 18:15:35 -05: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
Zach Daniel
23d7479417
fix: handle nil
notification results better
...
fix: don't emit after batch notifications if `notify?: false`
2024-05-16 11:19:24 -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
7ec98ef8ab
fix: properly persist simple_notifiers
2024-05-15 16:46:16 -04:00
Zach Daniel
5b18e71738
fix: accept ids in code interfaces again
2024-05-15 15:45:58 -04: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
Zach Daniel
3263ec2ee9
fix: don't show a type error on nil
for lists
...
closes #1166
2024-05-14 17:09:34 -04:00
Davide Briani
449da541e2
Fix: keep data's metadata in atomic update ( #1165 )
2024-05-14 13:17:51 -04:00
Zach Daniel
23d78ec43f
improvement: use the source
configuration for attributes in embedded resources
...
closes #1143
2024-05-14 12:32:25 -04:00
12de8d19a5
fix(cascade_destroy): Always return and explicitly dispatch notifications.
...
**note** `notify?` option is now `return_notifications?`.
2024-05-13 09:28:20 +12:00
70c1a688f8
feat: Add cascade_destroy
to builtin changes.
2024-05-13 09:28:20 +12: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
Zach Daniel
b48c989b15
fix: don't check required belongs to fields until after setting them in bulk creation
...
docs: fix doc links for code interface guide
fixes #1154
2024-05-12 14:12:24 -04:00
Zach Daniel
32446b0b2e
chore: fixes around policy exceptions
...
docs: add policy how-to guide
2024-05-10 15:26:23 -04:00
Riccardo Binetti
d5ae3f37b6
fix: ignore required pagination for relationships ( #1147 )
...
Maintain backwards compatibility
2024-05-10 11:48:10 -04:00
Zach Daniel
b6c8b1c2ec
fix: allow calculations to access what would forbidden fields of related items
...
context for this change:
this requires a potentially risky modification to how field policies are
applied for nested queries and embedded types, which is that we now
apply field policies for nested queries in a post-processing pass.
Bugs in this code could lead to forbidden fields being displayed
when they shouldn't be. Luckily we have tests for this kind of thing :)
2024-05-08 16:22:48 -04:00
Riccardo Binetti
0e899dbbb3
improvement: add tenant to data earlier in read ( #1137 )
2024-05-08 09:21:01 -04:00
Zach Daniel
0e004ead7a
fix: support empty lists as bulk arguments to code interface options
...
fixes #1126
2024-05-07 16:46:41 -04:00
Zach Daniel
ce559bc018
fix: temporarily disable field policy deselection optimization
...
also added a test for related field calc dependencies,
commented out until I fix it later
2024-05-07 16:08:56 -04:00
Barnabas Jovanovics
d2bfaff377
test: add test for calc deps that are forbidden ( #1128 )
2024-05-07 15:39:04 -04:00
Zach Daniel
f5ab6a6bd8
fix: ensure that reuse_values?
is honored all the way down the chain
2024-05-07 15:38:03 -04:00
Riccardo Binetti
7f701cfb57
chore: add failing test for calculation reuse across loads ( #1127 )
2024-05-07 12:28:22 -04:00
Zach Daniel
64ecdad657
fix: properly deduplicate calculations
2024-05-06 20:32:41 -04:00
Riccardo Binetti
c3c330224d
chore: add failing test for calculation loaded twice in Ash.load/3 ( #1122 )
2024-05-06 19:25:17 -04:00
Pierre Cavin
3cf9fcd8e5
feat: add new remove_nil_items? array type constraint ( #1116 )
2024-05-05 12:05:04 -04:00
Pierre Cavin
c05544663e
fix: run array type nil check after item constraints ( #1115 )
2024-05-05 11:49:23 -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
Zach Daniel
b8c01596cb
fix: multiple small bugs when loading for calculate
...
closes 1091
2024-05-02 00:29:01 -04:00
Zach Daniel
c1354d503e
fix: run changesets w/ after_transaction
hooks through standard logic
2024-05-02 00:06:31 -04:00
Zach Daniel
8a7a4763fd
chore: update bulk create test
2024-05-01 22:13:24 -04:00
Riccardo Binetti
bb22724ef9
chore: failing tests for after_transaction hooks on bulk failures ( #1090 )
2024-05-01 17:34:49 -04:00
Zach Daniel
65395c37c6
fix: properly execute before_batch callbacks in bulk actions
2024-05-01 08:59:03 -04:00
Zach Daniel
6f0524d67d
fix: missing pattern match on error query in read
...
closes #1084
2024-05-01 08:00:22 -04:00
Riccardo Binetti
b4821f2e13
chore: failing tests for before_transaction hooks in bulk actions ( #1081 )
2024-04-30 20:51:39 -04:00
Riccardo Binetti
c50d047614
fix: streaming with limit/offset and no pagination ( #1080 )
...
If there were 0 results, it just kept reading and reading forever
2024-04-30 13:03:49 -04:00
Pierre Le Gall
4ddc91be51
improvement: better create/update first argument ( #1060 )
...
* improvement: better create/update first argument
First argument of Ash.create (with a resource)
and Ash.update (with a record) no longer are in a tuple
with its arguments.
Arguments are moved in the input option.
* improvement: create/update params no more an opts
`Ash.create(User, %{name: "Yasmine"})` 🎉
* improvement: raise if changeset already validated
Raise an argument error for already validated changeset
when params are given.
2024-04-30 13:02:27 -04:00
Jeremy Grant
45b76c209d
fix: union array argument/attribute handling when current attribute is ( #1023 )
2024-04-29 22:24:44 -04:00
Jechol Lee
856ac698b7
fix: Changeset.present? to be false when belongs_to is set to nil ( #1067 )
...
* Changeset.present? to be false when belongs_to is set to nil
* match empty list
* match empty list 2
2024-04-29 07:38:06 -04:00
Zach Daniel
2f1a0fec71
fix: set resource
option in bulk interfaces
2024-04-27 23:56:11 -04:00
Zach Daniel
3f977ff98d
improvement: simplifications and clarifications around bulk callback behavior
2024-04-27 10:14:31 -04:00
Jinkyou Son
1acbce4ebb
improvement: Treat asterisk as a single arguemnt in accept ( #1062 )
2024-04-26 03:26:15 -04:00
Zach Daniel
c8e93877ea
improvement: support atomics, update_query, destroy_query in ETS data layer
2024-04-25 22:18:54 -04:00
Pierre Le Gall
65e26cbc16
feat: Ash.create and Ash.update oneliner ( #1055 )
...
* feat: Ash.create and Ash.update oneliner
See #1015 .
* fix: opts dispatch for create and update
* chore: shorten arguments by args
2024-04-24 15:28:26 -04:00
Jechol Lee
44c38277e5
improvement: Add attributes_present, attributes_absent. ( #1046 )
...
* Add attribute_present, attribute_absent.
* Refactor
* plural name: attributes_present/absent
* Fix conflict
2024-04-23 22:01:35 -04:00
Jechol Lee
7ed746990a
Fixed validation tests for embedded ( #1049 )
2024-04-23 12:38:29 -04:00
Frank Dugan III
35961a793d
feat: leverage resource domain for eager/pre checking ( #1040 )
...
closes #1022
2024-04-22 17:15:27 -04:00
Zach Daniel
fc931ab224
test: add tests for code interfaces that take maps
2024-04-20 15:14:21 +01:00
Riccardo Binetti
6d209e8836
feat: configurable multitenancy on read actions ( #1030 )
...
Allow making specific read actions able to optionally or totally bypass
multitenancy
2024-04-16 12:09:13 +01:00
Riccardo Binetti
7c189ede32
fix: fix typo in load test ( #1031 )
2024-04-16 12:06:48 +01:00
Riccardo Binetti
11de5dd64f
improvement: use explicit read actions when reading relationships ( #1029 )
...
While filter, sorts etc are already copied from the read action into the query,
using the right action is relevant, for example, when it's checked against in
policies, or in preparations that check the action name from the query
2024-04-15 22:33:56 +01:00
Riccardo Binetti
9c74e52bd8
improvement: make match/1
overridable in Ash.Type.Enum ( #1020 )
...
Allow handling additional inputs to map them to one of the enum values
2024-04-13 14:07:23 -04:00
Lukas Ender
10e3722446
fix: code_interface
actions accept @context
( #1016 )
2024-04-12 10:26:46 -04:00
Zach Daniel
47dde10329
improvement: adding domain to embedded resource is an error
2024-04-11 22:28:47 -04:00
Zach Daniel
2474fbed44
improvement: raise more sensible error on unsupported pagination
2024-04-11 09:38:49 -04:00
Riccardo Binetti
f2236c9092
chore: failing test for strict loads on nested relationship loads ( #1011 )
2024-04-11 09:29:12 -04:00
Jechol Lee
0b79515f69
fix: fix date_add query function ( #1010 )
2024-04-11 07:42:11 -04:00
Riccardo Binetti
cd4299d6e5
chore: add failing test for calculations on private relationships ( #1008 )
2024-04-10 18:26:42 -04:00
Zach Daniel
829f6d6e49
improvement: support builder options in read
code interfaces
2024-04-10 15:57:30 -04:00
Zach Daniel
bae263ca12
improvement: support omitting generic action return types
2024-04-10 13:46:44 -04:00
Riccardo Binetti
9f2b4ab8ba
improvement: call ToTenant protocol when setting tenant in actions ( #1004 )
2024-04-10 09:35:39 -04:00
Rebecca Le
3fce34cda6
fix: Validate all conditions in a numericality
validation instead of only the last ( #997 )
...
The previous `reduce` loop did not break on the first failure and
return the error, it returned the last iteration of the loop
Some more work may need to be done on the atomic side of the validation,
I'm not familiar with how they work!
2024-04-10 09:25:42 -04:00
139058d4c0
fix(Ash.Reactor): crash when calling an ash reactor for the first time.
...
Thanks to @carlgleisner for the [detailed reproduction](https://github.com/carlgleisner/reactor_notification_worker_issue ).
The problem was caused by an attempt to not have nested reactors indepdently publish their notifications separate to the parents but contained a logic flaw which caused the agent to not start, but only the first time you try and use a given reactor.
The fix involves _always_ starting a notification agent for each reactor, but nesting them. When a reactor completes it either publishes it's notifications to the parent reactor or to ash if there are no parent reactors.
2024-04-10 06:19:38 +12:00
Zach Daniel
1854880def
improvement: add config :ash, require_atomic_by_default?, false
, for upgrading
2024-04-09 13:45:19 -04:00
Zach Daniel
25c1063e45
fix: add context argument to before_action
and after_action
for read actions
...
closes #999
2024-04-09 13:21:06 -04:00
Andreas Donig
95ecc5155c
fix: add base case for Ash.Resource.Info.public_relationship/2 ( #1000 )
...
test: Add a simple test for Ash.Resource.Info.public_relationship/2
---------
Co-authored-by: Andreas Donig <git@innwiese.de>
2024-04-09 13:17:03 -04:00
321f43bd05
feat(Ash.Reactor): Add new change
step type which can be used to modify changesets.
2024-04-09 09:03:04 +12:00
2973c0db94
improvement(Ash.Reactor): Allow create
to be provided an initial value.
...
The initial value can be either a resource or a changeset.
2024-04-09 09:03:04 +12:00
c67295de6e
improvement: Allow Reactor modules to be run directly from generic actions. ( #993 )
...
- Extends the generic action runner to detect when the `run` module is a Reactor and automatically executes it in the correct way.
- Adds a verifier that detects said actions and ensures that action arguments are present for all expected inputs.
2024-04-08 16:48:58 -04:00
Zach Daniel
5e1df439d7
chore: format
2024-04-08 12:15:09 -04:00
Zach Daniel
c31fbc9c3e
fix: don't raise error on keyword input to create interface
2024-04-08 08:41:33 -04:00
Zach Daniel
951eaba973
chore: fix build/test
2024-04-07 08:05:23 -04:00
Zach Daniel
d2ea5bb108
docs: rewrite action docs
...
improvement: synthesize attributes from atomics for better notifications
2024-04-07 08:02:10 -04:00
Dmitry Maganov
bc00873cfd
fix: undo adding primary key argument for methods with get?
( #989 )
2024-04-07 06:41:03 -04:00
Riccardo Binetti
7d75e64d86
feat: add update_change
function and builtin change ( #976 )
2024-04-07 05:02:38 -04:00
Riccardo Binetti
355bd73bf9
improvement: make Ash.Resource.Validation.Match partially atomic ( #979 )
...
* fix: handle partially atomic validations in run_action_changes
* improvement: make Ash.Resource.Validation.Match partially atomic
2024-04-06 17:50:54 -04:00
Riccardo Binetti
38c1ca808d
fix: return {:error, query} for invalid query in Aggregate.run/4 ( #982 )
...
Avoid making callers like Ash.aggregate crash with a WithClause error
since they expect an :ok/:error tuple
2024-04-05 06:36:05 -04:00